herot
September 23, 2011, 11:15am
1
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
attribute value description user_settable
block_size 1024 BLOCK size (0=variable length) True
compress yes Use data COMPRESSION True
density_set_1 71 DENSITY setting #1 True
density_set_2 38 DENSITY setting #2 True
extfm yes,no Use EXTENDED file marks True
mode yes Use DEVICE BUFFERS during writes True
ret no RETENSION on tape change or reset True
ret_error no RETURN error on tape change or reset True
size_in_mb 36000 Size in Megabytes False
# restorevgfiles -a -D -f /dev/rmt0 /d -d /home/bds /home/bds
+ debug_switch
+ typeset +f
+ typeset -ft altertape
+ typeset -ft cleanup
+ typeset -ft compare_options
+ typeset -ft create_tmp_dir
+ typeset -ft debug_switch
+ typeset -ft determine_backup_type
+ typeset -ft determine_conflicting_options
+ typeset -ft get_stanza_data
+ typeset -ft get_vgdata
+ typeset -ft getoptions
+ typeset -ft ls_backup_lpp
+ typeset -ft ls_backup_properties
+ typeset -ft relative_to_absolute
+ typeset -ft restore_multivolumeCD
+ [[ no = yes ]]
+ [[ /dev/rmt0 = /dev/*[0-9] ]]
+ + /usr/bin/cut -d . -f1
+ /usr/bin/basename /dev/rmt0
BASE_DEV=rmt0
+ /usr/bin/wc -l
+ /usr/sbin/lsdev -C -c tape -l rmt0 -S available
+ [ 1 -eq 1 ]
+ TAPEBACKUP=yes
+ [[ no = yes ]]
+ [[ no = yes ]]
+ [ rvg = rvg ]
+ tctl -f /dev/rmt0 rewind
+ [[ /dev/rmt0 = /dev/rmt+([0-9]).[1357] ]]
+ DEVICE=/dev/rmt0.1
+ REWIND=1
+ TAPEFILE=-s 4
+ [ yes = yes ]
+ altertape
+ TAPEBLKSZ=tapeblksz
+ TMPDIR=/tmp/_mksysb.46702
+ create_tmp_dir /tmp/_mksysb.46702
+ dirname=/tmp/_mksysb.46702
+ umask 077
+ /usr/bin/mkdir /tmp/_mksysb.46702
+ RC=0
+ [[ 0 -ne 0 ]]
+ return 0
+ + pwd
olddir=/home/bds
+ cd /tmp/_mksysb.46702
+ /usr/bin/dspmsg -s 1 mksysb.cat 38 0512-048 Verifying block size for tape device.\n
0512-048 Verifying block size for tape device.
+ + /usr/bin/grep -v block_size
+ /usr/sbin/lsattr -E -O -a block_size -l rmt0
+ LC_MESSAGES=C
OLDBLOCKSZ=1024
+ [ rvg = rvg ]
+ [ 1024 -ne 512 ]
+ /usr/sbin/chdev -l rmt0 -a block_size=512
+ 1> /dev/null 2>& 1
+ TAPEFILE=-s 2
+ /usr/sbin/restore -s 2 -xqf /dev/rmt0.1 ./tapeblksz
+ 1> /dev/null
+ tctl -f /dev/rmt0.1 rewind
+ cat tapeblksz
+ set -- 1024 NONE
+ TBLOCKSZ=1024
+ [ 1024 -ne 512 ]
+ /usr/sbin/chdev -l rmt0 -a block_size=1024
+ 1> /dev/null 2>& 1
+ cd /home/bds
+ /bin/rm -rf /tmp/_mksysb.46702
+ 2> /dev/null
+ TMPDIR=
+ TAPEFILE=-s 4
+ cd /home/bds
+ olddir=
+ [[ no = yes ]]
+ [[ no = yes ]]
+ [[ yes = no ]]
+ TXFLAG=-xvdq
+ + pwd
olddir=/home/bds
+ [[ -n /home/bds ]]
+ cd /home/bds
+ [[ no = yes ]]
+ [[ yes = yes ]]
+ [[ no = no ]]
+ restore -xvdq -f /dev/rmt0.1 -s 4 /home/bds
New volume on /dev/rmt0.1:
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Mon Aug 1 03:12:36 EDT 2011
Files are backed up by name.
The user is root.
The total size is 0 bytes.
The number of restored files is 0.
+ RC=0
+ [ 0 -ne 0 ]
+ cleanup 0
+ ec=0
+ error=
+ [ 0 -eq 1 ]
+ [ no = yes ]
+ [ 1 -eq 1 ]
+ /usr/bin/tctl -f /dev/rmt0.1 rewind
+ [[ yes = yes ]]
+ [ 1024 -ne 1024 ]
+ [ -d ]
+ [ -d ]
+ [ -n ]
+ trap 1 2 15
+ exit 0
#
bakunin
September 23, 2011, 3:41pm
2
A mksysb is not a normal savevg, but also a boot block and some other information. Since you use mksysbs to boot a machine and restore it there need to be more than just a file backup (which a savevg does, even if in an elaborated way).
The savevg part of a mksysb image is the fourth file on the tape, therefore to restore only some files from a mksysb tape use:
# (tctl fsf3 ; tar -xvf /dev/rmt0)
This will extract the savevg image which can be restored using restvg. In fact this is simply backup format.
I hope this helps.
bakunin
herot
September 23, 2011, 11:21pm
3
That didn't work. I got the output:
# tctl fsf 3 ; tar -xvf /dev/rmt0 /home/bds
tar: 0511-193 An error occurred while reading from the media.
There is an input or output error.
#
FYI the write protect tab is set on the tape. It was only the tar that didn't work. Are you sure that will be a tar readable file? I also tried:
# tctl fsf 4
before doing the tar but that didn't work either. I read that the actual files are in the 4rth image on the tape?
herot
October 3, 2011, 10:01am
4
Any other suggestions on how to do this?
johnf
October 4, 2011, 4:30am
5
herot:
That didn't work. I got the output:
# tctl fsf 3 ; tar -xvf /dev/rmt0 /home/bds
tar: 0511-193 An error occurred while reading from the media.
There is an input or output error.
#
FYI the write protect tab is set on the tape. It was only the tar that didn't work. Are you sure that will be a tar readable file? I also tried:
# tctl fsf 4
before doing the tar but that didn't work either. I read that the actual files are in the 4rth image on the tape?
The problem is that the default tape device (rmt0) automatically rewinds on close so the basic tctl command does not work. Instead use the following:
tctl -f /dev/rmt0.1 fsf 3; tar -xvf /dev/rmt0 /home/bds
That should do it.
herot
October 5, 2011, 12:12pm
6
johnf:
The problem is that the default tape device (rmt0) automatically rewinds on close so the basic tctl command does not work. Instead use the following:
tctl -f /dev/rmt0.1 fsf 3; tar -xvf /dev/rmt0 /home/bds
That should do it.
I got this:
# tctl -f /dev/rmt0.1 fsf 3; tar -xvf /dev/rmt0 /home/bds
tar: 0511-169 A directory checksum error on media; 0 not equal to 30782.
herot
April 2, 2012, 3:20pm
7
I have tried the information on this page to try and accomplish this task:
Restoring A Single File From mksysb
Specifically the article talks about restoring just 1 file. I want to restore an entire directory.
I tried this
restore -xqd -s4 -f /dev/rmt0.1 ./home/herot
It seemed to work (after a looooong time) but the files aren't there... any ideas?
gito
April 3, 2012, 5:46pm
8
herot
April 4, 2012, 9:09am
9
I did. Keep in mind this is a:
mksysb -m -i -v /dev/rmt0
backup.
I got this:
# restore -xvf /dev/rmt0 /usr/graham/test
Please mount volume 1 on /dev/rmt0.
Press the Enter key to continue.
restore: 0511-160 Cannot read the backup media
/dev/rmt0: There is an input or output error.
#
johnf
April 5, 2012, 3:02am
10
herot:
I did. Keep in mind this is a:
mksysb -m -i -v /dev/rmt0
backup.
I got this:
# restore -xvf /dev/rmt0 /usr/graham/test
Please mount volume 1 on /dev/rmt0.
Press the Enter key to continue.
restore: 0511-160 Cannot read the backup media
/dev/rmt0: There is an input or output error.
#
You still need to wind forward with the
tctl -f /dev/rmt0.1 fsf 3
to get passed the boot information on the tape.
herot
August 28, 2012, 3:28pm
11
Now I get this:
$ su
root's Password:
# hostname
backupserver
# tctl -f /dev/rmt0.1 fsf 3
#
# hostname
backupserver
# restore -xvf /dev/rmt0 /home/user
Please mount volume 1 on /dev/rmt0.
Press the Enter key to continue.
restore: 0511-133 There is a data read error.: There is an input or output error
.
Ignoring data and continuing.
restore: 0511-123 The volume on /dev/rmt0 is not in backup format.
Mount volume 1 on /dev/rmt0.
Press the Enter key to continue.
What am I doing wrong?