copying a home directory onto a removable drive and back

Smoot Carl-Mitchell smoot at
Wed Jul 28 19:36:44 UTC 2010

On Wed, 2010-07-28 at 15:49 +0100, Adam Funk wrote:
> On 2010-07-28, Adam Funk wrote:
> > I want to copy my home directory onto a USB drive (formatted to ext3),
> > shuffle the partitions around on the computer, and copy my home
> > directory back (onto a new, blank partition).  I can think of four
> > ways to do it, although I'm not familiar with using the fourth:
> >
> > cp -r
> > rsync
> > tar
> > cpio
> >
> > Recommendations?
> I forgot to mention that one of my concerns is getting the file
> permissions and ownerships and any hard links right when I copy
> everything back.  (I doubt that I have any hard links, but you never
> know.)

rsync works well for this.  Use it like:

rsync -av -H  --delete <source> <target>

You need the -H switch to preserve hardlinks.  Be aware this can be
rather slow on a large directory tree.  --delete will delete anything on
the target not found on the source.  You may or may not want this
options, depending on what you are trying to accomplish.

The nice thing about rsync is it only copies changes, so it can be very
fast after the initial copy.

Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at
+1 480 922 7313
cell: +1 602 421 9005

More information about the ubuntu-users mailing list