[mdlug] Transfering /home with scp

Robert Meier list1c30fe42 at bellsouth.net
Mon Mar 3 23:36:22 EST 2008


Peter,

> I'm finally at the point of transferring all my files to my new notebook.

I suggest using rsync(1).

I periodically burn a backup of my /home to cd, as routine.

> ... Can I simply use scp to copy the entire /home?

You can subject to some limits:
    1. Normal users, each have there own directory under /home.
       Consequently, if you have more than one user,
       each directory in home will have its own user and group.
       IIRC, scp will throw out this information.
       IIRC, tar will record owner information only for files it can read.
       IIRC, tar will write owner information only if run as root.
       IIRC, rsync preserves owner information in "archive" mode if able.
    2. Hard links are limited to a filesystem, and cannot be copied without
       tools not commonly supported.
       Consequently, if you have anything dependent on hard links,
       you'll have to relink those by hand.
       rsync -H will preserve hard-links where possible,
       but may take a loooong time.
       (If you don't know of anything dependent on hard links,
        then you probably don't have anything dependent on hard links.)
    3. unix knows users and groups by uid, and gid (integers) mapped
       for human use to names.
       Consequently, unless your /etc/passwd and /etc/group files map
       the same names to the same uids and gids, expect the
       human-readable names to change.

> Or are there files in /home that would be
> specific to the hardware/operating system it's on?

IMHO, there shouldn't be, but some packages have unnecessary dependencies.

> Would tar be a better, quicker option?

If you handle the uid/gid maps manually,
the tar suggestion would seem the simplest.
> # cd /home
> # tar cpf - * | ssh -l root target_host '(cd /home; tar xpf - )'

The encryption overhead of ssh, is probably less than 50% and
IMHO well worth the time saved avoiding potential network issues.

If you use sneaker net (bundle into tar file, burn to cd,
unpack from cd), you need enough space on the original disk to
hold an entire copy in the tar file.

If you burn a copy to cdrom, you have a backup in case something
happens to either your old or new hard disk.

> ... On the other hand it appears that when unpacking an archive
>  it overwrites existing files of the same name in the directory
> it's unpacked.

See -k option of tar(1).  See the -u flag of rsync(1).

Hopefully helpful,
-- 
Bob

  "There was no "before" the beginning of our universe,
   because once upon a time there was no time."
     -- John D. Barrow



More information about the mdlug mailing list