LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (https://www.linuxquestions.org/questions/aix-43/)
-   -   [Backup Restore] Remove "/" or define destination path (https://www.linuxquestions.org/questions/aix-43/%5Bbackup-restore%5D-remove-or-define-destination-path-4175464773/)

Fracker 06-05-2013 01:59 AM

[Backup Restore] Remove "/" or define destination path
 
Hi guyz,

I am taking file system backup on Tape by

find /Backup -print | sudo /usr/sbin/backup -i -v -f /dev/rmt0;

now issue is, my backup on the tape is going with "/Backup/a/b/c.file" etc, while restoring I am getting issue That I need to mount /Backup directory with different partition.

Is it possible to define the path file restoring? or remove "/" like we can do in "tar" command?

druuna 06-05-2013 03:07 AM

Can you explain a bit more what you run into?

It has been a while since I used AIX, but if I recall correctly the backup command uses relative path by default.
Too refresh my knowledge I did a little search and came up with this link that might help:

- Relative and absolute backups with backup and restore

cliffordw 06-07-2013 01:07 AM

Hi there,

Two suggestions, depending on the specific requirements & environment:

1. If it is possible to temoporarily remount filesystems, the easiest solution would be to mount the target filesystem as /Backup.

2. You could chroot into the destination directory to restore to there (assuming the target directory is empty). To do this, you need to just copy the restore command & related files into the directory first, though. I simulated this with the following steps (backed up /tmp, and restored to /test2/; using a file /test1/rmt0 for the backup as I don't have a tape drive):
Quote:

## Set some locations
srcdir=/tmp
targdir=/test2
backupfile=/test1/rmt0
# $backupfile could be /dev/rmt0 in your case
## Do the backup
find $srcdir -print | backup -iqvf $backupfile
## Copy necessary files to target dir
mkdir $targdir/usr
mkdir $targdir/usr/sbin
mkdir $targdir/usr/lib
cp -p /usr/sbin/restore $targdir/usr/sbin
cp -p /usr/sbin/restbyname $targdir/usr/sbin
cp -p /usr/lib/* mkdir $targdir/usr/lib
# Ignore the errors like "cp: 0653-436 /usr/lib/xorg is a directory. Specify -r or -R to copy." on the last step; we don't need the subdirectories
## Restore the files to $targdir
chroot $targdir /usr/sbin/restore -dqf - < $backupfile
# Clean up temporary files
rm -r $targdir/usr
# Move files into correct place
mv $targdir/$srcdir/* rmdir $targdir/$srcdir/.??* $targdir/
rmdir $targdir/$srcdir
I hope this helps!

cliffordw 06-07-2013 01:10 AM

Forgot to mention: for future backups you can avoid this problem by using relative paths in your backup, as follows:

Quote:

cd / && find ./Backup -print | sudo /usr/sbin/backup -i -v -f /dev/rmt0;

Michael AM 06-20-2013 03:53 PM

A different solution is to create a symbolic link between /Backup and /some/where/else

# ln -s /some/where/else /Backup

Michael AM 06-20-2013 03:59 PM

clifford: good idea, however, -print is not needed. neither is sudo generally (sudo is often not installed)

so
Code:

# cd /somewhere/..
# find ./somewhere | backup -if /somewhereelse/backup.bff

or
Code:

# find ./somewhere | backup -if /dev/rmt0.1
fyi: on my system old enough to even have a tape - the default file settings:
Code:

mamfelt@x121:[/home/michael]ls -l /dev/rmt*
crw-rw-rw-  1 root    system      42,  0 Mar 31 12:15 /dev/rmt0
crw-rw-rw-  1 root    system      42,  1 Mar 31 12:19 /dev/rmt0.1
crw-rw-rw-  1 root    system      42,  2 Mar 31 12:11 /dev/rmt0.2
crw-rw-rw-  1 root    system      42,  3 Mar 31 12:11 /dev/rmt0.3
crw-rw-rw-  1 root    system      42,  4 Mar 31 12:11 /dev/rmt0.4
crw-rw-rw-  1 root    system      42,  5 Mar 31 12:11 /dev/rmt0.5
crw-rw-rw-  1 root    system      42,  6 Mar 31 12:11 /dev/rmt0.6
crw-rw-rw-  1 root    system      42,  7 Mar 31 12:11 /dev/rmt0.7



All times are GMT -5. The time now is 03:04 AM.