LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-22-2020, 12:30 AM   #1
kaza
Member
 
Registered: Apr 2010
Distribution: FC17
Posts: 343

Rep: Reputation: 2
tar -dvf file.tar : what causes it to fail?


Hello!

I'm attempting to compare contents of files backed up with tar
with what's currently on the disk (mounted nfs volumes) but the tar fails
and I don't quite understand why.
The backup had been performed relative to the "/" directory.

The command (run as root) and beginning/end of its output:

Code:
tar -dvf backup_2020_09_29_0602.tar -C '/'  >diff_backup_2020_09_29_0602
tar: nas/SRC/: Cannot savedir: Not a directory
tar: nas/SRC: Directory is new
tar: Skipping to next header
tar: nas/SRC/RPM/eclipse/: Cannot savedir: Not a directory
tar: nas/SRC/RPM/eclipse: Directory has been renamed from `nas/SRC'
tar: nas/SRC/RPM/svn/Subversion-1.6.2-1/: Cannot savedir: Not a directory
tar: nas/SRC/RPM/svn/Subversion-1.6.2-1: Directory has been renamed from `nas/SRC'
tar: Skipping to next header
.
.
.
tar: nas/SRC/eclipse/dvkit-1.1.0/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/.data/o: Warning: Cannot stat: No such file or directory
tar: nas/SRC/eclipse/dvkit-1.1.0/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/.data/o: Cannot savedir: Not a directory
tar: nas/SRC/eclipse/dvkit-1.1.0/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/.data/o: Directory has been renamed from `nas/SRC'
tar: nas/SRC/eclipse/dvkit-1.1.0/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/.data/o: Warning: Cannot stat: No such file or directory
tar: Skipping to next header
tar: nas/SRC/eclipse/dvkit-1.1.0/p2/org.eclipse.equinox.p2.repository/cache/: Cannot savedir: Not a directory
tar: nas/SRC/eclipse/dvkit-1.1.0/p2/org.eclipse.equinox.p2.repository/cache: Directory has been renamed from `nas/SRC'
tar: Exiting with failure status due to previous errors


\ls -l / | grep nas
drwxr-xr-x    6 root root     0 Oct  4 06:07 nas

 \ls -l /nas  | grep SRC
drwxrwxr-x 15 root users 4096 Jan 26  2020 SRC
The paths (short ones, at least) exist, I can see then with "ls".
There is one long path:

nas/SRC/eclipse/dvkit-1.1.0/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/.data/o

which seems to be cut after the 99-th character. After reading about
the 99 characters default path limit I attempted to add the

--format=posix

switch but it didn't help.
But why the short paths can't be seen by "tar" I don't understand.
As I understand, if I use the "-C '/'" switch then the "tar" should treat
the path stored in the tar file as being relative to the "/".

What am I doing wrong?
TIA,
kaza.
 
Old 10-23-2020, 04:04 AM   #2
Leonard_Linux
Member
 
Registered: Aug 2020
Location: Germany
Distribution: Slackware
Posts: 46

Rep: Reputation: 2
Hello,

does your command work with other files? Which OS or distribution are you using?

Best regards,
Leonard_Linux
 
Old 10-23-2020, 07:51 AM   #3
kaza
Member
 
Registered: Apr 2010
Distribution: FC17
Posts: 343

Original Poster
Rep: Reputation: 2
Hi,

It's REDHAT.

Linux <node> 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux


TIA,
kaza.
 
Old 10-23-2020, 08:11 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
My assumption is the errors related to "Cannot stat" are because you needed to be root when doing this?

Have you made an archive where it's not system directories, just some user subdirs and validated that the diff feature works right away once you've created the tar, and that also if you add or modify a file in that sub tree that it will detect it?

From what I can see if does see differences, but the two possible complications are that you have a NAS which may be a network mount, there may be files in use, if you weren't root when you did this, .... things like that.

I mean, perhaps you didn't do much incorrectly, just the results are difficult to interpret. And perhaps there's literal output like the "not a directory" which is confusing, but isn't a problem.
 
Old 10-23-2020, 08:29 AM   #5
Leonard_Linux
Member
 
Registered: Aug 2020
Location: Germany
Distribution: Slackware
Posts: 46

Rep: Reputation: 2
Quote:
My assumption is the errors related to "Cannot stat" are because you needed to be root when doing this?
Well, I don't think this is the problem. At least he said in his post that he ran it as root.
Quote:
The command (run as root)
Best regards,
Leonard_Linux
 
Old 10-24-2020, 03:47 AM   #6
kaza
Member
 
Registered: Apr 2010
Distribution: FC17
Posts: 343

Original Poster
Rep: Reputation: 2
Hi, thanks for the replies.

The command had been run as root.
So I don't quite understand, what possible can prevent "tar" from accessing everything.
And, from the same shell I've run the "tar" command, when I run "ls" on some path
it complained that it can't stat it or it's not a directory, the "ls" sees it OK.
I manually prepend "/" before the path given to "ls" command.
I somehow suspect that maybe the switch "-C '/' given to "tar" didn't work as I intended?
I also run the tar after "cd /" (without the "-C '/' switch and with absolute path to tar file, of corse)
and it failed in the same way.

I already run a "tar -dvf ..." on a smaller tar (incremental backup),
it included one file from /nas/SRC and the rest from /nas/users...
(all with my or other users ownership, non of "root")
and this command run successfully.

Some of the dirs included in the large backup (which failed "tar -dvf") have ownership/group of "root"
while others have ownership of "root" and group of "users". And they have read/execute permissions
for all.

That's the info I could think of now, if more is needed - just ask.

TIA,
kaza.
for
 
Old 10-24-2020, 11:10 AM   #7
Leonard_Linux
Member
 
Registered: Aug 2020
Location: Germany
Distribution: Slackware
Posts: 46

Rep: Reputation: 2
Hello kaza,

is it possible to extract the huge backup?
Does the tar command work in CLI? With CLI I don't mean a terminal, but one of the consoles you switch to with ctrl + alt +f#
Does ls fail with every path you pass it?

Best regards,
Leonard_Linux
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
[SOLVED] if [[ -n "$1" ]]; then FAIL FAIL FAIL rbees Programming 7 03-25-2015 02:39 PM
[SOLVED] Software to play .DVF audio files? Cyberman Linux - Software 1 06-10-2014 02:59 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
How do I un tar a .tar, .tar.z, .tar.gz file vofkid Linux - Newbie 4 03-15-2002 02:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration