You are in Home page |
![]() |
![]() |
|||
![]() |
![]() |
3. Preparing the destination computer3.1. How to run netcat on destination computer?To let the destination computer to be visible on the network, to run netcat and to mount the destination hard disk, an operating system is required to be running on this computer. Where lives this OS if its hard disk is empty. We could install another hard disk, to use the first one for installing a Linux distribution with netcat support and to use the other one clone the original box. We could prepare a linux bootable floppy that create a root ram disk that can enable networking and with a static linked version of netcat tools. But the best and fast way i found is to use a CD bootable Linux distribution like knoppix which have all we need (and also over) for our scopes. In the next of the document we referer to Knoppix Live CD version 3.2. So, let's download this CD Live distribution and let's copy it to a writable CD-ROM. Be sure that the computer bios boot sequence begins with CD-ROM drive, insert Knoppix in the CD drive and power on this computer. After boot sequence we have a running Linux box that only use the CD drive. We have now an environment where bigins our path to backup the source box by partitioning the destination disk. 3.2. Partitionate the destionation disk.First of all we need to partitionate the destination disk. Since original filesystem it's located in a single partition plus a swap partition we must create two partition on this new disk. Open a shell console terminal, using su - become root and start fdisk. knoppix@0[knoppix]$ su - root@0[root]# fdisk /dev/hdaType p on the fdisk command line to see disk information and to be sure that it's empty. Command (m for help): p Disk /dev/hda: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id Systemand, as you can see, destination hard disk is not partitionating and is 4.3 Gbyte. Let's go to create a new swap partition with side double as the available RAM memory. In our scenario RAM size is 256 Mbyte so we creare a swap partition of 512 Mbyte: Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-522, default 1): 1 Last cylinder or +size or +sizeM or +sizeK (1-522, default 522): +512M Command (m for help): p Disk /dev/hda: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 63 506016 83 LinuxThis partition is now a standard linux partition (Id=83). Let's modify Id type to 82 to change it to a Linux swap partition. Command (m for help): t Selected partition 1 Hex code (type L to list codes): 82 Changed system type of partition 1 to 82 (Linux swap) Command (m for help): p Disk /dev/hda: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 63 506016 82 Linux swapLet's create the Linux system partition Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (64-522, default 64): Using default value 64 Last cylinder or +size or +sizeM or +sizeK (64-522, default 522): Using default value 522 Command (m for help): p Disk /dev/hda: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 63 506016 82 Linux swap /dev/hda2 64 522 3686917+ 83 Linuxset the bootable flag to /dev/hda2 Command (m for help): a Partition number (1-4): 2 Command (m for help): p Disk /dev/hda: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 63 506016 82 Linux swap /dev/hda2 * 64 522 3686917+ 83 Linuxand commit changes to partition table: Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.The destination disk is now properly partitionated. We proceed to format it. 3.3. Format the destination diskTo use swap partition and to mount linux partition we need to format them. First of all we can format the swap partition and using it to make faster next operations. root@0[root]# mkswap /dev/hda1 Setting up swapspace version 1, size = 518156 kB root@0[root]# swapon /dev/hda1Then we can format the linux partition using -j flag to format it with ext3 journaled filesystem root@0[root]# mke2fs -j /dev/hda2 mke2fs 1.33 (21-Apr-2003) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 461216 inodes, 921729 blocks 46086 blocks (5.00%) reserved for the super user First data block=0 29 block groups 32768 blocks per group, 32768 fragments per group 15904 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: doneNow that /dev/hda2 is an ext3 linux filesystem we can mount it. Create a directory /mnt/hda2 on Knoppix ramdisk filesystem and mount the real hard disk on it: root@0[root]# mkdir /mnt/hda2 root@0[root]# mount /dev/hda2 /mnt/hda2/ root@0[root]# ls -al /mnt/hda2/ total 21 drwxr-xr-x 3 root root 4096 Aug 13 10:06 . drwxr-xr-x 7 root root 1024 Aug 13 10:14 .. drwx------ 2 root root 16384 Aug 13 10:06 lost+foundNow we can complete the destination computer configuration enabling networking. 3.4. Enable networking on destination computerOur scope is to transfer original box to destination box over a network connection so, supposing the original computer already has a working network configuration, we need to enable network on the destination computer. A lot often the transfer will happen between two computer on the same local net therefore the destination computer will have to be configured with an address pertaining to the same range of the compute sorce. Supposing that the original box have ip address as 192.168.0.1 with a netmask 255.255.255.0 or, in other terms, a /24 network range we can configure the destination box with a free ip address in the same range, say 192.168.0.2, from a terminal console with this commands root@0[root]# ip link set eth0 up root@0[root]# ip address add 192.168.0.2/24 dev eth0After this it could be possible to ping the original box root@0[root]# ping -c 1 192.168.0.1 PING 192.168.0.1 (192.168.0.1): 56 data bytes 64 bytes from 192.168.0.1: icmp_seq=0 ttl=255 time=6.4 ms --- 192.168.0.1 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 6.4/6.4/6.4 msNow all is ready to begin tranfer data over network. We can now use netcat to clone the original box. |