Unable to restore *.tar file


 
Thread Tools Search this Thread
Operating Systems HP-UX Unable to restore *.tar file
# 1  
Old 04-06-2017
Unable to restore *.tar file

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 :

Code:
# tar -tvf lhs20170405.tar
rwx------ 146/20      0 Apr  5 00:01 2017 /home/lhs/lmon/
rwx------ 146/20      0 Apr 12 17:42 2013 /home/lhs/lmon/scripts/
rwx------ 146/20   4326 Sep  9 19:46 2010 /home/lhs/lmon/scripts/collect_db_mtv.sh
rwx------ 146/20   3684 Sep  9 19:46 2010 /home/lhs/lmon/scripts/collect_db_wal.sh
rwx------ 146/20  27590 Feb 10 18:45 2012 /home/lhs/lmon/scripts/collect_environment_data.sh
rwx------ 146/20  25139 Oct 26 23:21 2009 /home/lhs/lmon/scripts/collect_environment_data.sh.old
rwx------ 146/20   4081 Feb 16 19:52 2012 /home/lhs/lmon/scripts/collect_perf_data.sh
rwx------ 146/20    823 Feb 16 19:52 2012 /home/lhs/lmon/scripts/getosver.sh
rwx------ 146/20  27091 Feb 16 19:52 2012 /home/lhs/lmon/scripts/global_header
rwx------ 146/20    477 Dec  5 02:02 2008 /home/lhs/lmon/scripts/cron_driver.sh
rwx------ 146/20    859 Apr  2 18:31 2012 /home/lhs/lmon/scripts/longterm.sh
rwx------ 146/20    822 Oct 31 01:04 2012 /home/lhs/lmon/scripts/snapshot.sh
rw------- 146/20     49 Jan 13 01:09 2009 /home/lhs/lmon/scripts/crontab
rwx------ 146/20   1503 Feb 16 19:52 2012 /home/lhs/lmon/scripts/collect_scp.sh
rwx------ 146/20   4334 Sep  9 19:47 2010 /home/lhs/lmon/scripts/collect_db_mtv.old.sh
rwx------ 146/20   5662 Sep  9 19:47 2010 /home/lhs/lmon/scripts/collect_db_bes.sh
rwx------ 146/20  29668 Feb 10 18:45 2012 /home/lhs/lmon/scripts/collect_environment_data_new.sh
rw------- 146/20    121 Feb 16 19:52 2012 /home/lhs/lmon/scripts/crontab_15_min
rw------- 146/20    409 Mar 30 17:27 2012 /home/lhs/lmon/scripts/crontab_4_4_min
rwx------ 146/20    461 Feb 16 19:52 2012 /home/lhs/lmon/scripts/map_dsk.pl
rwx------ 146/20  24576 Feb 16 19:52 2012 /home/lhs/lmon/scripts/meminfo
rwx------ 146/20    795 Feb 16 19:52 2012 /home/lhs/lmon/scripts/reinit.sh
rwx------ 146/20    464 Feb 16 19:52 2012 /home/lhs/lmon/scripts/sadc.sh
rw------- 146/20    472 Mar 30 17:31 2012 /home/lhs/lmon/scripts/crontab_4_4_min_new
rw------- 146/20    300 Apr  3 20:23 2012 /home/lhs/lmon/scripts/adviser_disk.txt
rw------- 146/20    409 Mar 30 17:27 2012 /home/lhs/lmon/scripts/adviser_fs.txt
rw------- 146/20    804 Mar 30 17:27 2012 /home/lhs/lmon/scripts/adviser_global.txt
rw------- 146/20   1089 Mar 30 17:27 2012 /home/lhs/lmon/scripts/adviser_processes_all.txt
rw------- 146/20   3724 Mar 30 17:27 2012 /home/lhs/lmon/scripts/adviser_processes.txt
rwx------ 146/20    286 Mar 30 17:27 2012 /home/lhs/lmon/scripts/kill_glance.sh
rwx------ 146/20    697 Mar 30 17:27 2012 /home/lhs/lmon/scripts/reinit_arch_glance.sh
rwx------ 146/20    604 Mar 30 17:27 2012 /home/lhs/lmon/scripts/reinit_glance.sh
rwx------ 146/20   2531 Mar 30 17:27 2012 /home/lhs/lmon/scripts/run_glance.sh
rwx------ 146/20   3033 Mar 30 17:27 2012 /home/lhs/lmon/scripts/settings
rwx------ 146/20  72432 Apr  2 18:31 2012 /home/lhs/lmon/scripts/pss
rwx------ 146/20      0 Apr 12 17:42 2013 /home/lhs/lmon/output/
rw------- 146/20 4678316 Feb 10 18:45 2012 /home/lhs/lmon/output/L28db01_lhs.tar.gz
rwx------ 146/20      0 Apr 12 17:42 2013 /home/lhs/lmon/bin/
rwx------ 146/20 1196964 Mar 30 16:58 2012 /home/lhs/lmon/bin/awk
rwx------ 146/20 319488 Mar 30 16:58 2012 /home/lhs/lmon/bin/awk_32
rwx------ 146/20 1196964 Mar 30 16:58 2012 /home/lhs/lmon/bin/gawk
rwx------ 146/20 319488 Mar 30 16:59 2012 /home/lhs/lmon/bin/gawk_32
rwx------ 146/20 167936 Mar 30 16:59 2012 /home/lhs/lmon/bin/gmake
rwx------ 146/20 1155072 Mar 30 16:59 2012 /home/lhs/lmon/bin/gpg
rwx------ 146/20 181880 Mar 30 16:59 2012 /home/lhs/lmon/bin/gzip
rwx------ 146/20 376832 Mar 30 16:59 2012 /home/lhs/lmon/bin/screen
rwx------ 146/20 282624 Mar 30 16:59 2012 /home/lhs/lmon/bin/tar
rwx------ 146/20 118784 Mar 30 16:59 2012 /home/lhs/lmon/bin/unzip
rwx------ 146/20    475 Mar 30 16:59 2012 /home/lhs/lmon/bin/sed
rwx------ 146/20 196608 Mar 30 16:59 2012 /home/lhs/lmon/bin/sed_32
rwx------ 146/20 481628 Mar 30 16:59 2012 /home/lhs/lmon/bin/sed_64
rwx------ 146/20    209 Mar 30 16:59 2012 /home/lhs/lmon/bin/sed_script
rwx------ 146/20    413 Mar 30 16:59 2012 /home/lhs/lmon/bin/sed.sh
rwx------ 146/20      0 Apr  5 00:01 2017 /home/lhs/lmon/log/
rw-r--r-- 146/20 73216498 Apr  3 23:58 2017 /home/lhs/lmon/log/L28db01_170403.log
rw-r--r-- 146/20 66447508 Apr  5 21:12 2017 /home/lhs/lmon/log/L28db01_170405.log
rw-r--r-- 146/20  12753 Apr  4 00:00 2017 /home/lhs/lmon/log/L28db01_170404.sar
rw-r--r-- 146/20 67980522 Apr  4 23:58 2017 /home/lhs/lmon/log/L28db01_170404.log
rw-r--r-- 146/20  11933 Apr  5 00:00 2017 /home/lhs/lmon/log/L28db01_170405.sar
rw-r--r-- 146/20 68573040 Apr  5 21:12 2017 /home/lhs/lmon/sadc.dat
rwx------ 146/20      0 Apr 12 17:43 2013 /home/lhs/lmon/sarcheck/
rwx------ 146/20    592 Mar 12 21:37 2012 /home/lhs/lmon/sarcheck/deploy.sh
rwx------ 146/20    467 Mar 12 21:12 2012 /home/lhs/lmon/sarcheck/ps1.sh
rwx------ 146/20    382 Apr  2 16:26 2012 /home/lhs/lmon/sarcheck/ps2.sh
rwx------ 146/20  69632 Mar  9 00:15 2012 /home/lhs/lmon/sarcheck/schpagent
rwx------ 146/20    354 Mar 12 21:13 2012 /home/lhs/lmon/sarcheck/vg1.sh
rwx------ 146/20  61440 Mar  9 00:15 2012 /home/lhs/lmon/sarcheck/vgparse
rwx------ 146/20      0 Apr  5 00:00 2017 /home/lhs/lmon/sarcheck/ps/
rw-r--r-- 146/20 39612541 Apr  2 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170402
rw-r--r-- 146/20 6117137 Mar 27 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170327.gz
rw-r--r-- 146/20 5954950 Mar 28 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170328.gz
rw-r--r-- 146/20 5908942 Mar 26 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170326.gz
rw-r--r-- 146/20 32940032 Apr  3 20:40 2017 /home/lhs/lmon/sarcheck/ps/20170403
rw-r--r-- 146/20 30253056 Apr  4 19:20 2017 /home/lhs/lmon/sarcheck/ps/20170404
rw-r--r-- 146/20 30261054 Apr  5 21:10 2017 /home/lhs/lmon/sarcheck/ps/20170405
rw-r--r-- 146/20 6358554 Apr  1 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170401.gz
rw-r--r-- 146/20 5939881 Mar 25 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170325.gz
rw-r--r-- 146/20 6233255 Mar 29 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170329.gz
rw-r--r-- 146/20 6140091 Mar 30 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170330.gz
rw-r--r-- 146/20 6303808 Mar 31 23:50 2017 /home/lhs/lmon/sarcheck/ps/20170331.gz
rw------- 146/20    153 Mar 12 21:50 2012 /home/lhs/lmon/sarcheck/crontab.sarcheck
rw------- 146/20  38532 Mar 23 22:08 2012 /home/lhs/lmon/sarcheck/vgparse.out
rwx------   0/3      0 Apr  5 21:12 2017 /archive/
#

What is the problem here?
# 2  
Old 04-06-2017
Hi,

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.
# 3  
Old 04-06-2017
Just guessing - tar usually removes leading \ when archiving, unless told otherwise. Is it possible that your restore ends up just below the cwd?
# 4  
Old 04-06-2017
Code:
Just guessing - tar usually removes leading  \  when archiving, unless told otherwise. Is it possible that your restore ends up just below the cwd?


Did you mean leading
Code:
/

?

About the output from the tarring :
I just ran the command :

Code:
# cd <tar file directory>
# tar -xvf lhs20170405.tar /home/lhs

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%).
# 5  
Old 04-06-2017
Quote:
Originally Posted by RudiC
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 :
Code:
pax -r -s '|^/||' < tarfile

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..
# 6  
Old 04-06-2017
Hi,

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:

Code:
tar -xvf lhs20170405.tar home/lhs

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.

Anyway, try that, and see how you go.
# 7  
Old 04-06-2017
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.....
Code:
# tar tvf lhs20170405.tar

and if that lists okay then try
Code:
# tar xvf lhs20170405.tar

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.

Last edited by hicksd8; 04-06-2017 at 03:36 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Backup and restore using tar

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)
Discussion started by: Tommyk
8 Replies

2. HP-UX

Unable to create a tar file due to link

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)
Discussion started by: nag_sathi
1 Replies

3. UNIX for Dummies Questions & Answers

Unable to restore cpio archive to a directory

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)
Discussion started by: drdigital_m
2 Replies

4. HP-UX

Unable to access TAR file

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)
Discussion started by: rdhaprakasam
2 Replies

5. Solaris

how to restore an entire system from a tar file?

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)
Discussion started by: omd
1 Replies

6. UNIX for Dummies Questions & Answers

Restore files with TAR -- Help

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)
Discussion started by: severt
1 Replies

7. UNIX for Dummies Questions & Answers

tar - restore only file of specific dates

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)
Discussion started by: newbie168
0 Replies

8. UNIX for Dummies Questions & Answers

Question regarding tar restore

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)
Discussion started by: Relykk
2 Replies

9. Solaris

tar - restore a file

We use tar for backing up a server. I need to restore just one file from this backup. Anyone know the syntax? (2 Replies)
Discussion started by: frustrated1
2 Replies

10. UNIX for Dummies Questions & Answers

Cannot restore a TAR backup

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)
Discussion started by: Ross.Goodman
2 Replies
Login or Register to Ask a Question