Saturday, 4 January 2025

FreeBSD mirror error: "geom: Not all disks connected"

Whilst copying data to my FreeBSD RAID1 mirror, one of the disks errored:

Jan 4 07:08:44    freenas     kernel: GEOM_MIRROR: Device RAID1: provider ad0 disconnected.
Jan 4 07:08:44    freenas     kernel: GEOM_MIRROR: Request failed (error=5). ad0[WRITE(offset=1632316556288, length=131072)]
Jan 4 07:08:44    freenas     kernel: ad0: FAILURE - WRITE_DMA48 status=51<READY,DSC,ERROR> error=10<NID_NOT_FOUND> LBA=3188118402

I also got this error:
 "geom: Not all disks connected."

ad0 had errored, leaving the RAID operating only with ad1.
The solution was posted here:

gmirror forget RAID1

gmirror status
      Name    Status  Components
            mirror/RAID1  COMPLETE  ad1

gmirror remove RAID1 /dev/ad0
gmirror: No such provider: ad0.

gmirror insert RAID1 /dev/ad0

gmirror status
      Name    Status  Components
            mirror/RAID1  DEGRADED  ad1  ad0 (0%)

Wednesday, 1 January 2025

Resizing a UFS partition

UFS is really only supported on FreeBSD

Use a FreeBSD live CD.

gpart delete -i 1 /dev/da1

gpart destroy -F /dev/da1

gpart create -s GPT /dev/da1

gpart show

Note that it has a 40 sector (40*512 bytes) offset to allow for the GPT table. 
The previous sector I had started at 34 bytes and creating a partition warned that "added, but partition is not aligned on 4096 bytes"


gpart show

40 7814037088 da1 GPT (36T)
40 7814037088     - free - (3.6T)

gpart add -t freebsd-ufs -b 40 -s 7814037088 /dev/da1

gpart show

40 7814037088 da1 GPT (36T)
40 7814037088     1 freebsd-ufs (3.6T)