I recently asked about copying a running system to a new drive.
As a postscript, I'm wondering if it would have been preferable to run the machine under a Live OS, and simply copy the root partition to the new drive? Eg while running under the LiveOS, # mkdir /mnt/old /mnt/new # mount /dev/sda7 /mnt/old # mount /dev/sdb6 /mnt/new # cp -avx /mnt/old /mnt/new or # rsync -ax --progress /mnt/old /mnt/new
Hello Timothy,
On Wed, 04 May 2016 12:38:41 +0200 Timothy Murphy gayleard@eircom.net wrote:
I recently asked about copying a running system to a new drive.
As a postscript, I'm wondering if it would have been preferable to run the machine under a Live OS, and simply copy the root partition to the new drive? Eg while running under the LiveOS, # mkdir /mnt/old /mnt/new # mount /dev/sda7 /mnt/old # mount /dev/sdb6 /mnt/new # cp -avx /mnt/old /mnt/new or # rsync -ax --progress /mnt/old /mnt/new
I personally would not copy FROM or TO running systems. Thus, proceeding to the copy from a third (liveCD or not) system sounds good to me. A bare cp -ax, tar or rsync. Of course, make sure that the target fs is empty before copying (WRT system files).
Regards,
On Wed, May 4, 2016 at 7:22 AM, wwp subscript@free.fr wrote:
Hello Timothy,
I personally would not copy FROM or TO running systems. Thus, proceeding to the copy from a third (liveCD or not) system sounds good to me.
Agreed. It appears others have had success doing so; but, I prefer to eliminate as many variables as possible.
I've done the following:
1. yum update Server 1. 2. complete a minimal CentOS install on Server 2. <<must be the same version as Server 1>> 3. yum update Server 2. 4.Then boot both using LiveCD of choice.
<<no chroot necessary when using LiveCD environment>>
5. rsync --delete-after --force -aAHPWl --exclude-from="/root/centos7-rsync-exclude.txt" / root@10.10.10.200:/ <<----the host address of the server to receive the sync/copy. ((that's a lowercase "L" after "-aAHPW"))
6. the "centos7-rsync-exclude.txt" file contains:
boot dev etc/fstab etc/grub2.cfg etc/mtab etc/default/grub etc/networks etc/sysconfig/network* etc/sysconfig/kernel etc/udev lib/modules mnt proc sys tmp var/lock
On Wed, 2016-05-04 at 12:38 +0200, Timothy Murphy wrote:
I recently asked about copying a running system to a new drive.
As a postscript, I'm wondering if it would have been preferable to run the machine under a Live OS, and simply copy the root partition to the new drive? Eg while running under the LiveOS, # mkdir /mnt/old /mnt/new # mount /dev/sda7 /mnt/old # mount /dev/sdb6 /mnt/new # cp -avx /mnt/old /mnt/new or # rsync -ax --progress /mnt/old /mnt/new
When copying systems I developed a preference for cpio; fewer problems handling weird inode types.
My typical recipe is: - rescue boot the new system and create my desired disk partitioning - decide what top level directories I want duplicated on the new system - iterate through them: for i in bin boot lib etc .... ; do mkdir -p /mnt/sysimage/$i ssh root@$OLDSYSTEM "cd /$i && find . -xdev -print0 | cpio --null -oaVc" | (cd /mnt/sysimage/$i && cpio --no-absolute-filenames -imVdc ) done
- make any adjustments that might necessary in the configuration - if this was a copy of a running system I might quiesce the original, do a final rsync of data that might have changed between now and when I made the cpio copy - grub-install (or equivalent) - release the hounds.
On Wed, May 4, 2016 at 3:38 AM, Timothy Murphy gayleard@eircom.net wrote:
I recently asked about copying a running system to a new drive.
As a postscript, I'm wondering if it would have been preferable to run the machine under a Live OS, and simply copy the root partition to the new drive? Eg while running under the LiveOS, # mkdir /mnt/old /mnt/new # mount /dev/sda7 /mnt/old # mount /dev/sdb6 /mnt/new # cp -avx /mnt/old /mnt/new or # rsync -ax --progress /mnt/old /mnt/new
As has been discussed, doing file copies from a running system is not recommended.
If by "Live OS" you mean booting the system with a LiveCD, then clonezilla would all of the above.
note: target (new) disk >= disk of the old system
-- Arun Khan