restoring FC1 to *new* partition from tar archive

Luciano Miguel Ferreira Rocha strange at nsk.no-ip.org
Mon May 10 22:47:56 UTC 2004


On Sun, May 09, 2004 at 11:54:47PM -0400, Joe(theWordy)Philbrook wrote:
> 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.

There's also:
`--numeric-owner'
     The `--numeric-owner' option allows (ANSI) archives to be written (1)
     without user/group name information or such information to be
     ignored when extracting.  It effectively disables the generation
     and/or use of user/group name information.  This option forces
     extraction (2) using the numeric ids from the archive, ignoring the
     names.

Two things:
1) If used when creating archives, the user/group information stored in
the archive for files will be only numeric
2) If used when extracting, it will use only the numeric information and
disregard the names.

It continues:
     This is useful in certain circumstances, when restoring a backup
     from an emergency floppy with different passwd/group files for
     example.  It is otherwise impossible to extract files with the
     right ownerships if the password file in use during the extraction
     does not match the one belonging to the filesystem(s) being
     extracted.  This occurs, for example, if you are restoring your
     files after a major crash and had booted from an emergency floppy
     with no password file or put your disk into another machine to do
     the restore.

Etc., please refer to the info file. (There's a more informational section
about the option later in the file.)

> 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???

If the option --numeric-owner is used:
- the file ownership is changed to uid 1001, that belongs to EvilTwin

Without the option (and with the information that 1001=goodDube in the
archive):
1) if a goodDube user also exists in the destination system, lets say with
uid=1010:
  - the file ownership is changed to goodDube's, 1010. That's what you
    usually want
2) if such user doesn't exist:
  - the file ownership is changed to uid 1001 (the only usable information),
    that belongs to EvilTwin

Why you don't want 1 in your case:
You're creating a full backup. When you restore it, you're going to use it
as is, with the *stored* passwd and group files. *Not* the ones being used
in the system while you extracted the files.

> -> `--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. 

Tar will always do that, when it can. Normal users, though, can't change
owners (in most systems), and really don't want to. Otherwise, the
extracted files would probably be useless to you, as they probably belong
to a different user in the system where the archive was created.

As you're extracting as superuser (so that you *can*, on linux, create
files for different users, and, on all systems, create special files), you
don't need to worry about this option.

<snip (I hope already answered by above)>
> 
> 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
> extraction?

Only once. If used when creating, it will have no effect when extracting,
as the information isn't stored.

But you probably want to use on extraction, as the added information to
tar could be usefull in other scenarios.

Regards,
Luciano Rocha
-- 
Consciousness: that annoying time between naps.





More information about the fedora-list mailing list