extract from tar backup


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users extract from tar backup
# 1  
Old 10-26-2001
extract from tar backup

Hi All,


I have created a tar file by giving the below command :

all files of directory : /Accounts/2001/10/26

$tar -cvf Act26.tar /Accounts/2001/10/26

I copied into another server and given the following command:

$tar -xvf Act26.tar

then permision denied message came due to the above directory not exits in that new server,

my doubt is how to extract the file into required directory without creating the above directory?

Now I am in on-line and waiting for reply...

Please mail me to : ::email removed::

Thanks
krishna
# 2  
Old 10-26-2001
When you make a tar archive and give absolute pathnames as you have done, tar will demand that the files be untarred into the same exact place. So you need to use relative pathnames instead.

cd /Accounts/2001/10
tar -cvf Act26.tar 26
will backup the 26 directory and everything under it.

cd /Accounts/2001/10/26
tar -cvf Act26.tar .
will exclude even the "26" directory and only get the contents in the tarball.

I can't be sure which of these two options you really want.

If you can't recreate the tarball, you may still have some options. I have never used gnutar, but I understand that it has an option for this. Also, maybe you can create /Account/2001 temporarily and then symlink /Accounts/2001/10 to the real directory. Finally, I once used "/usr/sbin/chroot tar xvf xx.tar" when I was in a simliar bind. But it was hard to set up the chroot'ed environment. I had to fiddle with it until it worke
# 3  
Old 11-07-2001
I already answered but my aswer was deleted. Therefore again:

If you already have tar file created with absolute pathnames, try to use GNU tar which has option for removing "leading /".
# 4  
Old 11-09-2001
create path

You can create the same path on the new box, /Accounts/2001/10/26. Untar the tarball, in this directory.

Then use "cp -r" to move recursively from there to where you really want it to go. Actually one way to do this is:

"cp -r sourcedir targetdir && rm -rf sourcedir"

Read "man cp" for more details.


Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

File Backup - TAR help

Hi, Another rookie here. I have a script I am developing to backup files from various directories onto a windows machine. Script description: - mv files from various directories - tar all files in that directory - export to windows server for safe keeping, external backups. The... (5 Replies)
Discussion started by: mcclunyboy
5 Replies

3. UNIX for Dummies Questions & Answers

Tar differential backup

I am backing up some data to an NTFS formatted backup drive. I have to preserve the Unix permissions of the data being backed up and therfore use backup into a tar file. I would like to backup the differnential data in the tar file similiar to how Rsync works so as to save on backup time as it... (1 Reply)
Discussion started by: jelloir
1 Replies

4. Linux

extract glibc-2.3.2.tar.tar

Hi, how can I extract glibc-2.3.2.tar.tar file ? I used tar -xf but does not work. Thank you. (4 Replies)
Discussion started by: big123456
4 Replies

5. UNIX for Dummies Questions & Answers

Backup with tar

Hi friends, I am planning to backup my Solaris Servers to SAN storage using tar. Also palnning to automate the job using Crontab. Can anyone advise how to make the date change automatically everyday for backup. Pls correct me if I am wrong. Thanks (7 Replies)
Discussion started by: solaris5.10
7 Replies

6. Shell Programming and Scripting

extract one file form .tar.gz without uncompressing .tar.gz file

hi all, kindly help me how to extract one file form .tar.gz without uncompressing .tar.gz file. thanks in advance bali (2 Replies)
Discussion started by: balireddy_77
2 Replies

7. UNIX for Dummies Questions & Answers

Tar backup

I am trying to do a full system backup using tar. It then after maybe 12 or so hours comes up with tar: write error: unexpected EOF. I have thoroughly cleaned the drive and tried to use a different drive but it still gives me this error. Can someone help. I am on solaris 8. (1 Reply)
Discussion started by: TMashie
1 Replies

8. UNIX for Dummies Questions & Answers

Backup help/advice using TAR

Every day we back up all files on our system that are older than 7 days, so effectively we do a day's worth at a time. The way we do this is to issue a find command using mtime +7 - we then loop round and for each result we issue a MV to move the file to a newly created directory. We then TAR the... (20 Replies)
Discussion started by: tonysab
20 Replies

9. UNIX for Dummies Questions & Answers

tar backup problems

Im trying to use tar to backup the os directories. I have a file called bdirs which contains a list of the directories that im trying to backup: /bin /dev /devices /etc /export /home /kernel /lib /local /mnt /opt /platform /proc /sbin start /usr /var /vol (3 Replies)
Discussion started by: blakmk
3 Replies

10. UNIX for Advanced & Expert Users

tar backup

Hi all, I would like to append list of files to already taken tar backup file. can anybody help? last month backup : cd /accounts/11 tar -cvf monthback.tar * Now I want to add /accounts/12 to monthback.tar is it possible? Krishna (1 Reply)
Discussion started by: krishna
1 Replies
Login or Register to Ask a Question