John R Pierce wrote:
Bowie Bailey wrote:
I have a CentOS 4.4 system where all of the main filesystems are on a single hard drive. This drive is starting to give some errors, so I got a new (larger) drive to replace it with. What is the easiest way to copy my filesystems over to the new drive?
I considered using dd, but I lose the extra capacity of the new drive that way.
I tried using SystemImager, but it is giving me some errors.
I think the easiest way may be to boot from the LiveCD, recreate the partitions, copy the info with rsync and then fix the boot partition and grub. Any tips or pointers to a good how-to?
I'm assuming you're using straight ext3 without LVM or raid....
I'd probably boot the regular CD into rescue mode, without mounting the file systems, then partition the new disk to suit (making each partition at least as large as the original drive, and in the same order, then run something like....
this assumes new drive is hda, old drive is hdb
mkdir /mnt/src /mnt/dst for f in 1 2 5 6; do mount /dev/hdb$f /mnt/src mount /dev/hda$f /mnt/dst dump 0f - /mnt/src | (cd /mnt/dst; restore rf - ) umount /mnt/dst /mnt/src end mkswap /dev/hda3 mount /dev/hda2 /mnt/dst && mount /dev/hda1 /mnt/dst/boot chroot /mnt/dst grub-install /dev/hda ^z umount /mnt/dsk/boot; umount /mnt/dsk
adjust file and device names to suit. dump to restore like that creates a very accurate copy of a file system, complete with special files, links, ACLs, permissions, etc, etc intact.
now, swap the new drive
(where 1, 2, 5, 6 are your file system partitions, leaving out your swap which I'm guessing is hda3)
I attempted this method with a few modifications and I'm mostly done.
I partitioned the new drive and created the filesystems. I then mounted them one by one and copied the information over. There is a bad inode that caused 'dump' to crash, so I used 'rsync -a' to make the copy instead.
When I tried to do the 'chroot' and 'grub-install', grub complained that it didn't have a device file (which it didn't, /dev/ was empty). So I copied the '/dev/hda*' files from the rescue environment to the destination hard drive and tried again. This time, the 'grub-install' ran fine.
Now the problem is that when I try to boot, I get the world's worst error message: "GRUB GRUB GRUB...". I read that this can be fixed by setting your bios to manual rather than auto for the hard drives, but that didn't work for me. What else can I do? I think everything is copied to the new drive, I just need to convince it to boot.