There are several methods to move Linux to another hard disk on the same server.
But I used Unix dump / restore utility to do this …
Step1. First you need a new hard disk partition in the same way as with previous unit (Linux is running on). I usually use the utility ‘fdisk‘.
Let us suppose that the old drive is /dev/sda and a new one is /dev/sdb.
To view the partition table hda please run ‘fdisk-l /dev/ sda “which should show something like this:
[email protected]:~# fdisk -l /dev/sda
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007384e
Device Boot Start End Blocks Id System
/dev/sda1 * 1 9330 74936320 83 Linux
/dev/sda2 9330 9730 3212289 5 Extended
/dev/sda5 9330 9730 3212288 82 Linux swap
Step2. After this run ‘fdisk /dev/sdb’ and make the same partitions at it. Interactive mode of fdisk utility is well documented and is very intuitive, so I don’t think it would be difficult to perform partitioning.
After this is done, we should make new filesystems at partitions we’ve created:
mkfs -t ext3 /dev/sdb1
Step3. Now new hard drive preparation is finished and we can proceed with moving Linux to it. Mount new filesystem and change directory to it:
mount /dev/hdb1 /mnt/hdb1
Step4. Perform moving by command:
dump -0uan -f – / | restore -r -f
When dump/restore procedures are done we should install boot loader to new HDD. Run ‘grub’ utility and execute in it’s console:
root (hd1, 0)