When I destroyed the zpools when I was done with zstd compression testing, these errors appeared in /var/log/messages:
Oct 4 12:21:24 r730-01 kernel: GEOM: nda1: the primary GPT table is corrupt or invalid. Oct 4 12:21:24 r730-01 kernel: GEOM: nda1: using the secondary instead -- recovery strongly advised. Oct 4 12:21:24 r730-01 kernel: GEOM: nda2: the primary GPT table is corrupt or invalid. Oct 4 12:21:24 r730-01 kernel: GEOM: nda2: using the secondary instead -- recovery strongly advised.
You’d be shocked to learn these messages appear when creating a zpool with those devices:
[12:21 r730-01 dvl ~/tmp] % sudo zpool create Samsung-SSD-980-PRO-geom-issues mirror /dev/nda1 /dev/nda2
re:
Oct 4 12:25:15 r730-01 kernel: GEOM: nda1: the primary GPT table is corrupt or invalid. Oct 4 12:25:15 r730-01 kernel: GEOM: nda1: using the secondary instead -- recovery strongly advised. Oct 4 12:25:15 r730-01 kernel: GEOM: nda1: the primary GPT table is corrupt or invalid. Oct 4 12:25:15 r730-01 kernel: GEOM: nda1: using the secondary instead -- recovery strongly advised. Oct 4 12:25:15 r730-01 kernel: GEOM: nda2: the primary GPT table is corrupt or invalid. Oct 4 12:25:15 r730-01 kernel: GEOM: nda2: using the secondary instead -- recovery strongly advised. Oct 4 12:25:15 r730-01 kernel: GEOM: nda2: the primary GPT table is corrupt or invalid. Oct 4 12:25:15 r730-01 kernel: GEOM: nda2: using the secondary instead -- recovery strongly advised.
Background: these two devices were part of a zpool before I started playing with them. They had partitions on them.
Recovery and destroy
There may be a way to clear out the partition information without doing this. I first destroyed my zpool, losing all the information contained there in (which was nothing).
[12:28 r730-01 dvl ~/tmp] % sudo zpool destroy Samsung-SSD-980-PRO-geom-issues
This, again, generated the log messages.
Let’s fix the first device:
[12:28 r730-01 dvl ~/tmp] % sudo gpart destroy -F nda1 gpart: arg0 'nda1': Invalid argument [12:28 r730-01 dvl ~/tmp] % sudo gpart destroy -F /dev/nda1 gpart: arg0 'nda1': Invalid argument
That fails because it is an unknown device. This makes it known:
[12:32 r730-01 dvl ~/tmp] % sudo gpart recover /dev/nda1 nda1 recovered [12:32 r730-01 dvl ~/tmp] % gpart show nda1 => 40 1953525088 nda1 GPT (932G) 40 1953484800 1 freebsd-zfs (931G) 1953484840 40288 - free - (20M)
Now it can be destroyed:
[12:32 r730-01 dvl ~/tmp] % sudo gpart destroy -F nda1 nda1 destroyed
And the second device:
[12:32 r730-01 dvl ~/tmp] % sudo gpart recover /dev/nda2 nda2 recovered [12:32 r730-01 dvl ~/tmp] % gpart show nda2 => 40 1953525088 nda2 GPT (932G) 40 1953484800 1 freebsd-zfs (931G) 1953484840 40288 - free - (20M) [12:32 r730-01 dvl ~/tmp] % sudo gpart destroy -F nda2 nda2 destroyed
Now the zpool can be created without those messages:
[12:33 r730-01 dvl ~/tmp] % sudo zpool create Samsung-SSD-980-PRO-geom-issues mirror /dev/nda1 /dev/nda2
Thank you for coming to my TED talk.