Rootvg backup (mksysb)
The mksysb command creates a backup of the rootvg, which can be used to reinstall the system or restore it to another system. It backs up only the rootvg and only those filesystems which are mounted (nfs mounted filesystems are not being backed up.) The created backup file can be restored from NIM server or the mksysb file can be converted to bootable DVD images using mkdvd command.
----------------------------------------
/image.data
If mksysb is started with the -i flag, it will call the mkszfile command first, which collectes information about logical volumes, filesystems etc. All these information are written in the /image.data file. After that the mksysb command only backs up the file systems specified in the /image.data file. (The saved information allows the bosinstall routine during restore to recreate the logical volume information as it existed before the backup.) This flag is highly recommended otherwise an already existing image.data file may be used, which may not contain the actual state of the system.
It is also possible to manually change the content of the /image.data. After running mkszfile command, we can change the content of the created /image.data file to customize how we would like to restore our mksysb. For example we can change the PP size of rootvg from 256MB to 128MB, so after restore rootvg will have 128MB PP size. If we customaize an already created /image.data file, then -i flag will not be needed when using mksysb command.
# cat /image.data
image_data:
IMAGE_TYPE= bff
DATE_TIME= Sat Nov 2 13:15:22 CET 2019
UNAME_INFO= AIX my-aixserv 2 7 00C5A0D04B00
PRODUCT_TAPE= no
USERVG_LIST=
PLATFORM= chrp
OSLEVEL= 7.2.3.15
OSLEVEL_R= 7200-03
OSLEVEL_S= 7200-03-02-1845
CPU_ID= 00C4C2D05A00
LPAR_ID= 10
vg_data:
VGNAME= rootvg
PPSIZE= 256 <-- this can be changed
VARYON= yes
VG_SOURCE_DISK_LIST= hdisk0
QUORUM= 2
ENH_CONC_CAPABLE= no
CONC_AUTO= no
BIGVG= no
TFACTOR= 1
CRITVG= no
----------------------------------------
/etc/exclude.rootvg
It is also possible to exclude some files, directories from the backup. In this case we need to create /etc/exclude.rootvg file with the list of excluded directories, files. If mksysb command is started with -e flag then /etc/exclude.rootvg file will be applied during mksysb creation.
for example:
^./tmp/ it will backup /tmp, but not the content of it (at restore an empty /tmp will be created)
(exclude the contents of /tmp and avoid excluding any other directories which have /tmp in the pathname)
^./tmp it won't backup /tmp at all (at restore an empty /tmp won't be created)
/temp/ exclude the contents of every /temp/ directory on the system ("^." makes the exclude start from / and look for your path)
old$ $ indicates that the search should end at the end of the line
# cat /etc/exclude.rootvg
^./tmp/
^./opt/jenkins/
----------------------------------------
mksysb -i /mnt/aixserv.mksysb creating an mksysb to the given location (usually to an NFS mount)
mksysb -ie /mnt/aixserv.mksysb creating mksysb using exclude file
lsmksysb -lf /mnt/my_mksysb list header of the mksysb (VG, size, oslevel, lv info)
lsmksysb -f /mnt/my_mksysb list all the files in the mksysb
lsmksysb -f /mnt/my_mksysb –r ./etc/filesystems restores /etc/filesystem file
The restorevgfiles and listvgbackup -r commands perform identical operations and should be considered interchangeable
listvgbackup -f /mnt/aix11.mksysb -r /etc/resolv.conf restores the file /etc/resolv.conf from the specified backup
----------------------------------------
Full mksysb backup to 1 single large ISO image
If we want to have a bootable ISO image of an LPAR, and we need that in 1 large ISO file, unfortunately it is not so easy to accomplish. With mkdvd it is possible to create mksysb images in DVD format, but the maximum size of a volume is 4.7GB. There is no way to avoid this cutting of larger mksysb file into DVD sized volumes.
A workaround for this, if on VIO server we create and assign a virtual optical device to the LPAR, and on LPAR side we do mksysb directly to /dev/cd0!!!!
(This method by default uses UDF type, so there is no limitation on DVD size (4.7GB), it can be for example 20GB or more.)
1. df -tk `lsvgfs rootvg` | awk '{total+=$3} END {printf "Estimated mksysb size: %d bytes, %.2f GB\n", total*1024, total/1024/1024}'
on VIO client estimate size of mksysb
2. mkvdev -fbo -vadapter vhostX on VIOS create vtopt device
3. mkvopt -name aixserv_mksysb.udf -size 10G create ISO file with the size estimated before
4. loadopt -vtd vtoptX -disk aixserv_mksysb.udf load ISO file to the vtopt device
5. vi /etc/exclude.rootvg: ^./opt/jenkins/ on VIO client update /etc/exclude.rootvg with necessary entries
6. cfgmgr bring up cd device on VIO client (which was assigned previously from VIOS, lsdev will show)
7. mksysb -ie /dev/cd0 start backup directly to /dev/cd0
8. rmdev -dl cd0 delete cd0
9. unloadopt -vtd vtoptX on VIOS unload iso image
10. rmvdev -vtd vtopt remove vtopt
11. mv /var/vio/VMLibrary/aixserv_mksysb.udf /mnt save ISO to NFS mount
----------------------------------------
mkdvd
The mkdvd command creates multi-volume DVDs from different backup formats: mksysb, savevg, savewpar. For example regarding mksysb, it can create an mksysb image from the rootvg and then convert it to bootable DVD images or it can use a previously created mksysb image which will be converted to DVD images. The same way it can also create multi-volume DVDs from a savevg, or savewpar backup image. By default the created DVD images can be used to boot up an LPAR and then restore its content (similar to an mksysb restore). Each created volume has a maximum size of 4.7GB, so if an mksysb is greater than this size, it will be cut into multiple volumes.
-m mksysbimage Specifies the location of a previously created mksysb image which should be converted to DVD image
-M mksysbtarget If you do not specify the -m flag, the mkdvd command calls mksysb, and the created backup is stored in this location
if no location is specified /mkcd/mksysbimage filesystem is created, where the mksysb is temporarily stored.
-S Stops the mkdvd command before it burns the DVD images, without removing the image files.
(by default mkdvd removes the images, but in this case the images remain in the directory marked by the -I flag, or in the /mkcd/cd_images directory.)
mkdvd -S -M /mnt -I /mnt create mksysb backup in bootable ISO image format
(-R should be the same as -S, -e exclude file could be used)
mkdvd -R -S -m /mnt/aixserv2/aixserv2.mksysb -I /mnt/aixserv2 create ISO image from the specified mksysb file
----------------------------------------
device /dev/cd0 does not appear to be ready
root@aix-mgmt:/mgmt # mkdvd -m /mgmt/mksysb_5439724 -U -d /dev/cd0
Initializing mkdvd log: /var/adm/ras/mkcd.log...
Verifying command parameters...
0512-332 mkdvd: Device /dev/cd0 does not appear to be ready. For
information about possible causes, see /usr/lpp/bos.sysmgt/mkcd.README.txt
Continuing...
The device is not ready for operation.
check_cd_ready[41]: /dev/cd0: 0403-016 Cannot find or open the file.
0512-399 mkdvd: Unable to create UDF media.
Cleaning up...
Solution:
loadopt was missing on VIO, so we tried to "burn cd" when the "cd tray" was empty.
----------------------------------------
0512-399 mkdvd: Unable to create UDF media
mkdvd -m /home/labuser/mksysb_5439724 -U -d /dev/cd0
Initializing mkdvd log: /var/adm/ras/mkcd.log...
Verifying command parameters...
0512-399 mkdvd: Unable to create UDF media.
Cleaning up...
Solution was below udfcreate command, after it was successful:
# udfcreate -d /dev/cd0
----------------------------------------
/usr/sbin/bosboot[6]: dirname: not found
root@ls-aix-test: / # mkdvd -m /home/labuser/mksysb_5439724 -U -d /dev/cd0
Initializing mkdvd log: /var/adm/ras/mkcd.log...
Verifying command parameters...
Populating the CD or DVD file system...
Building chrp boot image...
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/usr/sbin/bosboot[6]: dirname: not found
/tmp/bosboot_14024764_15499/usr/lib/drivers/cfs.ext: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/planar_pal_chrp: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/pci/sisraid_dd: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/udfs.ext: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/scdisk: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/vdev_busdd: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/vscsi_initdd: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/scsidiskpin: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/scsidisk: No such file or directory
/tmp/bosboot_14024764_15499/usr/lib/drivers/scdiskpin: No such file or directory
Filesystem Helper: Implementation-specific error, code = (112)
Detailed Solution is at this link:
https://www.ibm.com/developerworks/community/forums/html/topic?id=d06862fa-1566-4c34-9575-d74147c4d904
In general the "coreutils" rpm package overwrites the AIX "dirname" command,
2 steps will be needed:
- install latest coreutils (in newer coreutils this bug has been fixed, but it does not help on the current overwritten system)
- from another AIX (same oslevel) where no coreutils is installed copy over dirname binary from /usr/bin/dirname
----------------------------------------
devices.scsi.disk.diag.com
Cannot find file system or does not match filter: ramdisk0
Populating the CD or DVD file system...
0512-323 mkdvd: The following files are required for the
creation of the CD or DVD image and are not available on the source system:
/usr/lpp/diagnostics/bin/uformat devices.scsi.disk.diag.com
The files can be installed from the listed filesets.
0512-321 mkdvd: Error populating the CD or DVD file system
using the /usr/lpp/bosinst/cdfs.required.list proto file.
Cleaning up...
Solution was to install devices.scsi.disk.diag from below fileset (the other is a requirement):
-rw-r--r-- 1 root system 2651 Oct 14 07:31 .toc
-rw-r--r-- 1 root system 3171328 Oct 14 07:30 devices.pci.14107802
-rw-r--r-- 1 root system 1426432 Oct 14 07:30 devices.scsi.disk
# installp -apgXYd . devices.scsi.disk
----------------------------------------
Earlier general idea was to convert mksysb to UDF (DVD) format, which has no 4.7 GB max. limit. <<<< unfortunately this does not work. mkdvd always cut an image to pieces
After we have this image we can load it on VIO server and boot+restore from there
Backup:
1. Take a normal mksysb on nfs-share
- mount nfs share
- mksysb -i /mnt/ls-aix-j11b720.mksysb
2. On VIOVirtual optical device has been assigned to aix-mgmt
- (if needed on VIO create virt opt. dev (vtopt) to aix-mgmt) mkvdev -fbo -vadapter vhost1
- (on VIO create image file where mksysb will be written) mkvopt -name jdk_iso -size 60G
- load virt opt file: loadopt -disk jdk_iso -vtd vtopt0
3. on aix mgmt convert/copy mksys to UDF file format for /dev/cd0
- mkdvd -U… will used UDF format: mkdvd -m /home/labuser/mksysb_5439724 -U -d /dev/cd0
----------------------------------------
Volume Group Backup (savevg, restvg)
savevg -f /bckfs/backup.0725 bckvg backs up all files belonging to bckvg to the specified file
restvg -f /bckfs/backup.0725 restores the vg and all the files what have been saved with savevg
(it creates the vg, lv, fs...)
----------------------------------------
Filesystem backup (bckfs)
find /bckfs -print | backup -i -f /dev/rmt0 backup all the files and subdirs
find: genereates a list of all the files
-i: files will be read from standard input
restore extracts files from archives created with the backup command.
JFS2 snapshot:
creates a point in time image, it is very quick and very small
----------------------------------------
16 comments:
is it ideal to find the files using find command first and then backup the files with their relative path on to the archival medium or is it better to first go to the directory where the file is stored and then do the backup with absolute path on to the archival medium ..?
I don't see much difference between these 2 methods, both of them should work perfectly.
Wat is the future scope of AIX ? i was put into AIX domain and for next 2 yrs am gonna work in that domain....can AIX admins demand more?
You can find some info about Power 8, which probably will come out in the next year. AIX should use its capabilities, so I expect some new things to learn at AIX side as well.
How to take the backups of SYSdump and Device?
When you make an mksysb, those will be backed up as well.
hi aix,
when i ran: mksysb to backup os i get error: 0301-183 bosboot: /unix and /usr/lib/boot/unix must link ti the same kernel file
and in addition, bootinfo -v -> result: hd5, bootinfo -b ->>result: hdisk1
Hi, did you check if /unix is link to the correct place?
hi aix, i'm stupid in aix. when i check /unix, it is not exist.
#ls -l /unix ->result: /unix not exist. and my kernel is 64bit.
in the /usr/lib/boot/ has unix_64 directory is symlinked to /unix.
so i must create /unix in / then i completed mksysb
Hi, yes, for me it looks like this:
lrwxrwxrwx 1 root system 21 May 28 09:37 unix -> /usr/lib/boot/unix_64
is there any command to check user password expire in aix
lsuser will list all this information. need to be executed as root to get full information
I'm beginner on AIX, Please give me suggestion.
I using power system S822 server with AIX 7.1.
This server not have card iscsi and also not have DAT4 tape slot on server.
So what must I do for backup OS and then I can restore it if I have a problem with OS level.
PLease give me the best way I can do.
Thanks
hi Friendlucky Kucky, I have same problem , could you solve your ??
/unix
the directory exists but I have the same error posted how do I solve it?
how do i list a specific file from mksysb.backup without restoring it?
what is the meaning of -ivp in mksysb command ..anyone can please tell me?
Post a Comment