This technical document describes a procedure to increase the root file system (slice), where the root disk is encapsulated under VERITAS Volume Manager (tm). It is acknowledged that there may be other ways to achieve this objective. It is also possible that the procedure described may not fully apply to every system running Volume Manager, but is likely that the procedure may be adopted with some changes to suit most of the common Volume Manager configurations and installations.
Assumptions:
The boot (root) disk is encapsulated.
The root diskgroup (rootdg) may consist of more than one disk.
One free disk with at least as much capacity as the current root disk.
Preliminary details:
If the free disk required for this procedure is only as big as the current root disk, then there must be enough free space on the root disk to allow for the increased root file system size. If this free space is not available on the disk, then the proposed increase to the root file system size must come from a corresponding reduction in the size, or omission of some other file system (or partition) on the root disk.
The free disk described in this procedure is used to prepare a new root disk with the necessary file system (slice) sizes. The original root disk can be preserved at least until the system boots from the new root disk successfully.
The general procedure to accomplish this task is as follows:
- Initialize new root disk and add to rootdg diskgroup
- Mirror root volume onto new disk from current root disk
- Increase size of root volume and file system
- Mirror other volumes from current root disk
- Break mirrors on new root disk
- Create underlying physical partitions on disk
- Create swap partition on disk
- Reboot system off slices from new root disk
- Remove volumes from old root disk
- Encapsulate new root disk and add to rootdg disk group
- Reboot off new root disk using volumes
- Mirror new root disk to another equivalent disk
If the new root disk is the same size as the original root disk, then upon successful encapsulation of the new root disk, it is possible to mirror back to the original root disk, thereby having two identical mirrors. If the new root disk is of larger capacity, then another disk of equivalent size will be necessary for the root mirror.
In the detailed procedure listed below, the rootdg initially consists of the boot disk (rootdisk=c2t8d0) and one additional disk (root0=c2t3d0) containing Volume Manager volumes. The procedure would be unchanged even if the boot disk has a mirror. The new disk that will eventually become the boot disk is c2t2d0.
Detailed procedure
1. Initialize new disk:
Is new disk same size as current boot disk?
Yes
Is Volume Manager version 3.2?
Yes
Check private region length for boot disk using prtvtoc command. Here, c2t8d0 is the root disk.
# prtvtoc /dev/rdsk/c2t8d0
Slice 7 (tag 15) is the vtoc entry representing the private region. Note the sector count of 2744. This will be the public region offset for the new disk.
Initialize the new disk (c2t2d0) using the vxdisksetup command.
# /etc/vx/bin/vxdisksetup -i c2t2d0 puboffset=2744
Go to step 2.
No (Volume Manager version < 3.2)
Initialize the new disk (c2t2d0) using the vxdisksetup command.
# /etc/vx/bin/vxdisksetup -i c2t2d0
Go to step 2.
No (new disk of higher capacity)
Initialize the new disk (c2t2d0) using the vxdisksetup command.
# /etc/vx/bin/vxdisksetup -i c2t2d0
2. Add new disk to rootdg. In this example, the disk is named newroot (c2t2d0).
# vxdg -g rootdg adddisk newroot=c2t2d0
The rootdg configuration now looks as follows.
# vxdisk list
# vxprint -Qqhtg rootdg
3. Mirror the root slice to disk newroot.
# /etc/vx/bin/vxrootmir newroot
Check rootvol details.
# vxprint -Qqhtr rootvol
4. A series of steps to increase size of the root slice on the new disk.
Disassociate the newly created plex rootvol-02 from rootvol volume.
# vxplex dis rootvol-02
Make a volume named rootalt with usage type "gen" and associate plex rootvol-02.
# vxmake -U gen vol rootalt plex=rootvol-02
Make the volume active.
# vxvol init active rootalt
Volume rootalt, as it appears now.
# vxprint -Qqhtr rootalt
Run a file system check on the "ufs" file system contained within volume rootalt. Fix the file system state in the super block and any other errors encountered. This will clear the file system super-block flag and enable us to mount the file system.
# fsck -F ufs /dev/vx/rdsk/rootdg/rootalt
Mount the rootalt volume on /mnt (or /a)
# mount -F ufs /dev/vx/dsk/rootdg/rootalt /mnt
Estimate the new size for the root slice (rootalt). The new size must be such that the sub-disk ends on a disk cylinder boundary. In this example, the rootvol (and the newly created mirror volume, rootalt) is 4195576 disk sectors long (1 disk sector = 512 bytes). This translates to a size that is marginally over 2 GB. This size will be increased by 500 MB to a new size that is roughly 2.5 GB.
# prtvtoc /dev/rdsk/c2t2d0s2
From the above, it is clear that the root partition size of 4195576 sectors corresponds to 3058 disk cylinders (4195576 sectors / 1372 sectors per cylinder = 3058 cylinders).
The proposed increase is 500 MB. This translates to approximately 746 disk cylinders. The calculation for this being as follows:
500 MB = 500 * 1024 KB = 512000 KB = 512000 * 2 disk sectors = 1024000 disk sectors
1024000 sectors / 1372 sectors per cylinder = 746.35 cylinders.
In this discussion, the figure has been rounded down to 745 cylinders. This means that the new size for the root volume will be 3803 cylinders (3058 + 745). This translates to a size of 5217716 sectors (3803 cylinders * 1372 sectors per cylinder).
Increase size of volume rootalt and the file system to the new size.
# vxassist growto rootalt 5217716
Increase the size of the "ufs" file system to the new size.
# /usr/sbin/growfs -M /mnt /dev/vx/rdsk/rootdg/rootalt
Verify the size of the rootalt volume
# vxprint -Qqhtr rootalt
The new root file system (mounted on /mnt) shows increased file system size.
# df -k
5. Re-write the disk slice information that represents the sub-disk (newroot-01) for volume rootalt.
The current entry (see the prtvtoc command output at step 4, slice 0) contains the old size.
# /etc/vx/bin/vxmksdpart -g rootdg newroot-01 0 0x2 0x0
(command usage: vxmksdpart -g disk-group sub-disk disk-partition tag-in-hexadecimal flag-in-hexadecimal)
Now, the slice information for disk newroot (c2t2d0) is:
# prtvtoc -s /dev/rdsk/c2t2d0s2
6. Delete the rootalt volume from the new root disk.
# cd /
# umount /mnt
Stop the volume.
# vxvol stop rootalt
Disassociate the plex from the volume and remove the volume.
# vxplex dis rootvol-02
# vxedit rm rootalt
Disassociate the sub-disk from the plex and remove the plex.
# vxsd dis newroot-01
# vxedit rm rootvol-02
7. Mirror all the other volumes from the current root disk to the new root disk.
Do not mirror swap volumes. Swap slices will be created on the new disk manually.
In this example, the volumes to mirror are var and opt.
# vxassist -g rootdg mirror var newroot
# vxassist -g rootdg mirror opt newroot
The rootdg diskgroup now looks like this.
# vxprint -Qqhtg rootdg
8. Create the underlying physical partition for each of these volumes, using the vxmksdpart command.
From the sub-disks for the var and opt volumes on the new root disk, create the vtoc entries.
# /etc/vx/bin/vxmksdpart -g rootdg newroot-02 5 0x7 0x0
# /etc/vx/bin/vxmksdpart -g rootdg newroot-03 6 0x0 0x0
9. Remove all plexes and sub-disks from the new root disk.
Remove the disk from the rootdg disk group and take the disk out of Volume Manager control.
Remove the plexes first.
# vxplex -o rm dis var-02
# vxplex -o rm dis opt-02
Remove the only remaining sub-disk next.
# vxedit rm newroot-01
Remove the disk from rootdg.
# vxdg -g rootdg rmdisk newroot
Take the disk out of Volume Manager control.
# /etc/vx/bin/vxdiskunsetup c2t2d0
10. Using the Solaris format command, create a disk partition for swap on the new root disk.
The size of this partition may be adjusted according to the requirements of the system.
In this example, slice 1 has been used for the swap partition.
In case the new root disk has unallocated space at the end of the disk, create a dummy slice that uses up that space. If this is not done, then the private region uses space from the end of the disk when the disk is encapsulated at step 14. Since we already have free space at the beginning of the disk that was being used for the private region when this disk was under Volume Manager control (see prtvtoc output of disk at step 5), we may not want this space to be wasted. Please note that adding this dummy slice is not essential. The only purpose is to make use of the space already available at the beginning of the disk for the private region. The dummy volume created due to the encapsulation at step 14 may be deleted. The volume table of contents (VTOC) on the new root disk looks as shown below:
# prtvtoc -s /dev/rdsk/c2t2d0s2
Slice 0=root slice, slice 1=swap, slice 5=var, slice 6=opt, slice 7=dummy slice
11. Perform a file system check on all partitions containing file systems. In this example, there are three "ufs" file systems.
Clear the super-block flag for the file systems and any other errors encountered.
# fsck -F ufs /dev/rdsk/c2t2d0s0
# fsck -F ufs /dev/rdsk/c2t2d0s5
# fsck -F ufs /dev/rdsk/c2t2d0s6
12. Mount the root slice from the new disk on to /mnt and edit the /etc/system and /etc/vfstab files.
# mount -F ufs /dev/dsk/c2t2d0s0 /mnt
Edit the etc/system file and comment out the lines relevant to Volume Manager boot off encapsulated boot disks.
# vi /mnt/etc/system
Comment out the following two lines by placing an asterisk in the first column and then save the file.
Make a copy of etc/vfstab file and then edit the file. For all the file systems and swap volumes on the current root disk, change volume devices to disk partition devices (slices on new boot disk). Save the edited file.
# cd /mnt/etc
# cp vfstab vfstab.orig
# vi vfstab
In this example, the vfstab looks like this:
Unmount the root slice on the new boot disk.
# cd /
# umount /mnt
13. Take system to "ok" prompt and then boot off the new boot disk.
# init 0
ok> devalias
From the devalias output, select the new boot disk device alias. In our case, this is represented by the vx-newroot alias (a reset command may be required for the alias to be visible).
ok> boot vx-newroot
After the system has rebooted off the slices on the new boot disk, the file system mounts look as follows:
# df -k
Please note that although the system has used the new boot disk to boot off slices, Volume Manager is still able to start up due to the presence of the rootdg diskgroup. All rootdg volumes are started. However, due to the changes made to the vfstab file (at step 13), none of the file systems on the volumes in the old root disk should be mounted.
14. Encapsulate the new root disk and add it to the rootdg diskgroup.
Before we remove the original root disk from the rootdg diskgroup, it may be best to ensure that the underlying physical partitions exist for the volumes on that disk. By ensuring this, we can revert back to using that disk if necessary. Use the prtvtoc command to check for current slice information for the old root disk. Missing slices may be added to the disk VTOC using the vxmksdpart command (please see previous examples at steps 5 and 9).
Remove all volumes from the old root disk (and its mirrors, if any).
# vxassist -g rootdg remove volume rootvol
# vxassist -g rootdg remove volume swapvol
# vxassist -g rootdg remove volume var
# vxassist -g rootdg remove volume opt
Rename the old root disk. In this example, rootdisk is being renamed as rootold.
# vxedit -g rootdg rename rootdisk rootold
Encapsulate the new root disk (c2t2d0).
# /etc/vx/bin/vxencap rootdisk=c2t2d0
Set the default system boot device to be the new root disk. In our example, a device alias called vx-newroot already exists for the new disk.
# /etc/vx/bin/vxeeprom boot-device vx-newroot
Reboot the system. It will reboot twice, and come up on volumes on the new root disk.
# shutdown -g0 -y -i6
Examining the file systems mounted after the reboot, we can see volumes being used instead of slices.
# df -k
Remove the old root disk (and mirror disk, if applicable) from the rootdg diskgroup.
# vxdg -g rootdg rmdisk rootold
The disks on the system now appear as follows:
# vxdisk list
The rootdg diskgroup now consists of all the original volumes.
# vxprint -Qqhtg rootdg
In the output, note the volume rootdisk7vol. This volume has been created on account of the dummy slice that was added at step 10. This volume may be deleted as it does not contain any useful information.
# vxassist remove volume rootdisk7vol
The new root disk's VTOC looks as follows.
# prtvtoc -s /dev/rdsk/c2t2d0s2
15. If the new root disk is to be mirrored, ensure that a disk of at least similar capacity is available for the mirror.
You could, for example, replace the old boot disk with a new disk that is the same size as the new root disk.
In case a new disk will be used for the mirror, follow the steps described at step 1 (substitute the literal "new disk" with "mirror disk") to initialize the disk. Add the disk to the rootdg diskgroup.
Mirror all volumes on the boot disk to mirror disk (rootmir).
# /etc/vx/bin/vxmirror rootdisk rootmir
At the conclusion of the above steps, we are left with a running Volume Manager configuration with an expanded root volume.x