Tuesday, October 3, 2017

How to restore a single file in aix?

How to restore a single file in aix?



If we want to restore a file named healthcheck.ksh from mksysb use the below.


Checking the healthcheck.ksh file existing in the mksysb image.
         
          restore -T -q -l -f /backup/uktest.mksysb | grep healthcheck.ksh


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

-rwxr-xr-x- 10   staff  May 30  11:54  267 ./home/unixsa/healthcheck.ksh


Restore the particular file healthcheck.ksh using,

          restore -x -q -f /backup/uktest.mksysb ./home/unixsa/healthcheck.ksh

Please note that (.) is important before the file name


cd ./home/unixsa
ls -la healthcheck.ksh
-rwxr-xr-x- 10   staff  May 30  11:54  267 ./home/unixsa/healthcheck.ksh


======================================================================

Another method:
---------------------

#lsmksysb -lf /backup/uktest.mksysb
# restorevgfiles -f /backup/uktest.mksysb ./home/unixsa/healthcheck.ksh

New volume on uktest.mksysb
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Tue May 30 11:54:18 GMT+01:00 2017
Files are backed up by name.
The user is root.
x            267 ./home/unixsa/healthcheck.ksh
The total size is 267 bytes.
The number of restored files is 1.


# ls -la */*
-rw-r--r--    1 root     system            6 Feb 17 11:16 ./home/unixsa/healthcheck.ksh