[CentOS] Transferring system to new drive

m.roth at 5-cent.us m.roth at 5-cent.us
Sat Sep 18 16:15:06 UTC 2010


Timothy Murphy wrote:
> Timothy Murphy wrote:
>
>> Marcelo M. Garcia wrote:
>>
>>>> I was thinking of copying the old root partition with
>>>> sudo cp -a -P /* /mnt/hd
>>
>>> I think the command rsync is a better approach for this task. It has
>>> much more features, for example, you can exclude certain files.
>>
>> Thanks for the suggestion.
>
> Thanks for all the responses.
>
> Further to my query,
> I'm wondering if one can safely copy partitions
> (in particular the root partition / )
> while the system is running.
>
> The reason that I ask is that I'm slightly afraid
> the machine will not re-boot into single-user mode
> with the present OS on the sick disk.

I've done a number of machines - actually, I'll be doing another one
Monday. What we do is
mkdir /new /boot/new
mkdir /old /boot/old
rsync -HPaxvz --exclude olddrve-or-machine:/old olddriveormachine:/. /new/.
and ditto for /boot - note you need the /.
Then
zsh
load files/modules (I forget the exact line, and it's all at work), but
you need this, can't do it, AFAIK, with other shells.
cd /boot
mv * old/
mv old/new/* .
cd /
mv * old/
mv old/new/* .
mv old/lost+found .
sync
sync
Then edit /etc/sysconfig/network-scripts/ifcfg-eth? as needed, and also
/boot/grub/grub.conf, and /boot/grub/device.map, and finally
grub-install /dev/sd<whatever, usually a>
And reboot.

        mark




More information about the CentOS mailing list