re-label gpt partitions for zpool

I've been trying to decide on a naming convention for my drives in my zroot setup for FreeBSD/ZFS. I've finally settled on a device labeling convention, however I'd like to spare myself the nasty business of re-installing if I could. I was wondering if it were possible to re-label my devices in my zpool.

Currently I have the following:

Code:
root@head1:/root # zpool status -v
  pool: zroot
 state: ONLINE
  scan: none requested
config:

        NAME                   STATE     READ WRITE CKSUM
        zroot                  ONLINE       0     0     0
          mirror-0             ONLINE       0     0     0
            gpt/h1slot00-root  ONLINE       0     0     0
            gpt/h1slot01-root  ONLINE       0     0     0

errors: No known data errors

I want to re-label the gpt/h1slot00-* devices, of which there are:

Code:
h1slot00-boot
h1slot00-root
h1slot00-swap
h1slot01-boot
h1slot01-root
h1slot01-swap

I'd like the convention headX-slotXX so my results should be:

Code:
head1-slot00-boot
head1-slot00-root
head1-slot00-swap
head1-slot01-boot
head1-slot01-root
head1-slot01-swap

and

Code:
root@head1:/root # zpool status -v
  pool: zroot
 state: ONLINE
  scan: none requested
config:

        NAME                       STATE     READ WRITE CKSUM
        zroot                      ONLINE       0     0     0
          mirror-0                 ONLINE       0     0     0
            gpt/head1-slot00-root  ONLINE       0     0     0
            gpt/head1-slot01-root  ONLINE       0     0     0

errors: No known data errors

Generally speaking, given I'm using ZFS for my root, I think I can do this (albeit dangerously) while I'm online. I should be able to:
  • offline the device:
    zpool offline zroot gpt/h1slot00-root
  • relabel the partition (which in my case is 1 for boot; 2 for swap, and 3 for the root):
    gpart modify -i 3 -l head1-slot00-root daX
  • replace the device:
    zpool replace zroot /dev/gpt/h1slot00-root /dev/gpt/head1-slot00-root
  • Wait for resilvering... and then repeat on the other device.
Would this be correct?

After that, performing a swapoff -a for the h1slot0X-swap removal should allow me to re-label those... and then modify /etc/fstab with the new names, and swapon -a to restore them.

And finally, what about the boot partitions? Do I just re-label them? I don't see any evidence that they're mounted or in operation. Is this normal?

Thanks for the help
 
So aside from the bug which is causing me to reboot the system, I have found that I can do the following:

Code:
zpool remove zroot <device>
gpart modify -i 3 -l headX-slotXX-_____ daXX
reboot
---
zpool attach zroot <other dev> /dev/gpt/headX-slotXX-_____

And then wait for resilvering.

As for my swap devices, I turned swap off, re-labeled them, modified /etc/fstab, rebooted, and I was all good to go.

About my only remaining question is about the boot partitions that I have... can I just freely re-label those and there's nothing else to do? Will I need to:
Code:
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 daXX
 
Don't use replace on mirror vdevs. just zpool detach the drive, relabel the drive, and zpool attach it to the other drive. That breaks the mirror, then creates a new mirror.

Wait for the resilver to finish, and repeat the process with the other drive.

No reboot required.
 
mengesb said:
Heh, then of course being on FreeBSD 9.1-RELEASE, I found bug 177080, so I'm guessing a reboot is required after all!

So I did notice the attach, and detach - however the above bug is preventing me from doing this 100% online with the root booting pool.
 
Back
Top