Creating a mksysb to DVD-RAM in AIX V5 & V6
This document discusses the ‘mksysb’ command and creating a rootvg backup to a DVD-RAM (cd#) device.
-- JFS to JFS2 conversions -- mkdvd failing with space errors -- Media requirement / Drive requirement (DVD-RAM) -- Logging -- NFS filesystems -- Restrictions on files that are safe to restore -- Estimated restore time -- Stuck at 83%, hang or no hang ?
*Note : For all examples the cd/dvd drive will be referred to as /dev/cd0. This may not be the case in your environment. Simply substitute the correct CD drive # as needed. Furthermore, this document does not cover restoring mksysb images to systems other than the one it was taken from.
*Note II : ‘mkdvd’ is simply a link to the ‘mkcd’ command. For this document we will be using ‘mkdvd’ for the command line examples.
*Note III : The ‘smitty’ and command line examples shown are using ISO format for the mkdvd command. In the interest of keeping the document from growing too large UDF examples are shown in limited sections, however can be easily figured out by familiarizing yourself with the ISO examples.
A mksysb is a bootable backup of your root volume group and is designed to backup all mounted JFS and JFS2 filesystem data. The root volume group image is in backup/restore file format, starting with the data files and then any optional map files.When a bootable backup of a root volume group is created, the boot image reflects the currently running kernel. If the current kernel is a 64-bit kernel, the backup's boot image is also 64-bit, and it only boots 64-bit systems. If the current kernel is a 32-bit kernel, the backup's boot image is 32-bit, and it can boot both 32-bit and 64-bit systems.
In general the mksysb backup is the standard backup utility used to recover a system from an unusable state - whether that be a result of data corruption, a disk failure, or any other situation that leaves your system down. You should create a mksysb backup on a schedule in line with how often your rootvg data changes, and always before any sort of system software upgrade.
A mksysb can also be used to boot a system into maintenance mode for work on the rootvg in cases where the system can not boot into normal.
There are two specific files that the mksysb restore process uses that you should become familiar with. These files can be manipulated in various ways to alter the process or outcome of the restore itself.
bosinst.data : This file can be used to pre-set the BOS menu options. Selections such as which disk to install to, kernel settings, and whether or not to recover TCP related information can all be set here. This file is mainly used for non-prompted installations. Any option selected during a prompted install will override the corresponding setting in this file. For more information concerning the individual stanza descriptions see the publib website PubLib Documentation by searching on "bosinst.data file stanza descriptions".
image.data : This file is responsible for holding information used to rebuild the rootvg structure before the data is restored. This information includes the sizes, names, maps, and mount points of logical volumes and file systems in the root volume group. It is extremely important that this file is up to date and correct, otherwise the restore can fail. It is common to edit this file when it is necessary to break mirroring during a restore. For more information concerning the image.data file and the stanza descriptions see the publib website : PubLib Documentation by searching on "image.data file".
It is very important that you understand the use and intent of a few of the flags used by the mksysb command. Improper use, lack of use, or use of certain flags in certain situations could cause your mksysb to be difficult to restore. In some cases it may cause your mksysb to be unrestorable.
-i Calls the ‘mkszfile’ command, which updates the image.data file with current filesystem sizes and characteristics. This flag should always be used unless there is a very specific reason you do not wish to have this information updated. Failure to have an accurate image.data file can cause your mksysb restore to fail with “out of space” errors.
-e Allows you to exclude data by editing the /etc/exclude.rootvg file. A few tips on excluding data from your mksysb are listed below :
- There should be one entry per line of the file. It can be either a single file or directory name.
- The correct format of each entry should be ^./
- Never use wildcards.
- Do not leave extra spaces or blank lines in the file.
While the /etc/exclude.rootvg file excludes data, bear in mind that it does not exclude the fact that a filesystem exists. For example if you have a 50Gb filesystem “/data” and add an entry in your /etc/exclude.rootvg file : ^./data This will exclude all files in /data but it will still recreate the /data filesystem as a 50Gb filesystem (except it will now be empty). The only way to truly exclude a filesystem from your mksysb would be to unmount the filesystem before initiating your mksysb.
-p Using this flag disables the software compression algorithms. When creating a mksysb during any level of system activity it is recommended to use the “-p” flag. Failure to do so can cause “unpacking / file out of phase” errors during your mksysb restore. These errors are fatal (unrecoverable) errors. No warning is given during the creation of the mksysb that notifies you of the possibility of having these errors during the restore. You may want to make the “-p” flag compulsory when running your mksysb command so you do not run into this situation.
-X This flag will cause the system to automatically expand the /tmp filesystem if necessary. The /tmp filesystem will require approximately 32Mb of free space.
When creating a mksysb to DVD you have the option of using either UDF (Universal Disk Format) or ISO9660 (CD format).
ISO - The ISO format image will create 1 image file (up to about 4Gb before a “volume 2 image” is needed) that is a “pre-packaged” mksysb image.
Benefits : - The process to create a mksysb using ISO format burns faster than using UDF format. - The ISO image(s) created are “portable” in that if your system does not have a dvd burner you can take those images to another AIX system with a dvd burner and burn your image there. - You can also take the ISO image(s) to a PC and use 3rd party software to burn it there as well.
Note: The use of any 3rd party software on PC is not supported by AIX software support, so if you find it necessary to burn this image on a PC, use a program you’re familiar with.
Drawbacks : - Lack of flexibility with the image. Once your image is burned you can not manipulate the image. - More free space on the system is required in order to create the ISO image. Three filesystems are required to create the ISO image. Total space required is roughly 3*(mksysb_image_size).
UDF - This format image burns directly to the DVD media and is known as “filesystem” format.
Benefits : - The “filesystem” format allows you to manipulate your mksysb. You can mount the mksysb over a special "UDF" filesystem and edit or even add files to the mksysb. (The system backup image is an archived file composed of many files that cannot be manipulated. However, the installation packages and any files that are not contained in the backup image, can be directly manipulated) - Less free space on the system is required in order to create a UDF formatted image. It only requires a filesystem large enough to hold the size of the mksysb itself.
Drawbacks : - The process to create a mksysb using UDF format has been known to take much longer than an ISO image formatted mksysb.
Below, we'll review the following examples :
- Using SMITTY without a previously existing mksysb file created
- From SMIT using an existing mksysb image
- From command line without a previously existing mksysb file
- From command line with using a previously existing mksysb file
- Creating a mksysb on a system without a DVD drive, to be burned on an AIX system with a DVD drive using SMIT.
- Creating a mksysb on a system without a DVD drive, to be burned on an AIX system with a DVD drive using command line.
1. Using SMITTY without a previously existing mksysb file created :
# smitty mkdvd
Use an existing mksysb image?
1 yes
--> 2 no
DVD backup media format?
--> 1 ISO9660 (CD format)
2 UDF (Universal Disk Format)
DVD-R or DVD-RAM Device.........................[/dev/cd0]
mksysb creation options:
Create map files?..............................no
Exclude files?.................................no
Disable software packing of backup?.............no
Backup extended attributes?.....................yes
File system to store mksysb image...............[]
(If blank, the file system will be created for you.)
File system to store DVD file structure.........[]
(If blank, the file system will be created for you.)
File system to store final DVD images...........[]
(If blank, the file system will be created for you.)
If file systems are being created:
Volume Group for created file systems [rootvg]
Advanced Customization Options:
Do you want the DVD to be bootable?.............yes
Remove final images after creating DVD?.........yes
Create the DVD now?.............................yes
Install bundle file.............................[]
File with list of packages to copy to DVD.......[]
Location of packages to copy to DVD.............[]
Customization script............................[]
User supplied bosinst.data file.................[]
Debug output?...................................no
User supplied image.data file...................[]
The above set of default choices (other than the selection of the backup device) are sufficient to initiate your backup to DVD. As you can tell, there are quite a few other options you can modify. We won’t be reviewing the options here except for the filesystem storage entries.
- “Filesystem to store......” entries : By default it will create 3 filesystems to perform the backup (in rootvg): /mkcd/mksysb_image /mkcd/cd_fs /mkcd/cd_images
If you don’t have the required space in rootvg you can use any other volume group with sufficient space simply by changing the appropriate option in your SMIT screen.
2. From SMIT using an existing mksysb image :
You can use a previously created mksysb image with the mkdvd process. In this example it should be a mksysb of the same system from which you’re creating the backup to dvd.
# smitty mkdvd
Use an existing mksysb image?
-->1 yes
2 no
DVD backup media format?
--> 1 ISO9660 (CD format)
2 UDF (Universal Disk Format)
All other options in the SMIT screen will remain the same as in example 1, except that you will have to provide the location of the existing mksysb image.
3. From command line without a previously existing mksysb file :
# mkdvd -d /dev/cd0 -V rootvg
4. From command line with using a previously existing mksysb file : You can use a previously created mksysb image with the mkdvd process. In this example it should be a mksysb of the same system from which you’re creating the backup to dvd.
# mkdvd -d /dev/cd0 -m /path_to_mksysb_file -V rootvg
*You must specify the full path name and filename of the mksysb image, not just the hosting directory.
5. Creating a mksysb on a system without a DVD drive, to be burned on an AIX system with a DVD drive using SMIT.
You may not have DVD-RAM drives in all of your AIX systems. You can create a mksysb in a “pre-packaged ready to burn” format. You can then ftp this file to one of your systems that does have a DVD-RAM drive and burn it there.
# smitty mkdvd
Use an existing mksysb image?
1 yes
--> 2 no
DVD backup media format?
--> 1 ISO9660 (CD format)
2 UDF (Universal Disk Format)
DVD-R or DVD-RAM Device.........................[]
mksysb creation options:
Create map files?..............................no
Exclude files?.................................no
Disable software packing of backup?.............no
Backup extended attributes?.....................yes
File system to store mksysb image...............[]
(If blank, the file system will be created for you.)
File system to store DVD file structure.........[]
(If blank, the file system will be created for you.)
File system to store final DVD images...........[]
(If blank, the file system will be created for you.)
If file systems are being created:
Volume Group for created file systems [rootvg]
Advanced Customization Options:
Do you want the DVD to be bootable?.............yes
Remove final images after creating DVD?.........no
Create the DVD now?.............................no
Install bundle file.............................[]
File with list of packages to copy to DVD.......[]
Location of packages to copy to DVD.............[]
Customization script............................[]
User supplied bosinst.data file.................[]
Debug output?...................................no
User supplied image.data file...................[]
Upon completion of this process you’ll have the following file under /mkcd : /mkcd/cd_images/cd_image_##### (where ##### is the pid number)
This is an ISO image that is ready to be burned to dvd. The oslevel of the system with the DVD-RAM drive does not need to match the level of the mksysb image you’re burning. Once you ftp the ISO image mksysb file over to the system with the DVD-RAM drive, run the following command :
# burn_cd -d /dev/cd0 cd_image_#####
6. Creating a mksysb on a system without a DVD drive, to be burned on an AIX system with a DVD drive using command line.
# mkdvd -V rootvg -R -S
Upon completion of this process you’ll have the following file under /mkcd : /mkcd/cd_images/cd_image_##### (where ##### is the pid number)
This is an ISO image that is ready to be burned to dvd. The oslevel of the system with the DVD-RAM drive does not need to match the level of the mksysb image you’re burning. Once you ftp the ISO image mksysb file over to the system with the DVD-RAM drive, run the following command :
# burn_cd -d /dev/cd0 cd_image_#####
There is no true verification of the “restorability” of a mksysb other than actually restoring it. Taking cautions such as understanding the flags used for the creation of the mksysb, checking your error report for any serious disk related errors before running the mksysb, and verifying the readability of the mksysb after creation are all good checks. If your system is in good health your mksysb should be in good health. Similarly, if you attempt to create a mksysb of a system logging hundreds of disk errors, or a system with known filesystem corruption, your mksysb will likely retain that corruption. To verify the readability of your backup run the following command :
# listvgbackup -f /dev/cd0
Any errors that occur while reading the headers of any of the files will be displayed, otherwise only the initial backup header information will be displayed. Keep in mind that this check tests the readability of the data only, not the writeability.
To restore a mksysb image you simply need to boot from the DVD and verify your selections in the BOS menus. Next, we’ll cover two booting scenarios. One in which your system is currently up and operational, the next in which your system is down.
1. If your system is currently running and you need to restore your mksysb, simply change the bootlist to reflect the DVD drive and reboot the system.
# bootlist -m normal cd0
# shutdown -Fr
2. If your system is in a down state you should boot to the SMS menus and set your bootlist to reflect the cdrom drive. The SMS menu options are listed below. Your menu options may be different (depending on your level of firmware), however it should be clear enough by following this document to figure out what options should be chosen if yours differ.
SMS - SYSTEM MANAGEMENT SERVICES -
1. Select Language
2. Change Password Options
3. View Error Log
4. Setup Remote IPL (RIPL (Remote Initial Program Load))
5. Change SCSI Settings
6. Select Console
--> 7. Select Boot Options
--> 1. Select Install or Boot Device
2. Configure Boot Device Order
3. Multiboot Startup
Select Device Type :
1. Diskette
2. Tape
3. CD/DVD
4. IDE
5. Hard Drive
6. Network
--> 7. List all Devices
The system will scan itself to determine which devices are available to boot from. All of your available boot devices will be displayed here. This menu can be a little tricky. If you have a device pre-selected it will have a 1 next to it under the “Current Position” column. Use the “Select Device Number” listing to choose the device you want to boot from to change that. The next screen will offer you three choices :
1. Information
--> 2. Normal Mode Boot
3. Service Mode Boot
After booting you should be taken to the BOS menu selections.
I. From the Installation and Maintenance Menu, select (2):
1) Start Installation Now with Default Settings
2) Change/Show Installation Settings and Install
3) Start Maintenance Mode for System Recovery
II. From the System Backup Installation and Settings, you’ll
see the default options that are taken from your “bosinst.data” file.
If these are correct select (0) and skip down to step 6 below.
If you need to change any options such as the disks you would like
to install to select (1):
Setting: Current Choice(s):
1. Disk(s) where you want to install... hdisk0
Use Maps............................ No
2. Shrink File Systems................. No
0. Install with the settings listed above.
To shrink the file systems to reclaim allocated free space, select
option 2 so the setting is set to Yes. For the file systems to be
restored with the same allocated space as the original system, make
sure option 2 is set to No.
III. Change Disk(s) Where You Want to Install.
Type one or more numbers for the disks to be used for
installation and press Enter. The current choice is indicated by >>>.
To deselect a choice, type the corresponding number and press Enter.
At least one bootable disk must be selected. Choose the location by its SCSI ID.
Name Location Code Size (MB) VG Status Bootable
>>> 1. hdisk0 00-01-00-0,0 70008 rootvg yes
>>> 2. hdisk1 00-01-00-1,0 70008 rootvg yes
0. Continue with the choices indicated above
After the desired disks have been chosen, select (0) to continue.
IV. System Backup Installation and Settings, select (0 to continue)
Setting: Current Choice(s):
1. Disk(s) where you want to install......... hdisk0...
2. Use Maps.................................. No
3. Shrink File Systems....................... No
0. Install with the settings listed above.
1. ISO mksysb file/directory restore 2. UDF mksysb file/directory restore
ISO mksysb file/directory restore To get a listing of the files/directories on your mksysb DVD you can run the following command.
# listvgbackup -f /dev/cd0
To restore a file/files from your mksysb DVD into the current working path (we’ll use /home as an example) :
# cd /home
# restorevgfiles -f /dev/cd0 ./var/adm/ras/mkcd.log
New volume on /tmp/_cdrom.315596/usr/sys/inst.images/mksysb_image:
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Tue May 6 13:13:42 CDT 2008
Files are backed up by name.
The user is root.
x 1157 ./var/adm/ras/mkcd.log
With an ISO mksysb on dvd you can specify a “target directory” to restore to. For example if you wanted to pull /var/adm/ras and all of the files underneath that directory from the mksysb and restore it under your own filesystem you could run the following commands :
# cd /
# restorevgfiles -f /dev/cd0 -d /myfs ./var/adm/ras
New volume on /tmp/_cdrom.315610/usr/sys/inst.images/mksysb_image:
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Tue May 6 13:13:42 CDT 2008
Files are backed up by name.
The user is root.
x 0 ./var/adm/ras
x 198971 ./var/adm/ras/codepoint.cat
x 131072 ./var/adm/ras/bootlog
x 293066 ./var/adm/ras/errtmplt
x 5884 ./var/adm/ras/bosinst.data
x 245989 ./var/adm/ras/devinst.log
x 53248 ./var/adm/ras/lvmcfg.log
x 0 ./var/adm/ras/mtrcdir
x 0 ./var/adm/ras/trc_ct
When restoring multiple files or multiple directories, simply put a space in between the files to restore in your restorevgfiles command.
# restorevgfiles -f /dev/cd0 -d /myfs ./var/adm/ras ./home/file1 ./tmp/log1
UDF mksysb file/directory restore As mentioned earlier, the UDF backup to dvd allows you to interact with the files on the backup. First create a directory to use as the mountpoint then run the ‘mount’ command.
# mkdir /dvdmksysb
# mount -V udfs -o rw /dev/cd0 /dvdmksysb
You now have the ability to cd to /dvdmksysb and see the files on your backup, make changes to existing files (like the bosinst.data or image.data) using ‘vi', add files to the dvd, or remove them. You will however notice you can not see all of your files. Files that are not required for the boot/restore process are held in the /mountpoint/usr/sys/inst.images/mksysb_image file. You have a few choices on restoring files in this case.
- If the file is visible on the dvd you can simply use the ‘cp’ command to restore it. For example if you needed to restore the ‘varyonvg’ command you would simply mount the dvd backup as shown above and copy the file off.
# cp /dvdmksysb/usr/sbin/varyonvg /usr/sbin/varyonvg
- If the file is not a visible part of the directory structure on the cd it will be in the ‘mksysb_image’ file. This is simply a backup/restore format file that you can use the restore command against. For example if you needed to restore /home you could run the following :
# cd /
# restore -xqvdf /dvdbackup/usr/sys/inst.images/mksysb_image ./home
This section is included to provide answers to common questions asked concerning mksysb. This section is not intended to diagnose any problem or perform any problem determination. These questions/answers are intended to hopefully prevent the need to call up and open a problem ticket for a short duration / short answer question. If you have any questions that you feel might be helpful, please submit feedback on this document and it may be added.
1. The rootvg on my mksysb DVD has all JFS filesystems, and I’d like to change them to JFS2 filesystems. How can I do this ? The only supported method of changing rootvg system filesystems from JFS to JFS2 would be to run a “New and Complete Overwrite” installation.
2. The mkdvd process keeps failing saying I am out of space but I have plenty of available unallocated partitions in rootvg. What’s going on ? If you truly have enough space in your rootvg this could be due to a previously failed or canceled mkdvd process. If it did not clean up completely you may have an existing “/mkcd” directory or filesystem left over. This could cause the process to not create a new filesystem and fill up your root (/) filesystem. Make sure there is no existing “/mkcd” directory. Also check the output of ‘lsvg -l rootvg’ and make sure there is no existing filesystem referencing “/mkcd*”.
3. What media should I be using to create a mksysb to DVD ? There are two things hardware-wise you should check before running the mksysb to DVD. - Make sure you have a DVD-RAM drive, not a DVD-ROM drive. DVD-ROM drives are “Read Only”, and thus can not write to a DVD. Check the output of the following command :
‘lsdev -Cc cdrom’
- The media type should be “DVD-RAM”, not “DVD-R”, not “DVD-RW”.
4. This process takes forever. What’s wrong ? Most likely, nothing. The burn process to DVD can take a long time. If you feel that you should be getting better performance from your DVD burner feel free to open a PMR with the support center and request the “System Performance” team. They will be able to make sure you’re writing at optimal performance.
5. What log is kept for this command ? The /var/adm/ras/mkcd.log will contain the log of the mkdvd process.
6. Does the mksysb command backup nfs mountpoints ? No, nfs mountpoints are not followed.
7. Will my non-root volume groups automatically mount after the restore completes ? That volume group setting is held on the VGDA of the disk the volume group is held. There is a new option that will allow this to be set in the BOS menus, so this should no longer be an issue.
8. The document mentions I can restore files from my mksysb. Are there any restrictions to what I should/should not restore ? Absolutely. You do not want to restore any files that are critical to the system running. Examples of files you do not want to restore: most library files, ODM files, applications... Examples of files safe to restore : /etc/group, /etc/passwd, cron related files, /home, any data filesystems you created....
9. How long will my mksysb take to restore ? That is dependent on many factors - the amount of data that needs to be restored being the major player in the restore time. Though creating a mksysb to DVD takes longer than it does to tape, the restore time is much shorter. You also have to consider reboot time.
10. The restore appears to be hung at 83%, what do I do ? First you want to make sure this is a "true" hang. This point in the restore can take anywhere from 10 minutes to even upwards of 60 minutes depending on the size of the rootvg. Make sure you've given it ample time to bypass this portion of the restore before becoming concerned.
11. Is it safe to restore anything I want from my mksysb ? Absolutely not. Never restore ODM data (/usr/lib/objrepos/* or /etc/objrepos*), library files, or any other unique system sensitive files unless you know exactly how you're affecting the system. Not heeding this warning has a high chance of causing permanant irrecoverable corruption. Files safe to restore include anything you yourself created (/mydata filesystem), user information (passwd, group, /home), and any other non-system specific or system sensitive files. |