tar c /home/mike
What will these files be named when you restore them, either on your
own system or on some other system? They will have exactly the
same pathnames that they had originally. So if /home/mike
already exists, it will be destroyed. There's no way to
tell tar that it should be careful about overwriting files;
there's no way to tell tar to put the files in some other
directory when it takes them off the tape, etc. If you use
tar c .), you can
restore the files in any directory you want.
[GNU tar (on the CD-ROM) converts absolute pathnames to
relative, by default.
Most other tars don't do that, though, so I don't advise relying
on the feature. -JP]
This means that you should:
Avoid using absolute paths when you create an archive (see below).
Use tar t to see what files are on the tape before restoring the archive.
Use GNU tar (on the CD-ROM).
It can ignore the leading
/ as it extracts files.
Rather than giving a command like
tar c /home/mike, do something like:
tar c .
tar c -C /home/mike .
This command tells tar to cd to the directory /home/mike before creating the archive. If you want to archive several directories, you can use several -C options:
tar c -C /home/mike ./docs -C /home/susan ./test
This command archives mike's docs directory and susan's test directory.