Help using pax to restore into current directory?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help using pax to restore into current directory?
# 1  
Old 06-27-2019
Help using pax to restore into current directory?

Hello,

I have a tape backup (it was made using dd/tar) and I want to use dd/pax to restore tape to disk, in IBM AIX 7.2.

I can restore from tape using example below without issues.

Code:
#/usr/bin/dd bs=128k if=/dev/rmt0 | /usr/bin/pax -r -v /home/c3rb3rus/utils/*

USTAR format archive
/home/c3rb3rus/utils/file1.txt
/home/c3rb3rus/utils/file1.txt
/home/c3rb3rus/utils/file1.txt

The problem is, I need to restore relative to some (or current) directory, so as long as it is not to original destination to prevent overwriting.

I tried messing with the -s (ReplacementString) parameter but I cannot seem to get it to work.

Anyone able to help me out?
# 2  
Old 06-27-2019
That is why you better make the backup without the leading /, for example (cd / && tar cf - .) instead of tar cf - /.
But IMHO you can tell pax to make some modifications. RTFM:
Code:
man pax

# 3  
Old 06-27-2019
Quote:
Originally Posted by MadeInGermany
That is why you better make the backup without the leading /, for example (cd / && tar cf - .) instead of tar cf - /.
But IMHO you can tell pax to make some modifications. RTFM:
Code:
man pax

RTFM? Really?

Did you even read the post? It clearly states I already tried using -s (ReplacementString) without success, how do you think I got to this parameter?

No, I cannot use cd/tar since I am doing this in a script and grabbing dozen or so different directives and sending them to tape.
# 4  
Old 06-27-2019
Agreed.

Please do not answer user questions RTFM.

Better not to reply if anyone wants to post a RTFM reply which is not permitted at unix.com.
# 5  
Old 06-27-2019
I found my answer here, using: -s '%^/%<relative_path>/%' works, for anyone else that may run into this.
This User Gave Thanks to c3rb3rus For This Post:
# 6  
Old 06-27-2019
Quote:
Originally Posted by c3rb3rus
I tried messing with the -s (ReplacementString) parameter but I cannot seem to get it to work.
OK.

What did you exactly try with the "-s" parameter, because it basically does what you want it to do? And what was (exactly!) the outcome of what you tried? As long as the only description of what went wrong is "didn't work" it is hard to understand and tell you what you should have done differently (apart from the general advice of reading the manual. I take it you did that but obviously you didn't completely understand what it said.).

I hope this helps.

bakunin
# 7  
Old 06-27-2019
Can you show example of that substitute failure ..

Here everything works as expected, but i'm not using tape device, but cat Smilie
Code:
cat archive.tar | pax -s"#/archive/originalpath/#/some/restore/#g"

Above command should print out what will the effect be.
If you are happy with result, add -r to the end to restore.

Regards
Peasant.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Restore directory and contents from tape

Hi, I have taken a backup of a directory on my tape in using below command cd /backup find * -print|backup -ivf '/dev/rmt0' '-U' |tee -a /syslogs/backup.log and output appear in below format. a 0 rman-before-08032014 a 58403323904... (2 Replies)
Discussion started by: m_raheelahmed
2 Replies

2. UNIX for Dummies Questions & Answers

How to get the current directory Path?

How to get the current directory Path in your prompt? i am getting a $ mark only in my prompt? Please help me with this (3 Replies)
Discussion started by: Abhishek0683
3 Replies

3. UNIX for Dummies Questions & Answers

How to email the current directory?

Hi, I'm very new to Unix, but have been given a command to type in which is : mail -s <email subject goes here> <my email address> <success.txt this command is quite a basic one and sends an email containing the contents of the file "success.txt" to whatever email I put in with the subject of... (2 Replies)
Discussion started by: rnmuk
2 Replies

4. AIX

Using restorevgfiles to restore entire directory from rootvg problems

I am trying to restore a specific directory and all sub-directories therein using a rootvg tape. I am using the following command to make the backup: mksysb -m -i -v /dev/rmt0 However, I am getting the following result: tctl status rmt0 Available 04-08-00-0,0 LVD SCSI 4mm Tape Drive... (10 Replies)
Discussion started by: herot
10 Replies

5. UNIX for Advanced & Expert Users

current directory in awk

Hello, I want to use the string with the current directory in my awk command. I tried: 'pwd=system("pwd")' but it doesn't work. can please help somebody? (2 Replies)
Discussion started by: daWonderer
2 Replies

6. Shell Programming and Scripting

tarball of current directory

I wanna make a backup tarball. I wanna write a script that makes tarball of the current directory. There are lots of files so I cant type all files, I wanna make the tarball by excluding few files. Like there 1000 files in a directory I wanna create a tarball containing 98 files of that... (1 Reply)
Discussion started by: nishrestha
1 Replies

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

8. AIX

Restore a directory from backup

Dear All: we are using backup command on AIX to take backup as below in this command we also add compress command ulimit unlimited cd /apps/oracle find orcldb orcldata arch |tee /apps/orabkp/ofgl.faysalbank.com-17Jun10Thu-ORCL-DB.bkp.gz.log | backup -ivqf - |gzip -c >... (0 Replies)
Discussion started by: lodhi1978
0 Replies

9. Shell Programming and Scripting

Finding files in current directory when 100,000's files in current directory

Hi All I was wondering what is the most efficient way to find files in the current directory(that may contain 100,000's files), that meets a certain specified file type and of a certain age. I have experimented with the find command in unix but it also searches all sub directories. I have... (2 Replies)
Discussion started by: kewong007
2 Replies

10. Shell Programming and Scripting

filename in current directory

I want to perform a task on all the files in the current directory but I'd like to loop through them one at a time. How do I tell it to give me the first filename? (2 Replies)
Discussion started by: calgone337
2 Replies
Login or Register to Ask a Question