Growing a Solaris LDOM rpool
This is a procedure that might be useful if you ever have to grow a Solaris VTOC /SMI partition containing a rpool.
Change zfs volume from 20G to 25G
# zfs set volsize=25G rpool/ldoms/sol11_gold/disk0 # zfs get volsize rpool/ldoms/sol11_gold/disk0 NAME PROPERTY VALUE SOURCE rpool/ldoms/sol11_gold/disk0 volsize 25G local
Procedure if existing label is a VTOC / SMI
Inside the guest record the current VTOC. You could possibly recover using fmthard.
root@solaris:/root# prtvtoc /dev/rdsk/c2d1s0 * /dev/rdsk/c2d1s0 partition map * * Dimensions: * 512 bytes/sector * 768 sectors/track * 96 tracks/cylinder * 73728 sectors/cylinder * 568 cylinders * 566 accessible cylinders * * Flags: * 1: unmountable * 10: read-only * * Unallocated space: * First Sector Last * Sector Count Sector * 0 73728 73727 * * First Sector Last * Partition Tag Flags Sector Count Sector Mount Directory 0 2 00 73728 41656320 41730047 2 5 01 0 41730048 41730047
Use format > verify and record the output
Primary label contents: Volume name = < > ascii name = pcyl = 568 ncyl = 566 acyl = 2 nhead = 96 nsect = 768 Part Tag Flag Cylinders Size Blocks 0 root wm 1 - 565 19.86GB (565/0/0) 41656320 1 unassigned wm 0 0 (0/0/0) 0 2 backup wu 0 - 565 19.90GB (566/0/0) 41730048 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 unassigned wm 0 0 (0/0/0) 0 7 unassigned wm 0 0 (0/0/0) 0
Change label to EFI using format -e
root@solaris:/root# format -e format> label [0] SMI Label [1] EFI Label Specify Label type[0]: 1 Warning: This disk has an SMI label. Changing to EFI label will erase all current partitions. Continue? y
Change label back using format -e
format> label [0] SMI Label [1] EFI Label Specify Label type[1]: 0
Next recreate the initial partitions. Check that the cylinder size of the disk geometry hasn't changed. If it has changed then you will be unable to recreate the initial partitions.
Run format > verify and check that "nhead" and "nsect" are the same as before the geometry was changed (from the format > verify output that was initially saved)
Partition table before fixing it
format> verify Warning: Primary label on disk appears to be different from current label. Warning: Check the current partitioning and 'label' the disk or use the 'backup' command. Primary label contents: Volume name = < > ascii name = pcyl = 711 ncyl = 709 acyl = 2 nhead = 96 nsect = 768 Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 3 144.00MB (4/0/0) 294912 1 swap wu 4 - 7 144.00MB (4/0/0) 294912 2 backup wu 0 - 708 24.93GB (709/0/0) 52273152 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 usr wm 8 - 708 24.64GB (701/0/0) 51683328 7 unassigned wm 0 0 (0/0/0) 0
Recreate the partition table based on your original verify. Leave slice 2 as is.
partition > pr Current partition table (unnamed): Total disk cylinders available: 709 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 1 - 565 19.86GB (565/0/0) 41656320 1 unassigned wu 0 0 (0/0/0) 0 2 backup wu 0 - 708 24.93GB (709/0/0) 52273152 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 unassigned wm 0 0 (0/0/0) 0 7 unassigned wm 0 0 (0/0/0) 0 partition > label Ready to label disk, continue? y partition > q
**** I think I should have made slice the full 24G not the original 19G. I will verify his is a future test.
root@solaris:/root# sync root@solaris:/root# reboot
**** Could not get the rpool to see the larger slice. Booted DVD and changed slice to the full size 24GB of the disk. That still did not fix it so lets try booting a Solaris 11 DVD and import/export the rpool.
root@solaris:/root# zpool import rpool root@solaris:/root# zpool status pool: rpool state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 c2d1s0 ONLINE 0 0 0 errors: No known data errors root@solaris:/root# zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 24.9G 5.32G 19.6G 21% 1.00x ONLINE - root@solaris:/root# zpool export rpool
Reboot and guest is seeing larger rpool
root@solaris:~# zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 24.9G 5.32G 19.6G 21% 1.00x ONLINE -