[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: restoring FC1 to *new* partition from tar archive

Joe(theWordy)Philbrook wrote:

It would appear that on May 9, Luciano Miguel Ferreira Rocha did say:

On Sun, May 09, 2004 at 08:21:43AM -0500, Jeff Vian wrote:

I think you are confusing /restore/ with /use/. It can be /restored/ using any system. The ownership is numeric and does not change on a differnent system.

No, I'm not confusing it, and no, the ownership isn't numeric. At least,
in my experience. I've created backups of redhat and fedora installs, in
single user mode, and restore them under live cds (knoppix or self-made).
If I didn't use the option I described, some files would end with
different numeric ids than they should. In particular, the knoppix cd has
different values for cups and other system accounts, and when restoring
the files would use those values.

When booting the restored system, those files would have invalid

The user ids are a problem if /used/ on a system where the group and passwd files define different userids for the owners.

Not as such. As tar uncompresses using user and group names (in _my_
experience), the extracted files will be usable by the users on that

Of course, if you consider the "use" of such backup as above, then it
still is a problem.

Luciano Rocha

Now I'm getting a little confused... I found two relevant items under info tar.

=> `--numeric-owner'
=>      This option will notify `tar' that it should use numeric user and
=>      group IDs when creating a `tar' file, rather than names.

Which option isn't even mentioned in man tar. Now here is the part I
don't understand. If it's supposed to be more reliable when extracting
to a different system, How would it deal with file belonging to
user=goodDube has UID=1001 on the source file system when on the
destination file system UID=1001 is held by user=EvilTwin???

-> `--same-owner'
->      When extracting an archive, `tar' will attempt to preserve the
->      owner specified in the `tar' archive with this option present.
->      This is the default behavior for the superuser; this option has an
->      effect only for ordinary users.

Which option is listed (sparsely) in man tar, and sounds like it will
try to keep the same owner, based on the user name of owner.

What happens  when the filesystem that is creating/extracting the
tar file has different UID numbers for some users than the
source/destination file system. Does it actually think to look up the
users in the destination system's passwd file (that would be a neat
trick) or does it fall back on it's own passwd file?

I'm guessing that when --numeric-owner is used then in the first scenario EvilTwin would become the new file owner. And that in the second scenario the UID from the source file would be used even when tar thinks it may belong to an unknown user on the destination system.

I'm also guessing that when --numeric-owner is NOT used, then in the
first scenario tar would look up the username "goodDube" in the passwd
file and use that users UID. But that in the second scenario, it would
wind up assigning the user id from it's own filesystems passwd file
which may not match the user id of the destination filesystem's passwd

Sheesh, this is confusing. It's sounding more and more like the fact
that mdk didn't appear to mess up my FC1 is probably a fluke.

If I wanted to use the --numeric-owner option, do I need to use it
during both the "tar -c" AND the "tar -x" process, or only during the

I am going to let someone else address the questions about the options in info and man. My answer is based on experience and practical usage.

In my many years of experience I have never used the numeric option, and seldom used the -p option

I routinely use tar -cvf (or czvf) to create the file and tar -xvf (or xzvf) to extract it.

AFAICT the numeric UID/GID is stored in the file from the source system, and the numeric UID/GID is extracted with the file on the destination system. On systems where the username/UID pair from the source does not match the username/UID pair from the destination, the file on the destination is owned automatically by the user with the UID of the original file.

I can and have tested this repeatedly and have found nothing unusual as long as I remember that the ownership for extracted files will go to the user with the matching UID and not necessarily to the matching username. If there is no username that has a matching UID then the ownership displays as the numeric UID (see my earlier post on this for an example)

There are many options for tar that I seldom use and thus am not familiar with. But in my experience, your results are common. YMMV

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]