Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

restore problem.

Status
Not open for further replies.

cpu533

IS-IT--Management
Nov 6, 2003
68
CA
Hi Gurus,

I have a problem when i try to restore a single file or directory from backup which using backup command. The backup is based on file systems. We total have 10 fs backup on single tape. The command is " backup -$backup_level -uf $backup_tape.1 $fs_name 2>&1 | tee -a $logfile" But when i try to use restore command to retrive single file, it only can restore the structure of the directory, would not able to restore single file. Why?
The command I am using is " restore -xvq -f /dev/rmt1.1 -s10 ./dir"

The below is stated in IBM's redbook.
"Once data has been properly backed up, there are several different methods of restoring the data based upon the type of backup command you used. You need to know how your backup or archive was created to restore it properly. Each backup procedure gives information about restoring data. For example, if you use the backup command, you can specify a backup either by file system or by name. That backup must be restored the way it was done, by file system or by name."

So that means if we do backup by file system, we have to restore it by file system. There is no way to extract a single file??? According to restore manual, it is possible. How comes?


Please advice.

Thanks,
 
Try to list the backup first

tctl -f /dev/rmt1.1 rewind
restore -tqf /dev/rmt1.1 -s10

Look at the list of file and how they are backed up. You will find ./names/of/dirs/and/files relative to the mountpoint of your filesystem. (pathname of mountpoint is replaced by "." in each backed-up dir or file)

then

tctl -f /dev/rmt1.1 rewind
restore -xqf -f /dev/rmt1.1 -s10 ./dir/file

Make sure you have the correct number for -s

You can also try restore -i on filesystem backups, where you get a list of files/dirs on the filesytem backup and can choose which files/dirs to restore. See the man page for this.

Note that restored files are relative to your current dir on restore, do not expect the files/dirs to magically find their original place. Or cd to the mountpoint of the filesystem first. I usually make a "restore" dir in the filesystem and restore files/dir structure from there. Then after restoring you can always put the files/dirs where they belong after verifying the contents of the restored files.

HTH,

p5wizard
 
thanks for reply. that is what I have tried before. All failed. Even I try " restore -i", i can list the files, add to extraction list, but could not extract any single file. That is why it confuse me. But i am able to use command "restore -r" to extract all file system. Any more suggestion?


Thanks,
 
cpu533 said:
restore -xvq -f /dev/rmt1.1 -s10 ./dir

Are you trying to restore a file named "dir", or a file that is in the directory "dir"?

If you only specify a directory, you need the "-d" switch if you want the files below the directory restored. Otherwise it will do what you described, restoring only the directory, not its contents.

To restore a single file, put its full pathname on the command, not just the directory it's in (eg. ./dir/filename).

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

 
I guess restore is having a problem with rewinding to the exact tape position after it first reads the backup to find out where the file data is located.

Not a lot you can do about that, other than restoring the entire filesystem in another directory and then picking out the files/dirs you need.

Or backup up by filename instead of by filesystem - but then you have no incremental backups.

You could - if you have disk space - dd the filesystem backup image from tape to disk, and then restore files/dirs from that temp image (if you are doing incremental backups, that would not use up too much temp diskspace I guess):


tctl -f /dev/rmt1.1 rewind
tctl -f /dev/rmt1.1 fsf 9 # not sure - maybe fsf 10?
dd if=/dev/rmt1.1 of=/tmp/image10.bff bs=1024 # perhaps 512 ?
tctl -f /dev/rmt1.1 rewind
restore -x -v -q -f/tmp/image10.bff ./dir/or/file
rm /tmp/image10.bff


Note: the bff is for backup-format-file - but any name will do

HTH,

p5wizard
 
Disregard my "-d" flag paragraph, it's only available with back-by-name restores.

cpu533 said:
Even I try " restore -i", i can list the files, add to extraction list, but could not extract any single file

After adding the file to the extraction list, did ls show an asterisk by the filename?

Did it give an error message when you gave the extract command?

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

 
Rob, the "-d" only apply to when you backup by file name. We do backup by file system.
I guess p5wizard is correct. Seems it is the rewinding problem. So in such case, you have to restore whole file system, then pick up the files which you are looking for.
So the there is some wrong information in restore manual.
 
After adding the file to the extraction list, did ls show an asterisk by the filename?"

Yes, Rob, I do see the asterisk. I post the message here.

restore > ls
./archiveBetaLog/beta:
10241 ./ 1468416 LOGS.1/ 10248 ULOG.081705.Z
10240 ../ 8192 LOGS.2/ 10243 ULOG.081805.Z
937984 LOGS.0/ 10245 ULOG.081605.Z

restore > add ULOG.081605.Z
Making node ./archiveBetaLog.
Making node ./archiveBetaLog/beta.
restore > add ULOG.081705.Z
restore > add ULOG.081805.Z
restore > ls
./archiveBetaLog/beta:
10241 *./ 1468416 LOGS.1/
10248 *ULOG.081705.Z 10240 *../
8192 LOGS.2/ 10243 *ULOG.081805.Z
937984 LOGS.0/ 10245 *ULOG.081605.Z

restore > extract
Extracting requested files.
You have not read any media yet.
Unless you know which volume your file or files are on, you should start
with the last volume and work towards the first volume.
Specify the next volume number:


Thanks all for help.
 
Did you enter "1" at the volume number prompt?

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

 
Rod,

Are you saying to enter "1" here:
" Specify the next volume number: "
What does this mean? I was thinking it ask to read another volume other than current one. But anyway, it works. Could you explain what happen here?

Thanks,
 
The filesystem backup writes out the table of contents before it backs anything up, which means it can't know how many volumes there are or which files are on which volumes. Therefore, it wants to know what volume you've inserted so it can keep track of where it is.

In your case you only have one volume, so "1" is the only valid answer.



Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

 
Thanks Rod. So that means when restore, it will restore table of contents first, then it will look for exact data. So it will ask for the volume number. But the promt cause some confusion "Specify the next volume number: ". ^_^

Thanks all for reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top