Thursday, August 27, 2020

How to restore a directory from mksysb backup in aix?

 How to restore a directory from mksysb backup in aix?



Using the below command, we can restore the directory from the mksysb backup whenever you required.

For example, if you want to restore the directory - /var/spool/mail from the mksysb. Please follow below.

Check if the target directory is existing on the mksysb:

testlpar:# restore -T -q -l -f /backup/testlpar.mksysb |grep "/var/spool/mail"

It will list out the detailed output and at the end, it will display the directory which we need to recover.

drwxrwxr-x  2 bin  mail  512  27 July 10:00 ./var/spool/mail


We can confirmed that the directory is available on the mksysb and we can try to restore it using /tmp/restore directory, then follow below.


Restore the particular directory (/var/spool/mail) using below
============================================

testlpar:# cd /tmp/restore

testlpar:# restore -xdvqf /backup/testlpar.backup ./var/spool/mail

Please note the (.) before the directory name

new volume on /backup/testlpar.mksysb :
Cluster size is 51200 bytes (100 blocks)
The volume number is 1.
The backup date is: Wed 26 July 00:05:15 2020
Files are backed by name
The user is root.

x 0./var/spool/mail
x 12586 ./var/spool/mail/root
x 485 ./var/spool/mail/wasadmin

The total size is 1684952 bytes.
The number of restored file is 2.
testlpar:# 
testlpar:# pwd
/tmp/restore/var/spool/mail
testlpar:# ls -ltr
total 2333
-rw-rw----   1 1001 mail 12586  17 may 2019 root
-rw-rw----   1 1001 mail 485      17 may 2019 wasadmin
testlpar:# 


Note: If you want to restore a single file from mksysb backup, please see the below link