Help with tar extraction!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with tar extraction!
# 1  
Old 03-16-2006
Data Help with tar extraction!

I have this tar file which has files of (.ksh, .ini &.sql) and their hard and soft links.

Later when the original files and their directories are deleted (or rather lost as in a system crash), I have this tar file as the only source to restore all of them.

In such a case when I do,

tar -xvf <tarfile name> should give me the original snapshot of files and directories relative to the current directory.

But what I get from extracting this tar is only the links of any files that existed in this directory. The rest of the directories and files within them are not restored.

Can someone please help me with where I'm going wrong?

TIA,
Sirisha
# 2  
Old 03-16-2006
I don't want to panic you but are you sure that the tar file contains the lost files Smilie ? You could list the archive and check for file paths/names/sizes using
tar -tvf <tarfile name> | more

If the files are there and are reasonable sizes then check that you have permission to write the extracted files and that you are writing them in the right place (you will see the file paths in the tar archive listing above).

If you've had a system crash have you run diagnostics on discs (fsck) - sometimes disc errors can stop you writing to specific areas.
Do you get any (error) messages when trying to restore?

good luck!
# 3  
Old 03-16-2006
Although the name tar refers to tape archive
I don't think that tar is the ideal tool for system backups.
Better chose a dump and restore command that is coming with your Unix'es
filesystems.
If you however wish to cling to filesystem independent commands
I would prefer find together with cpio over tar.
If you are using GNU tar you could give the derefernce switch -h a try
which instead of the symlink will include the referred to file in the dump.
But since you already have your filesystem corrupted you have to live with your tar archive
which only includes the symlinks, I am afraid.
# 4  
Old 03-17-2006
thestevew and buffoonix,

Thanks a ton for ur comments! The archive does contains all the files and their links even if the original files and directories are deleted. And yes, the "-h" option did work.. it not only inclues the physical files referred to in the archive but also all their symlinks and hard links too.

buffoonix, many thanks for ur advice on using unix native file system commands for archiving.. i'm on Solaris 5.6 and can u please tell me which are such commands?

Again,cpio is an option i have! More comments are welcome..

Thanks both of you!
# 5  
Old 03-17-2006
Solaris 5.6?
This should be the same as Solaris 6, shouldn't it?
Sorry, the SUN marketing folks always like to confuse people with their uninspired jumps in release versions (the same goes for Java I guess).
I am afraid, the oldest Solaris at my disposal is 8.
But anyway, up until OpenSolaris or Solaris 11 I think all Solaris releases sticked to the UFS filesystem.
Therefore there should be a "ufsdump" for creation of backup dumps,
and its counterpart "ufsrestore" for extraction and inspection.
Please, have a look at their manpages.
They even should contain some examples.
The advantage of these is that they are optimized for the UFS
and thus should also be capable of handling features special to that filesystem
(e.g. ACLs, largefiles, but I'm not sure, the manpage should tell).
They also allow you to devise incremental backups and thus safe storage.
Most of the dump restore counterparts also have an interactive mode
which is nice for moving around in a dump before deciding what to restore.
Usually every Unix filesystem should provide a dump and restore.
If for instance you had some VxFS (Veritas) filesystems mounted
then you could use vxdump and vxrestore.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Speed up extraction od tar.bz2 files using bash

The below bash will untar each tar.bz2 folder in the directory, then remove the tar.bz2. Each of the tar.bz2 folders ranges from 40-75GB and currently takes ~2 hours to extract. Is there a way to speed up the extraction process? I am using a xeon processor with 12 cores. Thank you :). ... (7 Replies)
Discussion started by: cmccabe
7 Replies

2. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

3. Shell Programming and Scripting

Extraction of .tar.gz creates additional unwanted directories

I'm working on a project that requires me to compress then relocate directories to a different location based on their last date of modification. After running the script I check to see if it worked, and upon unzipping the tar.gz using I created everything that should be there is. I then performed... (4 Replies)
Discussion started by: jrymer
4 Replies

4. Emergency UNIX and Linux Support

extraction of directory and below using gnu tar

i need to restore everything in a certain directory and lower. I have a tgz archive of all of the files, and i need to restore everything in /user/home/xxxx/ and below. this is a users home directory. this is a dumb question and i know when i see the answer i am going to say DUH, but i am... (2 Replies)
Discussion started by: frankkahle
2 Replies

5. UNIX for Advanced & Expert Users

tar and gzip extraction issues

Not sure if this is really in the right forum but here goes.... Looking for a way to extract individual compressed files from a compressed tarball WITHOUT tar -zxvf and then recompressing. Basically we need to be able to chunk out an individual compressed file while it still remains... (6 Replies)
Discussion started by: athos
6 Replies

6. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

7. AIX

Tar extraction error in aix 5.3

Hi root@appdr01 #ls -latr total 2887400 drwxr-xr-x 2 root system 256 May 06 11:34 lost+found drwxr-xr-x 34 root system 4096 May 06 11:34 .. drwxr-xr-x 3 root system 256 May 06 12:20 . -rw-r----- 1 root system 1478338560 May 06... (1 Reply)
Discussion started by: samsungsamsung
1 Replies

8. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

9. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

10. UNIX for Dummies Questions & Answers

Very slow Tar extraction from tape

I'm pulling a 1MB file from tape using tar. It's a 300GB DLT tape and it does have a lot of files on it because it's go the entire OS and Oracle RMAN files and 3000 table exports, but it's taking 2-3 hours to pull this file off of it. Is this type of performance what I should expect? The... (0 Replies)
Discussion started by: citrowske
0 Replies
Login or Register to Ask a Question