About a month ago I migrated my Ultra 20’s root filesystem from UFS to ZFS using my HOWTO: Migrate a UFS Root Filesystem to ZFS procedure. Today I performed my first live upgrade since, which worked a treat, however now I’m running a bit low on space.

Not for much longer…

Following the live upgrade my root pool is looking a little on the leaner side of how I’d like it:

# zfs list
NAME                    USED  AVAIL  REFER  MOUNTPOINT
rootpool               8.51G  1.33G    35K  /rootpool
rootpool/ROOT          7.00G  1.33G    18K  /rootpool/ROOT
rootpool/ROOT/snv_99   6.93G  1.33G  4.23G  /
rootpool/ROOT/snvz_98  71.7M  1.33G  4.08G  /.alt.tmp.b-TM.mnt/
rootpool/dump          1.00G  1.33G  1.00G  -
rootpool/swap           512M  1.54G   297M  -
#

My rootpool is currently made up of a single 10GB slice which was one of the two slices on the same disk that I used to flip-flop between as I live upgraded the system whilst it was still on UFS.

As I no longer need to do this, thanks to ZFS and the now ZFS aware live upgrade (it uses snapshots and clones), I thought I’d add my now redundant extra slice to the rootpool.

My first thought was: “I’ll just run zpool add and add the slice“, which I attempted, however ZFS didn’t like this idea:

# zpool add -f rootpool c1d0s4
cannot add to 'rootpool': root pool can not have multiple vdevs or separate logs
#

So I thought: “Well ZFS isn’t like UFS in that it doesn’t actually lay a filesystem on the entire disk, so in theory if I just change the underlying partitions, they’re contiguous, ZFS should pick it up“.

Well, I thought they were contiguous. As luck would have it, they were separated by a now redundant swap slice, so I blitzed that and merged the 3 into a single slice, without changing the starting cylinder of my original slice, and rebooted.

Update: As Mr Zog commented, I neglected to say exactly what I did here, so here’s what I did when I “blitzed that and merged the 3 into a single slice“:

I used format(1M) to repartition the disk by going to format -> [select the disk] -> partition. I then deleted the old swap slice (slice 1) and the slice I was trying to add (slice 4) and grew the original root slice (slice 0) by specifying the new final cylinder (the final cylinder of the old slice 4).

Hey presto!!!

ZFS has detected this and I now have a much larger root pool, and a lot less wasted space on the disk too:

# zfs list
NAME                    USED  AVAIL  REFER  MOUNTPOINT
rootpool               8.52G  13.1G    35K  /rootpool
rootpool/ROOT          7.00G  13.1G    18K  /rootpool/ROOT
rootpool/ROOT/snv_99   6.93G  13.1G  4.23G  /
rootpool/ROOT/snvz_98  71.7M  13.1G  4.08G  /.alt.tmp.b-TM.mnt/
rootpool/dump          1.00G  13.1G  1.00G  -
rootpool/swap           512M  13.3G   297M  -
#

7 Responses to “Growing a ZFS Root Pool”  

  1. 1 Matt

    I did this too..and it worked! except that all i did was expand a freshly-installed ZFS root slice by stealing some cylinders from the giant chunk of unallocated space and tacking it on. amazing. thanks for the tip!

  2. 2 Mr Zog

    Hi.

    For people like me who are mostly ignorant of Solaris, you did not explain -how- to do anything.

    You showed us what -failed-: # zpool add -f rootpool c1d0s4

    Maybe you should show us what worked.

    – Zog

  3. 3 Colin

    Good point Zog. I neglected to say how I “blitzed that and merged the 3 into a single slice, without changing the starting cylinder of my original slice”. This was done by adjusting the partition table with format(1M): format -> [select the disk] -> partition.

    I’ve added an update note to the main details.

    Thanks for pointing out I wasn’t particularly clear.

  4. 4 KN

    Mine was the same case but the swap was at starting so i tried to expand the root slice towards starting .. but i got error while labeling it Cannot label disk when partitions are in use as described. as my rootslice is mounted as zfs root .. is there any work around for this ?

  5. 5 Colin

    I don’t believe you’ll be able to grow the slice successfully that way, but I’ve never tried it so could be wrong.

    You may be able to relabel your disk by preventing Solaris from performing the “in use check” by setting the NOINUSE_CHECK env variable to 1, eg # NOINUSE_CHECK=1; format

  6. 6 m.com

    Very confusing, specially the post of ZOG is NOT ANSWERED !
    # zpool add -f rootpool c1d0s4 didn’t work, ok.

    I then deleted the old swap slice (slice 1) and the slice I was trying to add (slice 4) and grew the original root slice (slice 0) by specifying the new final cylinder (the final cylinder of the old slice 4).

    How dpes it mean in

    # zpool add …… ?!?

    Just try to explain what to remove, and what las slice of the second …

    Sorry, but this not clear.

  7. 7 Colin

    M: I’m sorry if it’s not clear to you. I’ve not detailed exactly what to do in format(1M) because it’s a commonly used tool that is also well documented in chapters 11 and 12 of the “System Administration Guide: Devices and File Systems” guide on docs.sun.com.

Speak Your Mind    cocomment icon