* [gentoo-user] Clone a running gentoo machine onto another machine
@ 2008-03-30 19:29 Benyamin Dvoskin
2008-03-30 19:48 ` Hal Martin
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Benyamin Dvoskin @ 2008-03-30 19:29 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 493 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 561 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 19:29 [gentoo-user] Clone a running gentoo machine onto another machine Benyamin Dvoskin
@ 2008-03-30 19:48 ` Hal Martin
2008-03-30 20:05 ` Neil Bothwick
2008-03-30 20:05 ` Michal 'vorner' Vaner
2008-03-30 20:40 ` Tim
2 siblings, 1 reply; 12+ messages in thread
From: Hal Martin @ 2008-03-30 19:48 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 19:48 ` Hal Martin
@ 2008-03-30 20:05 ` Neil Bothwick
2008-04-01 19:53 ` Eric Martin
2008-04-01 20:45 ` Dan Cowsill
0 siblings, 2 replies; 12+ messages in thread
From: Neil Bothwick @ 2008-03-30 20:05 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 19:29 [gentoo-user] Clone a running gentoo machine onto another machine Benyamin Dvoskin
2008-03-30 19:48 ` Hal Martin
@ 2008-03-30 20:05 ` Michal 'vorner' Vaner
2008-03-30 20:40 ` Tim
2 siblings, 0 replies; 12+ messages in thread
From: Michal 'vorner' Vaner @ 2008-03-30 20:05 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 923 bytes --]
Hello
On Sun, Mar 30, 2008 at 10:29:39PM +0300, Benyamin Dvoskin wrote:
> 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.
rsync is usually faster, as it reads the first one and writes to the
second one at the same time. You should read its' man page, there are
nice things like '-x' flag (so it copies only one filesystem and does
not enter sub-filesystems, like dev and)
As it uses ssh by default, you need only sshd on the remote server and
you can tweak thinks like compression while transferring.
--
All flame and insults will go to /dev/null (if they fit)
Michal 'vorner' Vaner
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 19:29 [gentoo-user] Clone a running gentoo machine onto another machine Benyamin Dvoskin
2008-03-30 19:48 ` Hal Martin
2008-03-30 20:05 ` Michal 'vorner' Vaner
@ 2008-03-30 20:40 ` Tim
2008-03-30 21:52 ` Benyamin Dvoskin
2 siblings, 1 reply; 12+ messages in thread
From: Tim @ 2008-03-30 20:40 UTC (permalink / raw
To: gentoo-user
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.
-Tim
--
gentoo-user@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 20:40 ` Tim
@ 2008-03-30 21:52 ` Benyamin Dvoskin
2008-03-31 15:29 ` YoYo Siska
0 siblings, 1 reply; 12+ messages in thread
From: Benyamin Dvoskin @ 2008-03-30 21:52 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]
It is a running gentoo system in this case
But it doesnt make a difference to me. I want to know generally.
anyway I will try what everyone wrote here and we'll see how it goes.
Thanks again.
On Sun, Mar 30, 2008 at 11:40 PM, Tim <root@pneumaticsystem.com> wrote:
> 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.
>
> -Tim
> --
> gentoo-user@lists.gentoo.org mailing list
>
>
[-- Attachment #2: Type: text/html, Size: 1802 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 21:52 ` Benyamin Dvoskin
@ 2008-03-31 15:29 ` YoYo Siska
0 siblings, 0 replies; 12+ messages in thread
From: YoYo Siska @ 2008-03-31 15:29 UTC (permalink / raw
To: gentoo-user
Benyamin Dvoskin wrote:
> It is a running gentoo system in this case
>
> But it doesnt make a difference to me. I want to know generally.
>
>
> anyway I will try what everyone wrote here and we'll see how it goes.
>
> Thanks again.
>
Btw You can also do a
mount --bind / /mnt/something
and then you will see the "original" root in /mnt/something without any
of the other filesystems. This is sometimes better if you want an exact
copy, because fex /dev usually has some basic nodes which get covered by
the udev's tmpfs, and althought you normally don't need them... ;)
I "cloned" a few running systems this way (copied it to an usb disk,
setup lilo and took the disk to another machine ;) but it was always
with mount -o remount,ro / and the systems were minimal (system+few
packages, almost nothing running, so it was possible to remount it ro)
yoyo
--
gentoo-user@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 20:05 ` Neil Bothwick
@ 2008-04-01 19:53 ` Eric Martin
2008-04-01 20:45 ` Dan Cowsill
1 sibling, 0 replies; 12+ messages in thread
From: Eric Martin @ 2008-04-01 19:53 UTC (permalink / raw
To: gentoo-user
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Neil Bothwick wrote:
| 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.
If you are using lvm you could also make a snapshot of your running
system (after stopping databases etc) and then start the services and
just grab stuff off of the snapshot. That way you're getting a snapshot
in time as opposed to a very large window of data.
- --
Eric Martin
PGP fingerprint = D1C4 086E DBB5 C18E 6FDA B215 6A25 7174 A941 3B9F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH8pKxdheOldgSlQgRAhO3AJ9+rZB8E/DSZ4vGe0+I1MdXf9IaYgCgqRNm
/W8YU6zPMbuMjH5EMo9Rc28=
=AvYH
-----END PGP SIGNATURE-----
--
gentoo-user@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-03-30 20:05 ` Neil Bothwick
2008-04-01 19:53 ` Eric Martin
@ 2008-04-01 20:45 ` Dan Cowsill
2008-04-01 20:55 ` Steven Lembark
2008-04-01 20:55 ` Neil Bothwick
1 sibling, 2 replies; 12+ messages in thread
From: Dan Cowsill @ 2008-04-01 20:45 UTC (permalink / raw
To: gentoo-user
On Sun, Mar 30, 2008 at 4:05 PM, Neil Bothwick <neil@digimed.co.uk> wrote:
> 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.
>
Now, correct me if I'm wrong, but I had read that if you don't copy
the files in /dev, udev won't mount properly on the machine you're
cloning to and all hell will break lose. Also, iirc, I believe I
tarred a running machine (including /dev, excluding /sys) and the
clone was successful.
Any thoughts?
--
Dan Cowsill
http://www.danthehat.net
--
gentoo-user@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-04-01 20:45 ` Dan Cowsill
@ 2008-04-01 20:55 ` Steven Lembark
2008-04-01 20:55 ` Neil Bothwick
1 sibling, 0 replies; 12+ messages in thread
From: Steven Lembark @ 2008-04-01 20:55 UTC (permalink / raw
To: gentoo-user
> Now, correct me if I'm wrong, but I had read that if you don't copy
> the files in /dev, udev won't mount properly on the machine you're
> cloning to and all hell will break lose. Also, iirc, I believe I
> tarred a running machine (including /dev, excluding /sys) and the
> clone was successful.
>
> Any thoughts?
One other way: mirror the boot/root/install devices
(maybe a single partition). You can make, sync,
and drop the mirror, install grub on the new mbr
and have a clone of the system (basically you'd
be in the same situaiton as if the primary drive
of a mirrored setup croaked).
--
Steven Lembark +1 888 359 3508
Workhorse Computing 85-09 90th St
lembark@wrkhors.com Woodhaven, NY 11421
--
gentoo-user@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-04-01 20:45 ` Dan Cowsill
2008-04-01 20:55 ` Steven Lembark
@ 2008-04-01 20:55 ` Neil Bothwick
2008-04-01 21:13 ` Dan Cowsill
1 sibling, 1 reply; 12+ messages in thread
From: Neil Bothwick @ 2008-04-01 20:55 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 909 bytes --]
On Tue, 1 Apr 2008 16:45:49 -0400, Dan Cowsill wrote:
> Now, correct me if I'm wrong, but I had read that if you don't copy
> the files in /dev, udev won't mount properly on the machine you're
> cloning to and all hell will break lose.
There are two files you need in the dev directory of the root
filesystem, console and null. Create those, or bind mount the root
directory as a;ready suggested.
> Also, iirc, I believe I
> tarred a running machine (including /dev, excluding /sys) and the
> clone was successful.
There's no reason why it wouldn't be, but you're wasting a bunch of pace
and inodes on your root filesystem by putting a load of stuff in /dev
that is then hidden when udev starts.
--
Neil Bothwick
Snacktrek, n.:
The peculiar habit, when searching for a snack, of constantly
returning to the refrigerator in hopes that something new will have
materialized.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Clone a running gentoo machine onto another machine
2008-04-01 20:55 ` Neil Bothwick
@ 2008-04-01 21:13 ` Dan Cowsill
0 siblings, 0 replies; 12+ messages in thread
From: Dan Cowsill @ 2008-04-01 21:13 UTC (permalink / raw
To: gentoo-user
On Tue, Apr 1, 2008 at 4:55 PM, Neil Bothwick <neil@digimed.co.uk> wrote:
> On Tue, 1 Apr 2008 16:45:49 -0400, Dan Cowsill wrote:
>
> > Now, correct me if I'm wrong, but I had read that if you don't copy
> > the files in /dev, udev won't mount properly on the machine you're
> > cloning to and all hell will break lose.
>
> There are two files you need in the dev directory of the root
> filesystem, console and null. Create those, or bind mount the root
> directory as a;ready suggested.
>
>
> > Also, iirc, I believe I
> > tarred a running machine (including /dev, excluding /sys) and the
> > clone was successful.
>
> There's no reason why it wouldn't be, but you're wasting a bunch of pace
> and inodes on your root filesystem by putting a load of stuff in /dev
> that is then hidden when udev starts.
>
>
> --
> Neil Bothwick
>
> Snacktrek, n.:
> The peculiar habit, when searching for a snack, of constantly
> returning to the refrigerator in hopes that something new will have
> materialized.
>
Oooh I see I see. Thanks!
--
Dan Cowsill
http://www.danthehat.net
--
gentoo-user@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-04-01 21:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-30 19:29 [gentoo-user] Clone a running gentoo machine onto another machine Benyamin Dvoskin
2008-03-30 19:48 ` Hal Martin
2008-03-30 20:05 ` Neil Bothwick
2008-04-01 19:53 ` Eric Martin
2008-04-01 20:45 ` Dan Cowsill
2008-04-01 20:55 ` Steven Lembark
2008-04-01 20:55 ` Neil Bothwick
2008-04-01 21:13 ` Dan Cowsill
2008-03-30 20:05 ` Michal 'vorner' Vaner
2008-03-30 20:40 ` Tim
2008-03-30 21:52 ` Benyamin Dvoskin
2008-03-31 15:29 ` YoYo Siska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox