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.
-t argument
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