Linux – move to new hard drive
by iam8up on Jun.03, 2010, under linux
GREAT article on this…
Note if you copy/paste some of the commands the “-” comes out as “.” from that site to Putty.
Basically you add the new disk, usually for VMware you’ll run
echo "- - -" > /sys/class/scsi_host/host0/scan
partition it the same (replicate the mount points and of course allot equal or greater space then current data use) and then mount them and run
cd /mnt/sdb1 && dump -0uan -f – /boot | restore -r -f -
cd /mnt/sdb3 && dump -0uan -f – /| restore -r -f -
or something similar. I usually partition /boot, swap and then /.
This worked on my CentOS 5 in VMware.
And for the longhand…
fdisk /dev/sdb
mkfs -t ext3 /dev/sdb1
mkfs -t ext3 /dev/sdb3
mkswap /dev/sdb2
tune2fs -L "/boot" /dev/sdb1
tune2fs -L "/" /dev/sdb3
mkdir /mnt/sdb1 && mount /dev/sdb1 /mnt/sdb1
cd /mnt/sdb1 && dump -0uan -f – /boot | restore -r -f -
mkdir /mnt/sdb3 && mount /dev/sdb3 /mnt/sdb3
cd /mnt/sdb3 && dump -0uan -f – / | restore -r -f -
grub-install
grub>root (hd1, 0)
grub>setup (hd1)
grub>quit
