3

I have a FreeBSD 11 machine which has three physical drives in a ZFS mirror, encrypted with GELI. All of this was basically magically set up by the FreeBSD installer when I first built the machine, so I had very little input on it or knowledge about the details of it.

SMART has started to report some errors on one of the drives. It is not dead yet, but I want to add a new drive to the mirror and then remove the old drive before it actually fails. After some googling, I think I have some grasp on how to do most of this, but I want to run it all past people to make sure I'm not doing something wrong or omitting something. Plus, more specifically, I'm really unsure about the swap part (which is also encrypted).

Each of my three current drives (ada0, ada1, ada2) looks like this in gpart show:

=>        40  1953525088  ada0  GPT  (932G)
          40        1024     1  freebsd-boot  (512K)
        1064         984        - free -  (492K)
        2048    50331648     2  freebsd-swap  (24G)
    50333696  1903190016     3  freebsd-zfs  (908G)
  1953523712        1416        - free -  (708K)

zpool status:

  pool: zroot
 state: ONLINE
  scan: scrub repaired 0 in 2h7m with 0 errors on Mon Feb 20 14:43:08 2017
config:

    NAME            STATE     READ WRITE CKSUM
    zroot           ONLINE       0     0     0
      mirror-0      ONLINE       0     0     0
        ada0p3.eli  ONLINE       0     0     0
        ada1p3.eli  ONLINE       0     0     0
        ada2p3.eli  ONLINE       0     0     0

/etc/fstab:

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/mirror/swap.eli            none    swap    sw              0       0

swapinfo:

Device          1K-blocks     Used    Avail Capacity
/dev/mirror/swap.eli  25165820   142220 25023600     1%

gmirror status:

       Name    Status  Components
mirror/swap  COMPLETE  ada0p2 (ACTIVE)
                       ada1p2 (ACTIVE)
                       ada2p2 (ACTIVE)

So, I think I do the following:

(1) Physically install the new drive.

(2) Maybe do SMART checks on it, maybe populate it with random data.

(3) gpart destroy, gpart create, and gpart add, giving it essentially the same layout as gpart show shows for my other drives - boot, free, swap, zfs, free. One difference is that I intentionally purchased a larger drive so that as I gradually replace failing drives, eventually I'll naturally have more space in the pool. So I make the freebsd-zfs partition larger than on the existing drives, even though much of it will be unusable until I eventually replace all of the current smaller drives (right?). And I should make sure to keep some significant free space at the end to account for the possibility of slightly different drive sizes for future drives (right?).

(4) geli init the freebsd-zfs partition. Specific minor question here: Right now, all three of my physical drives have the same GELI password. When the machine boots, I am only asked for one password, rather than one for each drive. I like this. If I use the same password again for the new drive, will this magically happen, or do I have to somehow tell FreeBSD that the booting process should try the one password that I enter for this new drive, too?

(5) geli attach to the freebsd-zfs partition.

(6) zpool attach the new encrypted partition; something like zpool attach zroot ada0p3.eli ada3p3.eli

(7) I gather that FreeBSD will now tell me to run gpart bootcode on the new drive. Do so.

(8) Wait for resilvering to complete.

(9) Physically remove the old drive. After rebooting, remove it from the zpool too.

I... guess that's what I do? But, like I said above, I'm not at all sure about the swap. Does it just somehow magically become part of /dev/mirror/swap.eli? Do I have to add it somehow? Similarly, does the old drive's swap space just magically disappear? Do I have to remove it somehow?

Thanks in advance for any help.

1

Answering my own questions for future reference:

(1) Generally speaking, everything in my plan worked fine.

(2) For the swap, I wound up adding the new swap partition via gmirror insert, and removing the old one via gmirror remove.

(3) Regarding the minor password question: I used the same password for the new disk, and (without having done anything further) I still only have to enter it once at boot time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.