1

I have a HP microserver gen8 running FreeBSD with mirrored boot media: one USB stick (16GB) and one microSD card (16GB). The stick recently showed checksum errors, so I replaced it, but I only had a 32GB stick at hand. After resilvering, zpool seems to be content but I cannot write the bootcode and gpart does not even recognize the media.

In detail.

This is the zpool status when the problem arose:


Checking status of zfs pools:
NAME           SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
freenas-boot  14.5G   791M  13.7G         -      -     5%  1.00x  ONLINE  -
freising       928G  84.6G   843G         -     6%     9%  1.00x  ONLINE  /mnt

  pool: freenas-boot
 state: ONLINE
status: One or more devices has experienced an unrecoverable error.  An
        attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
        using 'zpool clear' or replace the device with 'zpool replace'.
   see: http://illumos.org/msg/ZFS-8000-9P
  scan: scrub repaired 213K in 0h15m with 0 errors on Thu Mar 23 04:00:56 2017
config:

        NAME        STATE     READ WRITE CKSUM
        freenas-boot  ONLINE     0     0     0
          mirror-0  ONLINE       0     0     0
            da0p2   ONLINE       0     0     3
            da1p2   ONLINE       0     0     0

errors: No known data errors

I powered the machine down, replaced the stick with a 32GB one, rebooted. zpool status yielded:


        NAME                     STATE     READ WRITE CKSUM
        freenas-boot             DEGRADED     0     0     0
          mirror-0               DEGRADED     0     0     0
            3278622582862864884  UNAVAIL      0     0     0  was /dev/da0p2
            da1p2                ONLINE       0     0     0

Fine, so I told zpool to use the new media:


sudo zpool replace freenas-boot 3278622582862864884 /dev/da0 

(zpool didn't let me use '/dev/da0p2')

It took about 8 hours to resilver the thing, now zpool seems to be happy:


sudo zpool status -xv
all pools are healthy

But I cannot write the bootcode:


sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
gpart: No such geom: da0.

gpart does not even recognize the new stick:


sudo gpart status
  Name  Status  Components
ada0p1      OK  ada0
ada0p2      OK  ada0
ada1p1      OK  ada1
ada1p2      OK  ada1
 da1p1      OK  da1
 da1p2      OK  da1

What would be the best way to proceed? I am quite uncertain what I should control via gpart and what is better left to zfs and its magic.

patmin
  • 117
  • 1
  • 10

2 Answers2

0

If you still have the old stick, you could use it. Checksum errors, especially on low counts like 3 in your case, are nothing to worry about. They could be the result of a flaky cable connection or a forced removal of the device, or sudden power loss or reconnect (especially with USB, which was designed for frequent removal instead of perfect stability).

So, if you just experienced those errors once (and no write or read errors), and still have a healthy mirror, I would personally continue to use the old device that is already setup properly for booting. You can replace a device with itself by specifying its name twice: zpool replace poolname device device, or just clear the errors with zpool clear poolname. Unless it happens again, I would not throw away a functioning device.

user121391
  • 577
  • 5
  • 16
0

I meanwhile figured out how to use gpart to create a partition for the bootcode and another for the data before adding the latter to the pool (assuming the new device is /dev/da2):

sudo gpart show da2
sudo gpart delete -i 1 da2
sudo gpart destroy da2
sudo gpart create -s gpt da2
sudo gpart add -s 512K -t bios-boot da2
sudo gpart add -s 15G -t freebsd-zfs da2
sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da2
sudo zpool attach freenas-boot da1p2 da2p2

However, I managed to get myself into new trouble in the process: repairing misconfigured mirrored zfs pool

Community
  • 1
  • 1
patmin
  • 117
  • 1
  • 10