-   Linux - Software (
-   -   Moving root filesystem to another disk (

h8dk97 05-19-2009 01:25 AM

Moving root filesystem to another disk
Hi there,

Iíve setup a filesystem on a RAID 0+1 and am looking at moving root filesystem from a single disk to the new one. I could not install CentOS on mirrored filesystem as the RAID card did not have a pre-built driver for CentOS 5.3, so I had to compile the driver after installing the system.

What Iím going to do now is:

1. Mount the new mirrored filesystem under /root1
2. use find | cpio to copy everything from the existing / to /root1
3. use grub to create a boot record on /root1
4. edit /root1/etc/fstab to point / to the new disk
5. reboot the system and keep my fingers crossed

Is this the way to go? Am I missing anything?

Thanks very much.

jiml8 05-19-2009 01:33 AM

The problem you might have is that you intend to boot /root1 then move everything into /root1 while the system is running out of that partition.

You'll probably be OK, but not certainly.

I think if I were you that I would identify exactly where in the system your raid driver was installed, and I would then make sure that I had a copy of that driver tucked away, and anything in /etc/modules, or /etc/modules.conf or /etc/conf.modules (depending on distro) tucked away safely also. Then, after doing my copy and before rebooting, I'd check all the relevant files to make sure they were there and they were right.

If, after copying, the system didn't work (which could happen), I'd have a Linux Live CD sitting ready, and I'd boot into that to make the checks of the filesystem, then I'd boot into it.

Quakeboy02 05-19-2009 02:25 AM

I've done this sort of thing with a liveCD using "cp -axu from to". There's also the issue of whether you're using fakeraid or mdadm to create your raid. If fakeraid you need dmraid, and you need to update the initfs for the kernel so it can access the raid when the kernel boots up. If mdadm, you need the conf file in the right place and setup correctly on the new drive. In any case, do this stuff from a liveCD to avoid the bulk of the problems during the copy; such as trying to copy /dev, /proc, etc.

h8dk97 05-21-2009 01:32 AM

Thanks a lot for your replies. I'll boot from live cd and then do the copy, will see what happens.

All times are GMT -5. The time now is 04:22 AM.