Restore file from mksysb file

Hello,

I have a mksysb backup OS image. I can restore the file from there, but the issue is the restored file include the whole path :confused:

listvgbackup -f /backup/xxx/mksysb.xxx.20190316 -r -s -d /home/aaa/ ./home/bbb/nohup.out

I plan to restore nohup.out from /home/bbb/nohup.out to /home/aaa/nohup.out.

But actually I see this:

[root@xxx] / > ls -l /home/aaa/home/bbb/nohup.out
-rw-------    1 root     system      1585567 Jun 28 2013  /home/aaa/home/bbb/nohup.out

It takes the whole path & file to new destination.

Can everybody advise me on this?

Regards,
Phat

An mksysb is basically a savevg rootvg . The savevg format consists of 4 parts. The first three parts only deal with booting the system and laying the grounds to restore the system from scratch and they are simply left empty in savevg (and non-bootable mksysb ) image. The fourth part in both cases is what you want to deal with. It is an archive of the respective VGs ( rootvg in case of a mksysb , any other VG with savevg ) contents in backup format. See man backup (and/or man restore ) for all this command has to offer.

After restoring the files you can still move or rename them to the location you want them to hold. Because they are placed into a different hierarchy they can never overwrite files you already have on your system, so i do not fully understand your complaint. If you indeed want them to overwrite your original files simply restore to the root directory, no?

I hope thi helps.

bakunin

Hi Bakunin,

Can you tell me more about the first 3 parts of savevg? Not clear for me to get the point from you.

Regarding the second thing, there is a need if the file was deleted somehow unexpectedly, and we would like it to be recovered to the same location.

So how about restoring whole AIX OS, it will overwrite all existing files (with corrupted and non-corrupted data) to bring the OS back to normal?

I was trying to give the complete picture. For details you may want to search the forum, for instance here.

You yourself provided the command:

listvgbackup -f /backup/xxx/mksysb.xxx.20190316 -r -s -d /home/aaa/ ./home/bbb/nohup.out

which would - again, your own words - restore the file originally being found at /home/bbb/nohup.out to /home/aaa/home/bbb/nohup.out , yes?

Now, if you want to restore the file to /home/bbb/nohup.out instead of /home/aaa/home/bbb/nohup.out what do you think you should change in the above command, hmm? I don't know the listvgbackup command, but the rest looks pretty much like the parameters for the restore command. You migh want to consult the man page for restore because this is the common utility to pull out single files from a savevg image. This is why i told you it is is in backup format. backup and restore are UNIX utilities to create backup images and restore from them.

You can do that. Usually you have a rootvg where all the OS-relevant stuff, customisation, etc.. resides. Ideally it does NOT contain any application data or application binaries. You create an image of this VG with the mksysb command. If you send this backup to a tape or a NIM-server it is even possible to boot a system with it and then restore the backup, thus restoring the system as it was set up when you took the backup. This is commonly used not only for restoring systems in case of disaster but also to install new systems. You create a "golden image" on a system, create a mksysb image from it, then use this image to base-install systems with everything pre-set/pre-configured in the way you want it and only apply additional customisation/settings to it.

You can also do a savevg which creates an analogous image from a non-root VG. You can use such an image to restore application data onto the same system or onto a new system for the purpose of cloning the old system.

I hope this helps.

bakunin

Hello, my aim is to restore the file either to every where I want or to the original path. But whatever I do, it ends up the file is restored to destination successfully but with its own path.

For example, I would like to restore the file

/home/bbb/nohup.out

to its original path /home/bbb/ but actually after restore, it will be:

.

If I restore it to /tmp, it results in

/tmp/home/bbb/nohup.out

As has been explained to you, that is a safety measure so people don't unintentionally wreak havoc on their system. Applying some logics and deduction to your remark

, what do you think would happen if you "restore it to" / , the file system's root?