problem with tar - Linux

This is a discussion on problem with tar - Linux ; I bought a new drive and I'm moving data from my old one to the new one using tar. The problem is that some files aren't having their permissions maintained. Most are but some aren't, specifically various files and directories ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: problem with tar

  1. problem with tar

    I bought a new drive and I'm moving data from my old one to the new
    one using tar. The problem is that some files aren't having their
    permissions maintained. Most are but some aren't, specifically
    various files and directories in user's home directories. They are
    simply showing up as owned by root:root. This isn't a big deal since
    I can reset permissions on files that I find but I won't have an
    accurate list of what files did not maintain their permissions.

    Another more major problem is that tar is ignoring the -l option. I
    have /pub mounted as another drive and of course /mnt is mounted to
    the new drive. tar is decending in to both. /pub isn't a big deal
    since I can unmount it but when it decends in to /mnt, that cause
    recursive copying to the new drive.

    The commands I've tried are:

    tar -cvplf - * | (cd /mnt && tar -xpf - )

    tar -clf - * | (cd /mnt && tar -xvpf - )

    tar --create --same-permissions --preserve-permissions
    --one-file-system --file - * | (cd /mnt && tar xvpf - )

    Is there an order to the options that I should be specifying? This
    has worked before in the past on other systems so I'm pretty sure I'm
    just missing something small. he version of tar I'm using is: tar
    (GNU tar) 1.13.93 from Debian (sarge).

    Any help would be greatly appreciated.

    Aaron

  2. Re: problem with tar

    Aaron Anderson wrote:
    >
    > Another more major problem is that tar is ignoring the -l option. I
    > have /pub mounted as another drive and of course /mnt is mounted to
    > the new drive. tar is decending in to both. /pub isn't a big deal
    > since I can unmount it but when it decends in to /mnt, that cause
    > recursive copying to the new drive.
    >
    > The commands I've tried are:
    >
    > tar -cvplf - * | (cd /mnt && tar -xpf - )
    >
    > tar -clf - * | (cd /mnt && tar -xvpf - )
    >
    > tar --create --same-permissions --preserve-permissions
    > --one-file-system --file - * | (cd /mnt && tar xvpf - )
    >
    > Is there an order to the options that I should be specifying? This
    > has worked before in the past on other systems so I'm pretty sure I'm
    > just missing something small. he version of tar I'm using is: tar
    > (GNU tar) 1.13.93 from Debian (sarge).


    Try:

    tar clf - . | (...)

    That works here (specifying . instead of *) using the same version of
    tar under Sarge.

    Sounds like a bug in tar to me (unless it's written somewhere that this
    is intentional behaviour).

  3. Re: problem with tar

    In article ,
    Aaron Anderson wrote:
    :I bought a new drive and I'm moving data from my old one to the new
    ne using tar. The problem is that some files aren't having their
    ermissions maintained. Most are but some aren't, specifically
    :various files and directories in user's home directories. They are
    :simply showing up as owned by root:root. This isn't a big deal since
    :I can reset permissions on files that I find but I won't have an
    :accurate list of what files did not maintain their permissions.
    :
    :Another more major problem is that tar is ignoring the -l option. I
    :have /pub mounted as another drive and of course /mnt is mounted to
    :the new drive. tar is decending in to both. /pub isn't a big deal
    :since I can unmount it but when it decends in to /mnt, that cause
    :recursive copying to the new drive.
    :
    :The commands I've tried are:
    :
    :tar -cvplf - * | (cd /mnt && tar -xpf - )
    :
    :tar -clf - * | (cd /mnt && tar -xvpf - )
    :
    :tar --create --same-permissions --preserve-permissions
    :--one-file-system --file - * | (cd /mnt && tar xvpf - )

    When you run "tar ... *" your shell expands the "*". Tar now sees
    "pub" and "mnt" explicitly included on the command line, and that
    overrides all types of exclusion. If you don't want tar to include
    /pub and /mnt, don't pass them in as arguments.

    When you restore to /mnt, is that by any chance a variety of FAT
    file system, and thus lacking any notion of file ownership?

    --
    Bob Nichols AT comcast.net I am "rnichols42"

  4. Re: problem with tar

    > When you run "tar ... *" your shell expands the "*". Tar now sees
    > "pub" and "mnt" explicitly included on the command line, and that
    > overrides all types of exclusion. If you don't want tar to include
    > /pub and /mnt, don't pass them in as arguments.
    >
    > When you restore to /mnt, is that by any chance a variety of FAT
    > file system, and thus lacking any notion of file ownership?


    Ah, that makes sense. That would also be why John-Paul Stewart's
    suggestion of using tar cf - . worked better.

    The permissions of certain files still weren't set and oddly enough
    it's the same files on each attempt. I tried reseting the permissions
    on the source files/directories and still the destination files were
    owned by root. Both drives are formatted ext3. I'm not concerned
    since this is my workstation and not a server with multiple users
    logging in or where permissions are important for security.

    thank you both for your help.

    Aaron


  5. Re: problem with tar

    cypher_key@hotmail.com wrote:
    >>When you run "tar ... *" your shell expands the "*". Tar now sees
    >>"pub" and "mnt" explicitly included on the command line, and that
    >>overrides all types of exclusion. If you don't want tar to include
    >>/pub and /mnt, don't pass them in as arguments.
    >>
    >>When you restore to /mnt, is that by any chance a variety of FAT
    >>file system, and thus lacking any notion of file ownership?

    >
    >
    > Ah, that makes sense. That would also be why John-Paul Stewart's
    > suggestion of using tar cf - . worked better.


    That would also mean the difference in behaviour is not a bug, but
    intentional.

+ Reply to Thread