tar - restore a file


 
Thread Tools Search this Thread
Operating Systems Solaris tar - restore a file
# 1  
Old 01-12-2004
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  
Old 01-12-2004
I need to extract a file and place in a different directory on the server as I do not wish to overwrite the current file..
# 3  
Old 01-12-2004
Check your man pages for your version of OS (since you did not post it)

You can try after checking how it was listed in the tar (see below)
# cd /tmp
# tar -xf /dev/rmt/0n ./mydir/myfile

You must see how your file was backed up - if it's ./mydir/myfile then you can put it in a new directory (all the mydir directories above it will be created under whichever directory you are in).
If it's listed as /mydir/myfile, then it's going to restore the file in the original directory - so you must do the restore on a different system to avoid overwriting the file. Use the tar -tvf /dev/rmt/0n to view what is on the tape (change /dev/rmt/0n to what ever your tape drive is)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

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 : # tar -tvf lhs20170405.tar... (7 Replies)
Discussion started by: anaigini45
7 Replies

2. UNIX for Dummies Questions & Answers

UNIX command to check if file name ends with .tar OR if the file is a tar file

Hello Team, Would you please help me with a UNIX command that would check if file is a tar file. if we dont have that , can you help me with UNIX command that would check if file ends with .tar Thanks in advance. (10 Replies)
Discussion started by: sanjaydubey2006
10 Replies

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

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