AIX 5L SysAdmin II: (Unit 07) – Saving and Restoring Volume Groups and Online JFS/JFS2 Backups

Unit Overview:
1. Create, verify and restore mksysb images
2. Setup cloning using mksysb images
3. Shrink file systems and logical volumes
4. Provide alternate disk installation techniques
5. Backup and restore non-rootvg volume groups
6. Perform an online JFS or JFS2 backup

Creating a System Backup: mksysb:
# smit mksysb or mksysb -i -vf /dev/rmt.0
-i – generate a new / file
-v – verbose
-f – backup file or device

EXCLUDE files? /etc/exclude.rootvg
Generate new / file? yes (guides the restore process)
EXPAND /tmp if needed? 8Mb-12M required

mksysb Tape Images:
1. Bosboot Image (hd5)
2. Mkinsttape Image
./ – helpful for hands free installation
./ – contains volume group settings
./tapeblksz – size of the table blocks
Maintenance files
3. Dummy TOC Image (Table Of Contents)
4. rootvg data and structure (mksysb calls the backup command)
rootvg mounted file systems

Note: The mksysb backup contains the boot image and boot logical volume which includes the kernal, rcboot, ODM, commands.

Note: Only filesystems that are mounted are backed up with mksysb.

CD or DVD mksysb:
1. Personal system backup
– Will only boot and install the system where it was created
2. Generic backup
– Will boot and install any platform (rspc, rs6k, chrp)
3. Non-bootable VG backup
– Contains only a VG image (rootvg and non-rootvg)
– Can install AIX after boot from product CD-ROM (rootvg)
– Can be source for alt_disk_install
– Can be restored using restvg (non-rootvg)

The mkcd Command:
1. mksysb and savevg images are written to Cd-Rs and DVDs using mkcd
2. Supports ISO09660 and UDF formats
3. Requires third party code to create the Rock Ridge file system and write the backup image.

Verifying a System Backup After mksysb Completion (1 of 2)
The only method to verify that a system backup will correctly restore with no problems is to actually restore the mksysb onto another machine.

This should be done to test your company’s disaster recovery plan.

Verifying a System Backup (2 of 2):
1. Data Verification
# tctl -f /dev/rmt0 rewind
# restore -s4 -Tqvf /dev/rmt0.1 > /tmp/mksysb.log

2. Boot Verification:
Boot from the tape without restoring any data.
Warning: Check the PROMPT=yes field in!
Otherwise it will try to restore from the tape.
Press 000 when bar is rotating to change

mksysb Control File:
Useful when trying to clone a system. However, RECOVER_DEVICES = no so that the ip information is not copied to the new system.

Restoring a mksysb (1 of 2):
Boot from AIX bootable media
Welcome to Base Operating System
>> 3 Start Mainenance Mode for System Recovery
>> 4 Install from a System Backup
Choose Tape Drive
>> 1 tape/scsi/4mm/2GB /dev/rmt0
Welcome to Base Operating System
>> 2 Change/Show Installation Settings and Install
System Backup Installation and Settings
>> Shrink File Systems (No)

Cloning Systems Using mksysb Tapes
1. Insert the mksysb tape and the AIX CD (same AIX level!)
2. Boot from the AIX CD (*)
3. “Install from a System Backup”:
Missing device support is installed from the AIX CD

(*): If no AIX CD available, use an AIX product tape, but check

Changing the Partition Size in rootvg:
1. Create
# mkszfile

2. Edit /
# vi /
Change PPSIZE stanza

PPSIZE=4 (change to PPSIZE=8)

3. Create mksysb tape image:
# mksysb /dev/rmt0

4. Restore mksysb tape image

Note: This is very rarely done.

Reducing the File System in rootvg:
1. # mkszfile (creates the / file
2. # vi / (modify LPs=, LV_MIN_LPS=, FS_MIN_SIZE=)
3. # mksysb /dev/rmt0
4. Restore image

Note: Don’t use the -i option so that it is not overwritten

Alternate Disk Installation: (while system is running)
Installing a mksysb on another disk
Cloning the running rootvg to another disk
# alt_disk_install …

Alternate mksysb Disk Installtion (1 of 2):
Installs a 5.2.0 mksysb on hdisk1 (“second rootvg”)
Bootlist will be set to alternate disk (hdisk1)
Changing the bootlist allows to boot different AIX levels
(hdisk0 boots AIX 5.1.0, hdisk1 boots AIX 5.2.0)

# alt_disk_install -d /dev/rmt0 hdisk1

Alternate mksysb Disk Installtion (2 of 2):
# smit alt_mksysb (can run from smit instead of command line)
Install mksysb on an Alternate Disk

Note: The disk must be empty.

Alternate Disk rootvg Clonging (1 of 2)
# alt_disk_install -C -b update_all -l /dev/cd0 hdisk1
-C – Cloning

Note: This performs an On-line update of your system when the system is running.

1. Creates a copy of the current rootvg (“clone”) on hdisk1
2. Installs a maintenance level on clone (AIX 5.2.0)
3. Changing the bootlist allows you to boot different AIX levels
(hdisk0 boots AIX 5.1.0, hdisk1 boots AIX 5.2.0)

# smit alt_clone (can also do this process through smit)

Removing an Alternate Disk Installation:
bootlist -m normal hdisk0
# alt_disk_install -X

1. alt_disk_install -X removes the ODM definition from the ODM
2. Do not use exportvg to remove the alternate volume group

Saving a non-rootvg Volume Group:
# smit savevg
Back Up a Volume Group to Tape/File
Generate new file? -i option of savevg
EXCLUDE FILES? /etc/exclude.datavg

savevg/restvg Control File:
# mkvgdata datavg (creates the following file)
# vi /tmp/vgdata/datavg/ (edit the file – change partition size
# savevg -f /dev/rmt0 datavg

Restoring a non-rootvg Volume Group:
# smit restvg

Online JFS and JFS2 Backup:
# lsvg -l newvg

Note: It is better to have the filesystem mirrored three times if doing on-line file system backups because one is taken off-line to do the backup.

# chfs -a splitcopy = /backup -a copy =3 /fs1 (Splitting the Mirror – created a /backup file system)
# backup -o -vf /dev/rmt0 /backup (Backup the file system)

# unmount /backup
# rmfs /backup

Note: Useful when you can’t stop the users from accessing the file system.

JFS2 Snapshot Immage:
1. For a JFS2 file system, the point-in-time image is called a snapshot.
2. A snapshot image of a JFS2 file system can be used to:
– create a backup of the filesystem at the given point in time the snapshot was created.
– provide the capability to access files or directories as they were at the time of the snapshot
– backup removable media
3. The snapshot stays stable even if the file sytem that the snapshot was taken from continues to change.

Creation of a JFS2 Snapshot:
1. JFS2 snapshots can be created on the command line, through SMIT or the Web-based System Manager
2. Some of the new commands included in Version 5.2 that support the JFS2 snapshot function are:
– Snapshot – create, delete and query a snapshot
– Backsnap – create and backup a snapshot
– fsdb – examine and modify snapshot superblock and snapshot map

Using a JFS2 Snapshot:
1. When a file becomes corrupted, you can replace it if you have an accurate
2. copy in an online JFS2 snapshot
3. Use the following procedure to recover one or more files from a JFS2 snapshot image:
– Mount the snapshot. For example:
# mount -v jfs2 -o snapshot /dev/mysnaplv /home/aaa/mysnap
– Change to the directory that contains the snapshot. For Example:
# cd /home/aaa/mysnap
– Copy the accurate file to overwrite the corrupted one. For example:
# cp myfile /home/aaa/myfs (copies only the file named myfile)
4. The following example copies all files at once:
# cp -R home/aaa/mysnap /home/aaa/myfs

Snapshot Support for Mirrored VGs
1. Split a mirrored copy of a fully mirrored VG into a snapshot VG
2. All LVs must be mirrored on disks that contains only those mirrors
3. New LVs and mount points are created in the snapshot VG
4. Both VGs keep track of changes in PPs
– Writes to PP in original VG causes corresponding PP in snapshot VG to be marked stale
– Writes to PP in snapshot VG causes that PP to be marked stale
5. When the VGs are rejoined the stale PPs are resynchronized

Snapshot VG Commands:
splitvg [ -y SnapVGname ] [ -c copy ] [ -f ] [ -i ] Vgname
-y specifies the name of the snapped VG
-c specifies which mirror to use (1, 2 or 3)
-f forces the split even if there are stale partitions
-i creates an independent VG which cannot be rejoined into the original

Example: File system /data is in the VG datavg. These commands split the VG, creates a backup of the /data file system and then rejoins the snapshot VG with the original.
1. splitvg -y snapvg datavg
– The VG datavg is split and the VG snapvg is created. The mount point /fs/data is created.
2. backup -f /dev/rmt0 /fs/data
– An 0-node based backup of the unmounted file system /fs/data is created on tape
3. joinvg datavg
– snapvg is rejoined with the original VG and sysced in the background

Q: Would a mksysb or system back up,? back up the entire system?
A: No, a system back up or mksysb back up, will only back up the mounted file sytems in rootvg and only rootvg’s structure.? All other volume groups will have to be backed up separately with the savevg command.
Q: What is the purpose of the / file?
A: The file is a text file that can be modified and used to clone a system without any interaction from the system administration.? The different entries in the file answer the questions that otherwise would be asked during the installation process.

Q: How? can one determine the blocksize used to create a rootvg image?
A: To obtain this information, restore the tapeblksz file from the second image of the tape: ? # chdev -l rmt0 -a block_size=512 ? # tctl -f /dev/rmt0 rewind ? # restore -s2 -xqvf /dev/rmt0.1 ./tapeblksz ? # cat tapeblksz ? 1024

Q: What is the name of the fileset that allows to use the alt_disk_install command?
A: bos.alt_disk_install must be installed on the system.?

lsvg -o (verify active volume groups)
lsvg datavg
lsvg -l datavg (see what logical volumes are on datavg)
mkvgdata datavg (creates the
vi /tmp/vgdata/datavg/
find /datavg/jupiter
change LPs=2 to LPs=4
savevg -f /tmp/datavg.img datavg
unmount /datavg/jupiter
unmount /datavg/mars
varyoffvg datavg
exportvg datavg
lsvg -o

restvg -f /tmp/datavg.img hdisk1
lsvg -l datavg (verify that datavg was restored)
Note: The LPs is now 4 instead of 2 because of our change.

smit savevg
unmount /datavg/jupiter
unmount /datavg/mars
lsvg -l datavg
varyoffvg datavg
exportvg datavg
lsvg -l datavg (shows an error)
lspv (hdisk1 not part of a volume group)

smitty restvg
lsvg datavg
lsvg -l datavg

Leave a Reply

Your email address will not be published. Required fields are marked *