Here I am going to discuss what you can do with the mksysb command. But before proceeding further let’s have a look on important command line options. Consult mksysb man page from IBM for more information.
-aÂ Â Â Â Â Â Â Â Specifying this option won’t backup extended attributes and NFS4 ACLs.
-bÂ Â Â Â Â Â Â Â How many number of 512-byte blocks to write in a single output operation.
-e Â Â Â Â Â Â Â Excludes files listed in /etc/exclude.rootvg file from backup.
-FÂ Â Â Â Â Â Â Â If you want to use previously created mksysb image to create backup tape.Â Backup tape is made bootable if possible. It’s a must with a tape backup.
-iÂ Â Â Â Â Â Â Â Â Specifying this option calls mkszfile to generate /image.data file. The file /image.data will have information of VG, LV, FS, PV and Paging space.
-mÂ Â Â Â Â Â Â Specifying this option calls mkszfile with -m flag to generate map files. No use of -i is needed with this option.
-pÂ Â Â Â Â Â Â Â This instructs to not to use any kind of compression algorithms.
The option specifies the path where the image will be created from mksysb file specified by -F flag. If you don’t specify then /tmp is used.
-vÂ Â Â Â Â Â Â Â Verbose mode. All files being backed up will be listed.
-VÂ Â Â Â Â Â Â It verifies a tape backup. File header of each file on backup tape is verified.
-XÂ Â Â Â Â Â Â Auto expand /tmp file system if needed.
1. Generating system backup and creating /image.data file on tape drive /dev/rmt0
mksysbÂ -i /dev/rmt0
2. Generating system backup and creating /image.data file on tape drive /dev/rmt0 with map files:
mksysbÂ -m /dev/rmt0
3. Generating system backup and creating /image.data file on tape drive /dev/rmt0 and producing verbose output . Also exclude /home/user1/my_dir.
mksysbÂ -iÂ -eÂ -vÂ /dev/rmt0
Also create a file /etc/exclude.rootvg and enter file name as: /home/user1/my_dir/
Note the ending slash.
4. Generating system backup and creating /image.data file in file /my_backups/backup_image
mksysbÂ -i /my_backups/backup_image
5. Generating system backup and verifying backup image.
mksysbÂ -i /dev/rmt0 -V
How To Schedule mksysb
Let’s say we choose to schedule daily mksysb schedule. Say you want to take mksysb backup daily at 04:20 Hours. You need to follow the following steps:
- Create a file named anything like mksysb_sched in your home directory. So the file will be something like: /home/user1/mksysb_sched.
- Give it permissions like 755 as follows:Â chmod 755 mksysb_sched
- Run the command:Â Â Â crontab -e
- Make entry: 20Â Â 04Â *Â Â *Â *Â Â /home/user1/mksysb_sched