l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 17:08

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] HD xfer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] HD xfer

On Sat, Aug 11, 2001 at 02:53:25AM -0700, Foo Lim wrote:
> # [cdrom's root] cp -ax /mnt/old-disk-part1 /mnt/new-disk-part1
> 2. Would the -x option also copy the stuff in /proc?

cp -ax /oldroot /newroot would copy /oldroot ONLY, ie no other
filesystems, not /proc/, not /home (if home were it's on fs), etc.
cp -ax /oldroot/* /newroot would copy /, /proc, /home, etc.  (obvious, I

> 3. What was the bug in the tar method?  Also, what was the tar method?

The tar method usually fails to properly set ownership on symlinks.

tar -clvpf - /oldroot | ( cd /newroot; tar -xvpf - )

-l = one file system
-p = preserve permissions & ownership (except for symlinks).

> 4. Any other caveats I should know about before I begin?

Nothing too major, just go slow and make sure you mind your directory
structures...  ( dirname/, dirname/*, etc).

If you "copy half way" anything, you might want to look at rsync to 'fix
up' stuff.  cp -u isn't a good idea because it only looks at file
times, not sizes or contents.  rsync is much slower than a raw copy
(relatively speaking) when doing local copies.

rsync -avxrP --delete /oldroot /newroot   (try without --delete if you're
unsure you've got your directory structures right).

-a archive (perms, ownership, modtimes)
-v verbose
-x one file system
-r recursive
-P progress status (percent complete counts)
--delete   remove entries from target that don't exist in source

After a file system copy, your 'du' counts will be off, as will 'df'
(especially if you've changed block sizes).  A 'find /oldroot -xdev | wc
-l' compared against a 'find /newroot -xdev | wc -l' is a good way to be
sure you got things "mostly right" without doing exhaustive checks.  

Good luck!

Ted Deppner

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!