Clone a running gentoo machine onto another machine
Hi All ,
I've been wondering how one can clone an entire gentoo system and copy it to another physical machine , while the original system is still running ( means , ghost , acronis and other tools that force me to shutdown the system are not acceptable )
So , someone told me to try just "tar" the whole system to the other machine and "untar" it there.
The question is how can I do that ? what are the correct attributes and flags ?
Or maybe someone have other ideas ?
Thanks
Benyamin
03-30-2008, 07:48 PM
Hal Martin
Clone a running gentoo machine onto another machine
Benyamin Dvoskin wrote:
> Hi All ,
>
> I've been wondering how one can clone an entire gentoo system and copy
> it to another physical machine , while the original system is still
> running ( means , ghost , acronis and other tools that force me to
> shutdown the system are not acceptable )
>
> So , someone told me to try just "tar" the whole system to the other
> machine and "untar" it there.
It is possible, that I know, but it is also difficult.
>
> The question is how can I do that ? what are the correct attributes
> and flags ?
You cannot use tar unless you create an exclude file, as it will copy
the contents of /dev and /sys, which means the entire contents of RAM,
and anything that is currently being generated by your devices will be
copied as well.
Personally, I would use either tar or rsync to do this, however, in
saying that, I have never actually done this with a live system. This is
the tar command I use for copying inactive systems, and it works quite well.
(cd /mnt/source; tar cfpl - .) | (cd /mnt/dest; tar xfp -)
I assume you could just generate an exclude file, and include that in
the first command ('tar cfpl - .') and it *should* work for you.
The other way would be to use rsync, which I have less experience using,
but should do the job.
rsync -avHp --progress / /mnt/dest/
There's a space between / and /mnt/dest, just incase that's unclear...
>
> Or maybe someone have other ideas ?
Again, you'd have to find a way to exclude /dev /sys, and probably
another directory or two too, but again, I don't really have any
experience copying a live system. I'm sure other learned people on this
list will have lots of useful suggestions for you!
>
> Thanks
>
> Benyamin
-Hal
--
gentoo-user@lists.gentoo.org mailing list
03-30-2008, 08:05 PM
Neil Bothwick
Clone a running gentoo machine onto another machine
On Sun, 30 Mar 2008 15:48:54 -0400, Hal Martin wrote:
> You cannot use tar unless you create an exclude file, as it will copy
> the contents of /dev and /sys, which means the entire contents of RAM,
> and anything that is currently being generated by your devices will be
> copied as well.
>
> Personally, I would use either tar or rsync to do this, however, in
> saying that, I have never actually done this with a live system. This is
> the tar command I use for copying inactive systems, and it works quite
> well.
>
> (cd /mnt/source; tar cfpl - .) | (cd /mnt/dest; tar xfp -)
>
> I assume you could just generate an exclude file, and include that in
> the first command
You don't need an exclude file to avoid /dev and /sys because they are on
separate filesystems, so your use of -l takes care of this.
Rsync may work, or it may complain that files have changed between
building the list and copying them and you'd need to use -x to do the
same as -l with tar. Either way, shut down as many services as possible
during the copy, particularly anything that uses databases.
--
Neil Bothwick
If you got the words it does not mean you got the knowledge.
03-30-2008, 08:40 PM
Tim
Clone a running gentoo machine onto another machine
Benyamin Dvoskin wrote:
> Hi All ,
>
> I've been wondering how one can clone an entire gentoo system and copy
> it to another physical machine , while the original system is still
> running ( means , ghost , acronis and other tools that force me to
> shutdown the system are not acceptable )
>
> So , someone told me to try just "tar" the whole system to the other
> machine and "untar" it there.
>
> The question is how can I do that ? what are the correct attributes and
> flags ?
>
> Or maybe someone have other ideas ?
>
> Thanks
>
> Benyamin
Could you be more specific about the destination machine? Is it already
running some Linux distro, or is it a new machine with no OS? If it's
the latter, you'll have to be more careful with the boot procedure,
kernel options, etc.