* [gentoo-user] Moving the system from one disk to another
@ 2010-04-04 19:05 meino.cramer
2010-04-04 19:09 ` covici
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: meino.cramer @ 2010-04-04 19:05 UTC (permalink / raw
To: Gentoo
Hi,
I have to move my whole system from one disk to another
bigger one.
I think of doing as follows:
Boot a system via CD/DVD (knoppix for example).
Mount small disk read-only
Mount bigger disk read-write
cd into mountpoint of the first one
cp -a . ../<mountpoint_of_bigger_disk>
Seems to me slow but correct? Or?
(I have to set the bootable flag of the correct partion
additionally...)
I dont want to have a booting system afterwards, which "runs" for --
say -- three month and suddenly hit a obscure bug due to my
copy-commands, which only did it to 99.87% correct... ;)
I would like to preserve as much as possible of the file/directoy
times ,,,
Or does a mystical command with s-tar a better job faster?
Thank you very much in adance for any help!
Best regards,
mcc
--
Please don't send me any Word- or Powerpoint-Attachments
unless it's absolutely neccessary. - Send simply Text.
See http://www.gnu.org/philosophy/no-word-attachments.html
In a world without fences and walls nobody needs gates and windows.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Moving the system from one disk to another
2010-04-04 19:05 [gentoo-user] Moving the system from one disk to another meino.cramer
@ 2010-04-04 19:09 ` covici
2010-04-04 19:35 ` [gentoo-user] " Kerin Millar
2010-04-06 2:51 ` [gentoo-user] " Dale
2 siblings, 0 replies; 11+ messages in thread
From: covici @ 2010-04-04 19:09 UTC (permalink / raw
To: gentoo-user
meino.cramer@gmx.de wrote:
>
> Hi,
>
> I have to move my whole system from one disk to another
> bigger one.
>
> I think of doing as follows:
> Boot a system via CD/DVD (knoppix for example).
> Mount small disk read-only
> Mount bigger disk read-write
>
> cd into mountpoint of the first one
> cp -a . ../<mountpoint_of_bigger_disk>
>
> Seems to me slow but correct? Or?
>
> (I have to set the bootable flag of the correct partion
> additionally...)
>
> I dont want to have a booting system afterwards, which "runs" for --
> say -- three month and suddenly hit a obscure bug due to my
> copy-commands, which only did it to 99.87% correct... ;)
>
> I would like to preserve as much as possible of the file/directoy
> times ,,,
>
> Or does a mystical command with s-tar a better job faster?
>
> Thank you very much in adance for any help!
I like rsync and be sure to say --numeric-ids or whatever to retain the
same userids for permissions, but otherwise you are good to go.
--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?
John Covici
covici@ccs.covici.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gentoo-user] Re: Moving the system from one disk to another
2010-04-04 19:05 [gentoo-user] Moving the system from one disk to another meino.cramer
2010-04-04 19:09 ` covici
@ 2010-04-04 19:35 ` Kerin Millar
2010-04-04 20:04 ` Neil Bothwick
2010-04-06 2:51 ` [gentoo-user] " Dale
2 siblings, 1 reply; 11+ messages in thread
From: Kerin Millar @ 2010-04-04 19:35 UTC (permalink / raw
To: gentoo-user
On 04/04/2010 20:05, meino.cramer@gmx.de wrote:
>
> Hi,
>
> I have to move my whole system from one disk to another
> bigger one.
>
> I think of doing as follows:
> Boot a system via CD/DVD (knoppix for example).
> Mount small disk read-only
> Mount bigger disk read-write
>
> cd into mountpoint of the first one
> cp -a . ../<mountpoint_of_bigger_disk>
>
> Seems to me slow but correct? Or?
cp -a is fine although, in my experience, I've found that rsync is more
reliable:
rsync -av /mnt/oldrootfs/. /mnt/newrootfs/.
Note that -a covers almost everything but you may need the following
additional options depending on how your filesystem has been used:
-H = preserve hard link
-A = preserve ACLs
-X = preserve extended attributes (in in doubt, recommended)
Whichever way you go about it, ensure that no pseudo-filesystem or bind
mounts are present within "/mnt/oldrootfs" at the time.
Cheers,
--Kerin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Re: Moving the system from one disk to another
2010-04-04 19:35 ` [gentoo-user] " Kerin Millar
@ 2010-04-04 20:04 ` Neil Bothwick
2010-04-04 23:51 ` Kacper Kopczyński
2010-04-05 1:34 ` walt
0 siblings, 2 replies; 11+ messages in thread
From: Neil Bothwick @ 2010-04-04 20:04 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
On Sun, 04 Apr 2010 20:35:11 +0100, Kerin Millar wrote:
> Whichever way you go about it, ensure that no pseudo-filesystem or bind
> mounts are present within "/mnt/oldrootfs" at the time.
Use the -x option with rsync to stop it descending into other filesystems.
--
Neil Bothwick
Did you hear about the dyslexic devil worshiper?
He sold his soul to Santa!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Re: Moving the system from one disk to another
2010-04-04 20:04 ` Neil Bothwick
@ 2010-04-04 23:51 ` Kacper Kopczyński
2010-04-05 0:16 ` Kerin Millar
2010-04-05 1:34 ` walt
1 sibling, 1 reply; 11+ messages in thread
From: Kacper Kopczyński @ 2010-04-04 23:51 UTC (permalink / raw
To: gentoo-user
Dnia 2010-04-04, o godz. 21:04:03
Neil Bothwick <neil@digimed.co.uk> napisał(a):
> On Sun, 04 Apr 2010 20:35:11 +0100, Kerin Millar wrote:
>
> > Whichever way you go about it, ensure that no pseudo-filesystem or
> > bind mounts are present within "/mnt/oldrootfs" at the time.
>
> Use the -x option with rsync to stop it descending into other
> filesystems.
>
>
AFAIK
"mount --bind / /somewhere" and rsync'ing /somewhere/ instead of / would
be more useful then "-x" option - stage1,2,3 has static /dev entries
which should also be copied. Since udev mounts it with tmpfs, rsync
with -x would skip those entries (static and from tmpfs).
I suppose you can ignore static /dev if you use initrd.
Since author of this thread wants to mount filesystem(s) of "the
system" from livecd of some kind, there is no point in using any of
ideas in this or previous email - there will be no other filesystems
mounted.
I often use that trick with /somewhere/ to backup live system from
laptop to external drive. But it does not work well with innodb...
man mount
man rsync
good luck
--
Kacper Kopczyński
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gentoo-user] Re: Moving the system from one disk to another
2010-04-04 23:51 ` Kacper Kopczyński
@ 2010-04-05 0:16 ` Kerin Millar
0 siblings, 0 replies; 11+ messages in thread
From: Kerin Millar @ 2010-04-05 0:16 UTC (permalink / raw
To: gentoo-user
On 05/04/2010 00:51, Kacper Kopczyński wrote:
> Dnia 2010-04-04, o godz. 21:04:03
> Neil Bothwick<neil@digimed.co.uk> napisał(a):
>
>> On Sun, 04 Apr 2010 20:35:11 +0100, Kerin Millar wrote:
>>
>>> Whichever way you go about it, ensure that no pseudo-filesystem or
>>> bind mounts are present within "/mnt/oldrootfs" at the time.
>>
>> Use the -x option with rsync to stop it descending into other
>> filesystems.
>>
>>
>
> AFAIK
>
> "mount --bind / /somewhere" and rsync'ing /somewhere/ instead of / would
> be more useful then "-x" option - stage1,2,3 has static /dev entries
> which should also be copied. Since udev mounts it with tmpfs, rsync
> with -x would skip those entries (static and from tmpfs).
Well, no, because my response was based on the fact that the duplication
will be carried out from an alternate environment provided by a CD/DVD,
as Meino clearly stated in the original post. Thus, bind mounts,
pseudo-filesystems and chroots need not come into the equation
whatsoever. Indeed, it's the very same concern that you express which
resulted in my recommendation to avoid such shenanigans and keep it
simple. Ergo, just mount the root filesystem - nothing else - and copy
it as-is. Static /dev entries would be copied without issue, as would
everything else. It really couldn't be simpler.
You post hinges on the notion that he would be performing the process
while booted from the system he is duplicating, in which case your
advice would, of course, be entirely sensible. Ergo, he would indeed be
best advised to bind mount / to a temporary directory and use that as
the source for the exact reasons that you mention. I personally would
not recommend doing it under these circumstances but it can certainly be
done (though I'd suggest dropping to runlevel 1 first).
Cheers,
--Kerin
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gentoo-user] Re: Moving the system from one disk to another
2010-04-04 20:04 ` Neil Bothwick
2010-04-04 23:51 ` Kacper Kopczyński
@ 2010-04-05 1:34 ` walt
2010-04-05 1:49 ` Kerin Millar
2010-04-05 7:03 ` Neil Bothwick
1 sibling, 2 replies; 11+ messages in thread
From: walt @ 2010-04-05 1:34 UTC (permalink / raw
To: gentoo-user
On 04/04/2010 01:04 PM, Neil Bothwick wrote:
> On Sun, 04 Apr 2010 20:35:11 +0100, Kerin Millar wrote:
>
>> Whichever way you go about it, ensure that no pseudo-filesystem or bind
>> mounts are present within "/mnt/oldrootfs" at the time.
>
> Use the -x option with rsync to stop it descending into other filesystems.
This is directed to all of you gurus who replied to Meino's post:
Meino's unstated assumption is that his new (larger) disk is already formatted
(possibly partitioned?) before he copies the existing filesystem to it.
IIUC the new disk will then be unbootable until grub or equivalent is installed
on the new disk. Does this seem correct, or not?
My instinct is to use dd to duplicate the entire old disk to the new (unformatted)
disk and then use gparted to twiddle it from there. (But I do love a puzzle ;o)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gentoo-user] Re: Moving the system from one disk to another
2010-04-05 1:34 ` walt
@ 2010-04-05 1:49 ` Kerin Millar
2010-04-05 7:03 ` Neil Bothwick
1 sibling, 0 replies; 11+ messages in thread
From: Kerin Millar @ 2010-04-05 1:49 UTC (permalink / raw
To: gentoo-user
On 05/04/2010 02:34, walt wrote:
> On 04/04/2010 01:04 PM, Neil Bothwick wrote:
>> On Sun, 04 Apr 2010 20:35:11 +0100, Kerin Millar wrote:
>>
>>> Whichever way you go about it, ensure that no pseudo-filesystem or bind
>>> mounts are present within "/mnt/oldrootfs" at the time.
>>
>> Use the -x option with rsync to stop it descending into other
>> filesystems.
>
> This is directed to all of you gurus who replied to Meino's post:
>
> Meino's unstated assumption is that his new (larger) disk is already
> formatted
> (possibly partitioned?) before he copies the existing filesystem to it.
>
> IIUC the new disk will then be unbootable until grub or equivalent is
> installed
> on the new disk. Does this seem correct, or not?
Absolutely correct. Two commands from the grub shell and job done :)
>
> My instinct is to use dd to duplicate the entire old disk to the new
> (unformatted)
> disk and then use gparted to twiddle it from there. (But I do love a
> puzzle ;o)
In general, I'm a proponent of copying filesystems, as opposed to
copying entire block devices or disks. That's not to say that there
aren't some situations where the latter approach makes sense.
Note that it's possible to copy just the portion of the first sector
that contains bootloader code as thus:
dd if=/dev/sda of=/dev/sdb bs=446 count=1
NOTE: that's 446 as opposed to 512 as the latter would result in the
partition table being copied too, which would be most undesirable.
Cheers,
--Kerin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Re: Moving the system from one disk to another
2010-04-05 1:34 ` walt
2010-04-05 1:49 ` Kerin Millar
@ 2010-04-05 7:03 ` Neil Bothwick
[not found] ` <201004051201.30038.michaelkintzios@gmail.com>
1 sibling, 1 reply; 11+ messages in thread
From: Neil Bothwick @ 2010-04-05 7:03 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]
On Sun, 04 Apr 2010 18:34:27 -0700, walt wrote:
> My instinct is to use dd to duplicate the entire old disk to the new
> (unformatted) disk and then use gparted to twiddle it from there. (But
> I do love a puzzle ;o)
This works but has a some disadvantages. First, it is very slow. Then you
copy all filesystems as-is, including any fragmentation (which may be
significant if the old disk is nearly full). Also, rearranging the
partitions can be extremely time consuming, and not that straightforward
if you are moving partition start points.
A different sized disk generally deserves a different partition layout, so
starting from scratch and copying only the data is a better option.
You can also substantially reduce downtime by first rsyncing while the
system is running (using either -x or bind mounts). That will give a
slightly inconsistent root, so you then repeat the process from a live CD
(using --delete with rsync) to clean things up. The latter rsync takes a
fraction of the time as 99.*% of the data is already cpied.
--
Neil Bothwick
C&W music backward: get yer dog, wife, job, truck, kids, and sobriety
back.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Re: Moving the system from one disk to another
[not found] ` <201004051201.30038.michaelkintzios@gmail.com>
@ 2010-04-05 11:10 ` Neil Bothwick
0 siblings, 0 replies; 11+ messages in thread
From: Neil Bothwick @ 2010-04-05 11:10 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 959 bytes --]
On Mon, 5 Apr 2010 12:01:28 +0100, Mick wrote:
> > You can also substantially reduce downtime by first rsyncing while the
> > system is running (using either -x or bind mounts). That will give a
> > slightly inconsistent root, so you then repeat the process from a
> > live CD (using --delete with rsync) to clean things up. The latter
> > rsync takes a fraction of the time as 99.*% of the data is already
> > cpied.
>
> I don't know how slow rsync is the first time you run it. Since no one
> has yet suggested it star may be faster, while tar would do it nicely
> like so:
The speed is about the same. It's slow the first time because you have to
copy several gigabytes of data, whichever method you use. The advantage
of rsync is that you can do this while the system is still running then
do a quick update while booted from the live CD, massively reducing
downtime.
--
Neil Bothwick
Top Oxymorons Number 24: New classic
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Moving the system from one disk to another
2010-04-04 19:05 [gentoo-user] Moving the system from one disk to another meino.cramer
2010-04-04 19:09 ` covici
2010-04-04 19:35 ` [gentoo-user] " Kerin Millar
@ 2010-04-06 2:51 ` Dale
2 siblings, 0 replies; 11+ messages in thread
From: Dale @ 2010-04-06 2:51 UTC (permalink / raw
To: gentoo-user
meino.cramer@gmx.de wrote:
> Hi,
>
> I have to move my whole system from one disk to another
> bigger one.
>
> I think of doing as follows:
> Boot a system via CD/DVD (knoppix for example).
> Mount small disk read-only
> Mount bigger disk read-write
>
> cd into mountpoint of the first one
> cp -a . ../<mountpoint_of_bigger_disk>
>
> Seems to me slow but correct? Or?
>
> (I have to set the bootable flag of the correct partion
> additionally...)
>
> I dont want to have a booting system afterwards, which "runs" for --
> say -- three month and suddenly hit a obscure bug due to my
> copy-commands, which only did it to 99.87% correct... ;)
>
> I would like to preserve as much as possible of the file/directoy
> times ,,,
>
> Or does a mystical command with s-tar a better job faster?
>
> Thank you very much in adance for any help!
>
> Best regards,
> mcc
>
The way you plan to do this is almost exactly what I have done several
times in the past. I usually add the -v option so that I can tell about
where the copy process is. This is not a fast way according to some. I
have never compared this with using rsync, tar, star and all the rest.
The biggest thing, make sure whatever you boot will access your drives
with DMA and all the other goodies turned on and fully functioning.
When the copy process is done, install grub as well unless you plan to
still use the old drive and do some editing on the fly.
Dale
:-) :-)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-04-06 3:05 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-04 19:05 [gentoo-user] Moving the system from one disk to another meino.cramer
2010-04-04 19:09 ` covici
2010-04-04 19:35 ` [gentoo-user] " Kerin Millar
2010-04-04 20:04 ` Neil Bothwick
2010-04-04 23:51 ` Kacper Kopczyński
2010-04-05 0:16 ` Kerin Millar
2010-04-05 1:34 ` walt
2010-04-05 1:49 ` Kerin Millar
2010-04-05 7:03 ` Neil Bothwick
[not found] ` <201004051201.30038.michaelkintzios@gmail.com>
2010-04-05 11:10 ` Neil Bothwick
2010-04-06 2:51 ` [gentoo-user] " Dale
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox