[LBo] Moving Home

Jason Armstrong jason at gmx.net
Mon Mar 12 00:35:30 CET 2007



> The problem I always have with tar, and it is a problem with *me* and
> not actually with tar, is that I tend to untar it wrong.  For example I
> make a new partition for /home.  I mount it as /home.  Then I untar my
> tarred /home directory into it and end up with /home inside the /home
> directory.
>
> Since I get this wrong almost always on the first try, perhaps someone
> else would give the details on how to do this.  I guess we can assume
> that we are booted on the newly installed distro and the user is already
> created and is at ~/ in his home directory. The tarball is on
> /media/usbdrive/home.tar.gz.  Assume that he has made /home into a
> separate partition on /dev/hda6 and it is mounted if that matters.  What
> exactly does he do now?

Hi Anita,

It sounds to me like you un-tarred the home archive *INSIDE* /home, when 
you should have been doing it from the parent directory, /.

When tar un-tars the archive, it *SHOULD* always be relative to your 
current location (newer versions of tar always do this, and you will see a 
message "Removing leading / from absolute pathnames in the archive", older 
versions of tar allowed the archive to write to / and potentially wipe out 
your whole system).

This means that you either need to be aware of what the directory 
structure in the archive is and untar from the corresponding point in your 
system, or untar to a temporary location and move the un-tarred tree to 
its final destination.

You can preview the tar contents to determine where to untar them:

tar -tf home.tar.gz | less

which in this case gives me an endless list of files beginning with the 
string:

home/jason/

so if I un-tar it from the parent directory of home, it will write to the 
correct directory tree.

Cheers,

Jason


More information about the QnA mailing list