problem with tar

This is a discussion on problem with tar within the Linux General forums, part of the Linux Forums category; I bought a new drive and I'm moving data from my old one to the new one using tar. ...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-06-2005
Aaron Anderson
 
Posts: n/a
Default 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
Reply With Quote
  #2 (permalink)  
Old 03-06-2005
John-Paul Stewart
 
Posts: n/a
Default 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).
Reply With Quote
  #3 (permalink)  
Old 03-07-2005
Robert Nichols
 
Posts: n/a
Default Re: problem with tar

In article <f6ff3192.0503061413.4c141c21@posting.google.com >,
Aaron Anderson <cypher_key@hotmail.com> wrote:
: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 - )

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"
Reply With Quote
  #4 (permalink)  
Old 03-07-2005
cypher_key@hotmail.com
 
Posts: n/a
Default 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

Reply With Quote
  #5 (permalink)  
Old 03-07-2005
John-Paul Stewart
 
Posts: n/a
Default 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 With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:43 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0