Solaris 10: How to remove devices from a zpool with /usr currently mounted

solariszfs

I use Solaris 10 on SPARC. I have /usr legacy mounted on a zpool 'usr-pool'.

I now need to move some of the devices in usr-pool to another zpool which is running out of room.

What is the safest way for me to do this? I already know that (since my zpool is not mirrored) I need to destroy and recreate the zpool. I know how to backup and restore a zfs snapshot. However… I'm stumped on how to unmount usr-pool without losing access to the commands I need on /usr to complete the backup/restore.

Cursory research indicated that I should boot to OpenBoot (init 0) and then 'boot cdrom -s'. I did this but none of the zpools are accessible on that runlevel.

I also read I could just copy /usr to another location, symlink /usr to that location, then do my backup/restore. Is that safe to do?

I would appreciate some guidance.

S.

Best Answer

Unfortunately ZFS does not currently support shrinking the pool.

Since you already mentioned that your intention is to destroy and recreate the pool, here's what to do. But first...

WARNING: DESTROYING YOUR POOLS WILL DESTROY YOUR DATA. YOUR BLOOD IS ON YOUR OWN HEAD.

Now, with that out of the way:

  1. Create a new pool mounted on /usr-new
  2. Use zfs-send from a snapshot of usr-pool to usr-new (You also need to account for any descendent datasets).
  3. zfs unmount usr-new.
  4. Change the mountpoint of usr-new to /usr (it may complain, but should work. Check with zfs get mountpoint usr-new)
  5. Set usr-pool (i.e., the old one) to use legacy mounting with zfs set mountpoint=legacy usr-pool (this will cause it to not be auto mounted at boot but also not immediately unmount it).
  6. Reboot.

You'll boot up with the new usr-new mounted on /usr and the old usr-pool not mounted. You are then free to destroy usr-pool and reuse disks as necessary.

Related Topic