Cloning rootvg
Most system administrators have experienced the following scenario:- A failed ML upgrade.
- It's getting to the end of the day.
- You cannot fix it.
- It's too late to get it resolved by third-party support.
- You need to back out.
The alt_disk utilities consist of the following commands:
alt_disk_copy
performs disk cloning.alt_rootvg_op
performs maintenance operations on the clone rootvg.alt_disk_mysysb
performs a mksysb copy.
The filesets required for the alt commands are:
1
2
3
| bos.alt_disk_install.boot_images bos.alt_disk_install.rte bos.msg.en_US.alt_disk_install.rte |
Overview information
Because the alt_disk_copy command takes a copy of the current running rootvg to another disk, be sure to have all the file systems mounted that you want cloned across. alt_disk_copy only copies the currently mounted file systems in rootvg. There is no need to stop processes to execute alt_disk_copy; however, this process can take some time, so it is best to do it at lunchtime or in the evening (remember it is taking a running copy). Once the copy has completed, you will be presented with two rootvg volume groups:
1
2
| rootvg altinst_rootvg |
altinst_rootvg
is the cloned non-active/varied off
rootvg. The cloned rootvg has all its logical volumes prefixed with the name 'alt'.
The boot list is also changed to boot off altinst_rootvg. AIX likes to do things like
this; it assumes you will want to boot off the cloned and not the real rootvg. If the
system is now rebooted and when the system comes back up, the original rootvg will become:
1
| old_rootvg |
1
| rootvg |
1
| rootvg |
1
| altinst_rootvg |
With a successful completion of an upgrade, the disk containing the cloned rootvg can then be destroyed using the alt_rootvg_op and mirrored back in. If the upgrade event has gone disastrously, there is no real problem--simply take a snapshot for third-party support, then boot off the good rootvg. For users to log in, it is business as normal.
When you get a response back from support on the fix, during off-line hours, simply reboot off the cloned rootvg and fix the issue. There is no need to go through the time-consuming tasks of re-applying the upgrade because you already have it on the cloned rootvg. Get the upgrade tested, and if it is all OK, destroy the cloned rootvg and mirror back in.
With the cloned rootvg, you can mount the file systems by waking up the disk using alt_rootvg_op. Doing whatever works is required on the cloned file systems, and one would assume here to fix a patch of link, or gather information for third-party support, then put the disk back to sleep, which will also unmount the file systems.
Excluding directories when cloning
When cloning, you can exclude certain directories by creating the file:/etc/exclude.rootvg
.
The entries should start with the ^ /.
characters. The '^' means to search for the string at the beginning of
the line and the './' means relative to the current directory. You are
advised to do this so alt_disk_copy does not misinterpret the command,
as it uses grep to search for the string. So, make sure you provide the
full pathname, prefixed with '^.' , for example, to exclude the
following directories:
1
2
| /home/reps /opt/installs |
1
2
| ^./home/reps ^./opt/installs |
Let's get cloned!
Let's now go through a typical clone. Assume you have a software two-disk (hdisk0 and hdisk1) mirror of rootvg, and further assume that you are going to do a ML (or application upgrade, assuming it is installed in rootvg) upgrade on this system. I will demonstrate one way this can be done to clone the disk and after a successful upgrade will bring the disk back into rootvg and re-mirror. I will also demonstrate the actions you can take if the upgrade fails.Pre-checks
Before unmirroring the rootvg, first take some time to ensure you are correctly mirrored and have no stale LV's, because if you do, the unmirrorvg will fail. Of course, you could always do a migratepv to move the missing LV's across if the unmirrorvg fails. A simple method to check that you are mirroring is to issue the command:
1
| lsvg -l rootvg |
Another method to check to see if you are mirroring is to use:
lspv -l <hdiskx>
and compare the output to make sure you have entries for each LV on both disks.Next, issue the bosboot command. I personally always do this prior to either rebooting or disk operations involving rootvg; it is a good habit to have:
1
2
| # bosboot -a bosboot: Boot image is 35803 512 byte blocks. |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f rootvg active hdisk1 00452f0b2b1ec84c rootvg active |
1
2
3
4
5
6
7
8
9
10
| # unmirrorvg rootvg hdisk1 0516-1246 rmlvcopy: If hd5 is the boot logical volume, please run 'chpv -c < disk name>' as root user to clear the boot record and avoid a potential boot off an old boot image that may reside on the disk from which this logical volume is moved/removed. 0516-1804 chvg: The quorum change takes effect immediately. 0516-1144 unmirrorvg: rootvg successfully unmirrored, user should perform bosboot of system to reinitialize boot records. Then, user must modify bootlist to just include: hdisk0. |
1
| # reducevg rootvg hdisk1 |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f rootvg active hdisk1 00452f0b2b1ec84c None |
Running alt_disk_copy
Now you are ready to issue the alt_disk_copy. Simply supply hdisk1 as a parameter to the command. The basic format is:
1
| alt_disk_copy -d < hdisk to clone rootvg> |
1
| alt_disk_copy -e /etc/exclude.rootvg -d < hdisk to clone rootvg> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| # alt_disk_copy -d hdisk1 Calling mkszfile to create new /image.data file. Checking disk sizes. Creating cloned rootvg volume group and associated logical volumes. Creating logical volume alt_hd5 Creating logical volume alt_hd6 Creating logical volume alt_hd8 Creating logical volume alt_hd4 Creating logical volume alt_hd2 Creating logical volume alt_hd9var Creating logical volume alt_hd3 Creating logical volume alt_hd1 Creating logical volume alt_hd10opt Creating /alt_inst/ file system. Creating /alt_inst/home file system. Creating /alt_inst/opt file system. Creating /alt_inst/tmp file system. …...... …...... for backup and restore into the alternate file system... Backing-up the rootvg files and restoring them to the alternate file system... Modifying ODM on cloned disk. Building boot image on cloned disk. forced unmount of /alt_inst/var forced unmount of /alt_inst/usr forced unmount of /alt_inst/tmp forced unmount of /alt_inst/opt forced unmount of /alt_inst/home ….. ….. Changing logical volume names in volume group descriptor area. Fixing LV control blocks... Fixing file system superblocks... Bootlist is set to the boot disk: hdisk1 |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f rootvg active hdisk1 00452f0b2b1ec84c altinst_rootvg |
1
2
| # bootlist -m normal -o hdisk1 blv=hd5 |
1
| # bootlist -m normal hdisk0 |
1
2
| # bootlist -m normal -o hdisk0 blv=hd5 |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f rootvg active hdisk1 00452f0b2b1ec84c altinst_rootvg |
1
2
3
4
| alt_rootvg_op -X < cloned rootvg to destroy> # alt_rootvg_op -X altinst_rootvg Bootlist is set to the boot disk: hdisk0 |
1
2
3
4
5
6
| # extendvg -f rootvg hdisk1 # mirrorvg rootvg hdisk1 0516-1804 chvg: The quorum change takes effect immediately. 0516-1126 mirrorvg: rootvg successfully mirrored, user should perform bosboot of system to initialize boot records. Then, user must modify bootlist to include: hdisk0 hdisk1. |
1
2
3
4
5
6
7
8
| # bootlist -m normal -o hdisk0 hdisk1 hdisk0 blv=hd5 hdisk1 # bosboot -a bosboot: Boot image is 35803 512 byte blocks. # bootlist -m normal -o hdisk0 blv=hd5 hdisk1 blv=hd5 |
Recovery positions, please
Let's now assume you have just installed the ML upgrade and rebooted, and issues have been found with the operational running of AIX. Remember, you currently have the disks in the following state:
1
2
3
| # lspv hdisk0 0041a97b0622ef7f rootvg active hdisk1 00452f0b2b1ec84c altinst_rootvg |
rootvg
: with post-upgrade issues.altinst_rootvg
: with good copy pre-upgrade.
Take me back
To get back to the pre-upgrade, simply change the bootlist to boot off the (altinst_rootvg) hdisk1, then reboot. It's that simple:
1
2
3
4
5
| # bootlist -m normal -o hdisk1 hdisk1 blv=hd5 # bootlist -m normal -o hdisk1 blv=hd5 # shutdown -Fr |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f old_rootvg hdisk1 00452f0b2b1ec84c rootvg active |
1
2
3
4
| # bosboot -a bosboot: Boot image is 35803 512 byte blocks. # bootlist -m normal -o hdisk1 blv=hd5 |
Post upgrade fixing
At a convenient time schedule that is agreed-upon with the end users, and with information provided by third-party support, you can then boot off the ML failed upgraded disk (hdisk0) and apply a fix that might solve the issue, so change the bootlist to boot off (old_rootvg) hdisk0 and reboot:
1
2
| # bootlist -m normal -o hdisk0 # shutdown -Fr |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f rootvg active hdisk1 00452f0b2b1ec84c altinst_rootvg |
After the system has been tested and signed off bring in hdisk1, use the commands described earlier:
#
1
| alt_rootvg_op -X altinst_rootvg |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| Bootlist is set to the boot disk: hdisk0 # extendvg -f rootvg hdisk1 # mirrorvg rootvg hdisk1 bootlist -m normal -o hdisk0 hdisk1 hdisk0 blv=hd5 hdisk1 # bosboot -a bosboot: Boot image is 35803 512 byte blocks. # bootlist -m normal -o hdisk0 blv=hd5 hdisk1 blv=hd5 # lspv hdisk0 0041a97b0622ef7f rootvg active hdisk1 00452f0b2b1ec84c rootvg active |
Waking the disk up
Within a cloned rootvg environment, you can wake up the cloned rootvg to be active. All cloned file systems from the cloned rootvg will be mounted. It is quite useful because you have a good running system, but at the same time mount the file systems from the cloned rootvg for further investigation or file modification. When a cloned rootvg is woken up, it is renamed to:
1
| altinst_rootvg |
Assume you have the disks in the following state:
1
2
3
| # lspv hdisk0 0041a97b0622ef7f old_rootvg hdisk1 00452f0b2b1ec84c rootvg active |
1
| alt_rootvg_op -W -d < hdisk > |
1
2
| # alt_rootvg_op -W -d hdisk0 Waking up old_rootvg volume group ... |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f altinst_rootvg active hdisk1 00452f0b2b1ec84c rootvg active |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| # df -m Filesystem MB blocks Free %Used Iused %Iused Mounted on /dev/hd4 128.00 102.31 21% 2659 11% / /dev/hd2 1968.00 111.64 95% 40407 58% /usr /dev/hd9var 112.00 77.82 31% 485 3% /var /dev/hd3 96.00 69.88 28% 330 3% /tmp /dev/hd1 208.00 118.27 44% 1987 7% /home /proc - - - - - /proc /dev/hd10opt 1712.00 1445.83 16% 6984 3% /opt /dev/alt_hd4 128.00 102.16 21% 2645 11% /alt_inst /dev/alt_hd1 208.00 33.64 84% 1987 21% /alt_inst/home /dev/alt_hd10opt 1712.00 1445.77 16% 6984 3% /alt_inst/opt /dev/alt_hd3 96.00 72.38 25% 335 2% /alt_inst/tmp /dev/alt_hd2 1968.00 100.32 95% 40407 59% /alt_inst/usr /dev/alt_hd9var 112.00 77.53 31% 477 3% /alt_inst/var |
1
| alt_rootvg_op -S -t < hdisk > |
1
2
3
4
5
6
7
8
9
10
11
12
| # alt_rootvg_op -S -t hdisk0 Putting volume group altinst_rootvg to sleep ... Building boot image on cloned disk. forced unmount of /alt_inst/var forced unmount of /alt_inst/usr forced unmount of /alt_inst/tmp forced unmount of /alt_inst/opt forced unmount of /alt_inst/home forced unmount of /alt_inst forced unmount of /alt_inst Fixing LV control blocks... Fixing file system superblocks... |
1
2
3
| # lspv hdisk0 0041a97b0622ef7f altinst_rootvg hdisk1 00452f0b2b1ec84c rootvg active |
altinst_rootvg
.It is sometimes good to go back to the original state of the disks to save confusion, especially if you have more than one cloned disk. So rename altinst_rootvg back to old_rootvg. The basic format is:
1
| alt_rootvg_op -v < new cloned rootvg name> -d < hdisk > |
1
2
3
4
| # alt_rootvg_op -v old_rootvg -d hdisk0 # lspv hdisk0 0041a97b0622ef7f old_rootvg hdisk1 00452f0b2b1ec84c rootvg active |
1
2
3
4
| # alt_rootvg_op -v bad_rootvg -d hdisk0 bash-2.05a# lspv hdisk0 0041a97b0622ef7f bad_rootvg hdisk1 00452f0b2b1ec84c rootvg active |
From this point, the system is now operational or not, depending on the success of the fix, using the commands described earlier.
If the fix worked on (old_rootvg) hdisk0, then run with the new ML version.
Confirm that the disk will boot off hdisk0:
1
| # bootlist -m normal -o hdisk0 |
1
| # shutdown -Fr |
1
| # alt_rootvg_op -X altinst_rootvg |
1
2
3
4
| # extendvg -f rootvg hdisk1 # mirrorvg rootvg hdisk1 # bosboot -a # bootlist -m normal -o hdisk0 hdisk1 |
Confirm that the disk will boot off hdisk1:
1
| # bootlist -m normal -o hdisk1 |
1
| # alt_rootvg_op -X old_rootvg |
1
2
3
4
| # extendvg -f rootvg hdisk0 # mirrorvg rootvg hdisk0 # bosboot -a # bootlist -m normal -o hdisk0 hdisk1 |
No comments:
Post a Comment