I tarred a directory to a different location. I then deleted the original directory.
Now I need to restore the directory, and I am unable to do so (The contents do not get restored). However, when I type tar -tvf <tarfile), the list of contents are displayed :
What actually goes wrong when you try to extract the tarball ? You say the contents do not get restored - but what actually does happen ? Is there an error, or anything else out of the ordinary ? You'll have to provide a bit more info regarding what is actually going wrong here before anyone can assist further.
About the output from the tarring :
I just ran the command :
Then there was nothing.It just ended with a prompt without any message/error.
And when I checked the /home/lhs the folder was still not there.
Even performing a bdf /home still showed same usage as before the tarring was done. (6%).
Just guessing - tar usually removes leading \ when archiving, unless told otherwise. Is it possible that your restore ends up just below the cwd?
That is only the case for GNU tar AFAIK... Regular tar's will happily oblige and store the leading slash. That is why one usually creates a tar with a relative path from the / directory..
--
@OP:
Try using a chrooted environment...
Or try removing the leading slash by using POSIX compliant pax, which should also be available on your system :
First cd to the directory where you want the tree to be created, like you would do with tar ..
Last edited by Scrutinizer; 04-06-2017 at 01:53 PM..
I think I can sort of replicate this on Solaris, using the SunOS native tar rather than GNU tar (which handles this fine).
As counter-intuitive as it might seem, try syntax like this:
So actually leaving off the initial / basically. It will then extract it underneath wherever you are, and you can move it in to place.
Generally leading /'s in tar archives are not a good idea. GNU tar automatically strips them, as RudiC says; it seems SunOS tar (and I'd also guess HP-UX tar as well, by logical extension) doesn't, and will actually create an archive with them in it.
Different OS's implement tar slightly differently.
With the information provided I'm still guessing but......
Just see what happens if you list without entering the minus.....
and if that lists okay then try
again without the minus.
Anyway you should be able to tell if it is actually extracting because (a) it will be slower than just listing, and (2) the disk activity light(s) will be reallt flashing whilst it's writing the files down. If you do see a difference in the two operations then you need to go find where tar has extracted the files to.
---------- Post updated at 11:32 AM ---------- Previous update was at 11:19 AM ----------
And regarding your post#4, if you use the 'v' (verbose) option on the extraction command line, all files will be listed as they are extracted. Therefore, I would say, no output indicates no extraction occurring.
This will be covered elsewhere im sure but i just cant seem to find my exact issue.
I want to backup my systems using tar, command is:
tar -cjpf /backup /bin /etc /home /opt /root /sbin /usr /var /bootWhen i include the / directory it also tar's the /lib /sys /proc /dev filesystems too (and... (8 Replies)
Hi,
I am trying to tar a directory structure. but unable to do due to a symbolic link. Please help
indomt@behpux $ tar -cvf test.tar /home/indomt
a /home/indomt symbolic link to /dxdv/03/ap1dm1
Thanks (1 Reply)
Hello Every one,
I want to back up all passwd files to /xyz/passfiles.cpio
and Then restore them to /abc directory.
Here is what I wrote:
find / -name passwd | cpio -oc > /tmp/passwd.cpio
and to restore
cd abc
cpio -ium < /tmp/passwd.cpio
I can not find the files restored to /abc... (2 Replies)
hi friends,
I am using hp unix HP-UX B.11.11 .. Generally i do the compression to maintain the space availability . To compress the files first i used the TAR to collect all the files. it has done fine. when i am using command ls in the folder which has TAR file , it shows the TAR... (2 Replies)
Hi folks,
I have an image backup of an entire file system (Solaris 9 on N240) on a tar file.
How can I use this tar file to retore my system?
Thanks,
omd (1 Reply)
Hi,
Can anyone tell me the right TAR command to restore
all the files dirs/subdirs/files etc. to a given directory on my hdd from a TAPE drive?
I already used the list function to see that there is data on it with this commando:
# tar tf /dev/st0
Now I need to copy all the data to a... (1 Reply)
hi there,
anybody know if there is any efficient way of restoring only
files of specific dates from a tape (with tar command)? :rolleyes:
coz the tapes containing few weeks' files,
but i need only files of a few days.....
any kind feedback is appreciated.
Thanks in advanced. (0 Replies)
I created a relative backup of my home directory using tar into a file named backup.tar.
No problem there.
I checked it out using the table of contents command to list the contents of the backup.tar file, and there is no problem there either.
But, when I tried restoring backup.tar into a... (2 Replies)
I backed up a unix database using
"tar -cvf /dev/rmt1 -N 800 /*"
Normally I would restore this using
"tar -xvf /dev/rmt1 -N 800"
This is reporting an error about
"not enough memory"
I have done a new test backup and restore using the same commands and they work.
ANY IDEAS ? (2 Replies)