Resize the ZFS Root Pool
Posted in Solaris, System Administration on 06/18/2009 12:00 pm by jmccune
I originally installed OpenSolaris 2008.11 on my home media server, and 2009.06 has some features I’d like to take advantage of. Running a pkg image-update, I ran my root pool out of space since it’s located on a relatively small compact flash card.
I decided to grow the root pool by using an available external disk I have. The process involves attaching the new, larger disk to the root pool as a mirror, waiting for the resilver process to complete, installing the boot loader onto the new disk, then detaching the old, small device from the root pool. This information is documented at sun.com in the document How to Replace a Disk in the ZFS Root Pool.
Attempting to attach the new device to the pool with zpool attach, I ran in the error message "cannot label 'c3t0d0': EFI labeled devices are not supported on root pools." I tried wiping the EFI label, but kept running into the same error. I noticed other people talking about this issue;
Removing EFI (format -e not working?) and
Please help need to remove EFI label: msg#00173
My problem was that I was not properly creating the root partition on the disk with an SMI label. I was properly using format -e, then executing “fdisk”, creating the VTOC on the entire disk, but I forgot the step where once the VTOC is created, you need to create partition 0, which will be used for the zpool vdev.
If you run into this error, make sure you use the “partition” option in fdisk -e, which will allow you to then define slice 0. Label the slice “root” and give it as much space as you’d like. Make sure it does not overlap with the boot slice which is automatically created when the VTOC is created.
Once slice 0 is present, use c1t0d0s0 rather than c1t0d0 when you attach the new disk to the root pool. For example:
Correct:
zpool attach rpool c4t0d0s0 c3t0d0s0
Incorrect:
zpool attach rpool c4t0d0s0 c3t0d0
If you receive an error about overlapping partitions, just use zpool attach -f to force the attach.
Once the device is in the pool and re-silvering, use installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c3t0d0s0 to install the boot block.
After testing the new boot device, use zpool detatch rpool c4t0d0s0 to remove the old device from the pool and complete the resize process.
Here’s my original partition layout:
Current partition table (original): Total disk cylinders available: 3820 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 1 - 3818 7.46GB (3818/0/0) 15638528 1 unassigned wm 0 0 (0/0/0) 0 2 backup wu 0 - 3819 7.46GB (3820/0/0) 15646720 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 8 boot wu 0 - 0 2.00MB (1/0/0) 4096 9 unassigned wm 0 0 (0/0/0) 0
Here’s my new, larger disk layout:
Current partition table (original): Total disk cylinders available: 60797 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 boot wm 1 - 60700 929.97GB (60700/0/0) 1950291000 1 unassigned wm 0 0 (0/0/0) 0 2 backup wu 0 - 60796 931.46GB (60797/0/0) 1953407610 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 8 boot wu 0 - 0 15.69MB (1/0/0) 32130 9 unassigned wm 0 0 (0/0/0) 0
After detaching the original, small disk from the mirror, the root pool expands to the size of the remaining vdev:
jmccune@rain:~$ zpool list rpool NAME SIZE USED AVAIL CAP HEALTH ALTROOT rpool 930G 5.57G 924G 0% ONLINE -










Slides from Nigel and my Macworld 2009 presentation are now available online.