Solved EFI partition - mount_msdosfs: /dev/mirror/p1: Invalid argument

Code:
# mount_msdosfs /dev/ada0p1 /boot/efi
# umount /boot/efi
# gmirror label -v p1 /dev/ada0p1
Metadata value stored on /dev/ada0p1.
Done.
# gmirror insert -v p1 /dev/ada1p1
# mount_msdosfs /dev/mirror/p1 /boot/efi
mount_msdosfs: /dev/mirror/p1: Invalid argument

Questions:
1. Is an efi partition mount optional?
2. Is there another way to automatically sync ada0p1 with ada1p1?
 
I'm fairly confident you can't have EFI partition in software mirror (gmirror) and have BIOS(EFI) boot from it (I won't put wager on it). You first created the FS and then mirror on it which basically means you overwrote the FS metadata on it. You first need to create provider for gmirror and create FS as a last step.

Mounting EFI partition is optional when it comes to FreeBSD boot and running on FreeBSD. You need to have it mounted only when you want to update the loader on it. I actually have noauto in my fstab for this entry.
 
1. Is an efi partition mount optional?
Yes. You need it mounted (somewhere) when using efibootmgr to update the BIOS to boot a specific loader. That is, when you do not just throw the loader into \EFI\BOOT\BOOTX64.efi, but configure a proper multiboot menu into the BIOS.
2. Is there another way to automatically sync ada0p1 with ada1p1?
dd, invoked from /etc/weekly and /etc/rc.shutdown.local - plus a little scritping to check that we copy in the right direction.
(These things do not normally change except when updating the system, and then a reboot is usually adviseable anyway)

I am not sure why your approach doesn't work. Maybe the mount_msdosfs detects the metadata from gmirror, and concludes (as it should) that this is not a plain msdosfs but something else.
Have You tried to create the mirror first, and afterwards do newfs_msdos onto the mirror device?
 
Have You tried to create the mirror first, and afterwards do newfs_msdos onto the mirror device?
I believe this would be the correct order of operations. The geom bits (gmirror) should be putting metadata at the end of the partition. Not sure if there is anything in a FAT partition that is at the end, but if there is it gets wiped out.

I think if you did the correct order you should be able to boot from it because doing newfs_msdos onto the mirror should create a filesystem that stops short of the geom metadata.
 
Not sure if there is anything in a FAT partition
There is, data blocks reserved for FAT partition. Chances are there's nothing there (EFI doesn't need much and there's usually free space anyway) but it's wrong approach. But if there are more files stored and FS is full one could end up with unbootable system. Provider should be created first, filesystem last.
 
  • Like
Reactions: mer
OK, it's all good. Provider first then file system next. Or, if you prefer, for this case: mirror first then newfs_msdos next.

Code:
# gmirror label -v p1 /dev/ada0p1 /dev/ada1p1
Metadata value stored on /dev/ada0p1.
Metadata value stored on /dev/ada1p1.
Done.
# newfs_msdos -F 32 -c 1 /dev/mirror/p1
newfs_msdos: cannot get number of sectors per track: Operation not supported
newfs_msdos: cannot get number of heads: Operation not supported
/dev/mirror/p1: 403265 sectors in 403265 FAT32 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=16 HiddenSecs=0 HugeSectors=409599 FATsecs=3151 RootCluster=2 FSInfo=1 Backup=2
# mount_msdosfs /dev/mirror/p1 /mnt
# mkdir -p /mnt/EFI/BOOT
# cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi
# umount /mnt
# mount_msdosfs /dev/mirror/p1 /boot/efi

Finally, does anyone have any additional words of wisdom, other than "don't do it" in regards to:

Code:
gmirror label -v gm0 /dev/ada0 /dev/ada1
gpart create -s gpt /dev/mirror/gm0
gpart add -t efi -a4k -s 200M /dev/mirror/gm0
gpart add -t freebsd-ufs /dev/mirror/gm0

PMc inspired me to put this into a startup script to repair the inevitable corruption:

gpart recover /dev/mirror/gm0

What's the harm in a little corruption? On second thought, this is for a production host - better not push my luck.

Thank you all.
 
If you create FS on provider (geom mirror in this case) FS will exist within its boundaries. Metadata are stored in the end of a provider so chances are you will be able to boot it too (offset to fat metadata is not changed when on provider). I personally never had EFI partition in software raid so I'm just sharing my 2c.

I would not blindly do gpart recover ever. Recover checks for GPT headers (start and end of the disk) and makes actions to recover the layout from its backup. If you followed proper steps when creating mirror, partitions and filesystem you should not see any need for recovery.
Typical use of recover: If you use dynamic disks (SAN disks, virtual ones..) and you resize it you will need to recover it as GPT's backup metadata gets lost (they are no longer in the end).
 
In my experience, corruption consistently, inevitably ensues (due to a reported race condition) with a GPTed "monolithic mirror." A monolithic mirror, if you will, uses entire drives as underlying providers. Under this circumstance, gmirror reportedly "fights" GPT for control of a HDD/SSD's last byte.

gmirrored partitions provide a workaround to avoid monolithic mirror corruption.
 
gmirror store it's data on the last logical sector (512bytes in 512e or 512n disks and 4k on AF disks) and it provide a new mirrored volume which in size is n-1 the original provider size.

When you create an GPT scheme inside the gmirror volume it can't overwrite the last sector on the underling disk as it doesn't see it. The tricky part here is that if you boot under LiveCD or any other OS which doesn't know about gmirror it will report of the missing secondary GPT table at the end of the disk (LBA -1) and if any recovery is done it will overwrite the last sectors LBA -1 to LBA -33 which respectively will delete the gmirror.

For example:
If you have ada0 and ada1 of 50GB (104857600 sectors with 512 sectorsize) and create a gmirror the newly create volume will have 104857599 sectors (-1 sector) so when you create a GPT inside it the secondary GPT header will be stored on LBA 104857599 instead of the LBA 104857600 where it will be the metadata of the gmirror.


----
LBA0 Protective MBR
LBA1 Primary GPT header
LBA2 Entry1-4
LBA3 Entry5-128

LBA34 Partition 1
LBAxxx Partition 2
LBAxxx Partition N

LBA-33 Entry1-4
LBA-2 Entry5-128
LBA-1 Secondary GPT Header
---
LBA104857600 gmirror metadata

1664993276326.png
 
When you create an GPT scheme inside the gmirror volume it can't overwrite the last sector on the underling disk as it doesn't see it. The tricky part here is that if you boot under LiveCD or any other OS which doesn't know about gmirror it will report of the missing secondary GPT table at the end of the disk (LBA -1) and if any recovery is done it will overwrite the last sectors LBA -1 to LBA -33 which respectively will delete the gmirror.
Good stuff. I wonder if when booted under live cd if you load gmirror kld would things work correctly. The first sentence is a key and sometimes hard to understand, but it's the key: create the gmirror then do everything on the mirror (gpart, newfs, etc)
 
Corruption continues to occur after a reboot even when gmirror and gpt are configured under LiveCD or Single User Mode.
 
Under this circumstance, gmirror reportedly "fights" GPT for control of a HDD/SSD's last byte.
Just to reiterate what I said before and was said after me: if you do things correctly you won't overwrite anything as each provider sees only its own space limited by start and end.

However this setup does provide one annoying itch. Start is the same. So whether you have gmirror or you don't primary GPT header starts at the same location. But end is not. Even geom itself is complaining about it in syslog as when you stop the mirror providers look like they are missing the backup GPT header. That itch can trigger people to do stuff which could lead to a problem (but it's not a race condition).

To see what I mean:
Code:
# create fake disks
# dd if=/dev/zero of=blob00 bs=1M count=1024
# dd if=/dev/zero of=blob01 bs=1M count=1024
# mdconfig -a -t vnode -f ./blob00
# mdconfig -a -t vnode -f ./blob01

# gmirror label -v gm0 md0 md1
# gmirror status
      Name    Status  Components
mirror/gm0  COMPLETE  md0 (ACTIVE)
                      md1 (ACTIVE)
#

# gpart create -s gpt /dev/mirror/gm0
# gpart add -t freebsd-ufs -s 512m /dev/mirror/gm0
# gpart show mirror/gm0
=>     40  2097072  mirror/gm0  GPT  (1.0G)
       40  1048576           1  freebsd-ufs  (512M)
  1048616  1048496              - free -  (512M)
#
# You see md0 is one sector bigger than the actual mirror device
#
# diskinfo /dev/md0
/dev/md0    512    1073741824    2097152    0    0
#  diskinfo /dev/mirror/gm0
/dev/mirror/gm0    512    1073741312    2097151    0    0
Now let's stop it and see what's going on:
Code:
# gmirror stop gm0
# gmirror list
And the itch:
Code:
 gpart show md0
=>     40  2097072  md0  GPT  (1.0G) [CORRUPT]
       40  1048576    1  freebsd-ufs  (512M)
  1048616  1048496       - free -  (512M)
# dmesg |tail -2
GEOM: md1: the secondary GPT header is not in the last LBA.
GEOM: md0: the secondary GPT header is not in the last LBA.
Where if you dump the start of the disk:
Code:
hd -n 1024 /dev/md0
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001c0  02 00 ee ff ff ff 01 00  00 00 fe ff 1f 00 00 00  |................|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|  <-- end of fake mbr aka pmbr
00000200  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|  <-- gpt hdr start
00000210  70 22 62 54 00 00 00 00  01 00 00 00 00 00 00 00  |p"bT............|
00000220  fe ff 1f 00 00 00 00 00  28 00 00 00 00 00 00 00  |........(.......|
00000230  d7 ff 1f 00 00 00 00 00  24 09 ea af ef 44 ed 11  |........$....D..|
00000240  8e 92 00 0c 29 00 d0 3b  02 00 00 00 00 00 00 00  |....)..;........|
00000250  80 00 00 00 80 00 00 00  7f a1 5f 1d 00 00 00 00  |.........._.....|
00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400
And EFI standard says that the backup header should be on the last LBA. But gmirror took our last sector for its own metadata. From gmirror all is OK as that backup header is on its last sector. But start of the disk seems like regular GPT disk. If you hit the gpart recover at this stage you wipe out your gmirror metadata.
 
My scenario:
# cat /boot/loader.conf geom_mirror_load="YES"
In other words the gmirror driver is always available and a gmirror stop is not performed.

Under these circumstances gpart recover gm0 repairs GPT corruption, gm0 persists, and the PC remains bootable. And gm0 is still available after a reboot, although its GPT corruption returns.
 
You don't need to recover anything just because you see those messages in syslog and in gpart for given disk. If you know what you're doing, that is using two raw disks as a mirror, you should not recover anything. That message can be treated as false alarm (annoying though).

If one disk dies nothing happens - you can still have one way mirror (one device corrupted). If you need to take that disk away and use it elsewhere on FreeBSD you can still do so - those partitions are available as if they were never part of the mirror.

Of course you may do as you will.
 
Corruption continues to occur after a reboot even when gmirror and gpt are configured under LiveCD or Single User Mode.
That's is exactly what i'm talking about. When you boot any GPT aware OS which detect GPT formatted disk it verify the secondary GTP header at LBA -1 on the physical disk not on the mirror volume and it warn you that there's NO secondary GPT header at that sector.
GEOM: da0: the secondary GPT header is not in the last LBA.

There's NO need to perform any gpart recovery at this point especially at the underlying disk (ada0 / da0) as it will destroy the gmirror metadata. The GPT header inside the mirror volume is also good so there's no need to perform gpart recovery gm0 after loading of the gmirror load.

regarding your question:
Finally, does anyone have any additional words of wisdom, other than "don't do it" in regards to:

1. Always make regular backups
2. Keep a printed copy of the gpart show it will help you if you need to recovery data from damaged disk which doesn't have partition information.

If your motherboard have ICHxR chipset it's better to use the software raid on chip provided by the controller using graid. It works sigillary as gmirror but provide benefits of booting from the BIOS from the raid volume instead of the disk0.
ZFS is also good alternative.
 
Again, both the mirror and the GPT persist after a gpart recover mirror/gm0.

Clone host from mirrored partitions to mirrored drives:

# gpart destroy -F ada2 ada2 destroyed # gpart destroy -F ada3 ada3 destroyed # gmirror label -v gm0 /dev/ada2 /dev/ada3 Metadata value stored on /dev/ada2. Metadata value stored on /dev/ada3. Done. # gpart create -s gpt /dev/mirror/gm0 mirror/gm0 created # gpart add -t efi -a4k -s 200M /dev/mirror/gm0 mirror/gm0p1 added # gpart add -t freebsd-ufs -s 454G /dev/mirror/gm0 mirror/gm0p2 added # gpart add -t freebsd-swap -s 8G /dev/mirror/gm0 mirror/gm0p3 added # newfs_msdos -F 32 -c 1 /dev/mirror/gm0p1 /dev/mirror/gm0p1: 403266 sectors in 403266 FAT32 clusters (512 bytes/cluster) BytesPerSec=512 SecPerClust=1 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=409600 FATsecs=3151 RootCluster=2 FSInfo=1 Backup=2 # mount -t msdosfs /dev/mirror/gm0p1 /mnt # mkdir -p /mnt/EFI/BOOT # cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi # umount /mnt # newfs -U /dev/mirror/gm0p2 > /dev/null # mount /dev/mirror/gm0p2 /mnt # dump -C16 -b64 -0a -f - / | (cd /mnt && restore -rf -) DUMP: WARNING: should use -L when dumping live read-write filesystems! DUMP: Date of this level 0 dump: Thu Oct 6 15:54:20 2022 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/mirror/p2 (/) to standard output DUMP: mapping (Pass I) [regular files] DUMP: Cache 16 MB, blocksize = 65536 DUMP: mapping (Pass II) [directories] DUMP: estimated 2654123 tape blocks. DUMP: dumping (Pass III) [directories] DUMP: dumping (Pass IV) [regular files] warning: ./.snap: File exists DUMP: 94.43% done, finished in 0:00 at Thu Oct 6 15:59:44 2022 DUMP: DUMP: 2648239 tape blocks DUMP: finished in 374 seconds, throughput 7080 KBytes/sec DUMP: DUMP IS DONE # echo "/dev/mirror/gm0p1 /boot/efi msdosfs rw 2 2" > /mnt/etc/fstab # echo "/dev/mirror/gm0p2 / ufs rw 1 1" >> /mnt/etc/fstab # echo "/dev/mirror/gm0p3 none swap sw 0 0" >> /mnt/etc/fstab # shutdown -p now Shutdown NOW!

At this point the drives with the gmirrored partitions are physically removed from the ada0 and ada1 slots, the gmirrored drives are then physically inserted into the ada0 and ada1 slots, and the host is powered-on.

By the way, the -L flag refuses to work for me. And any additional advice on how to properly dump without warnings is appreciated in advance.

A serial port is used as console. After the host is powered-on with the gmirrored drives as root it displays the anticipated corruption. Use gpart recover to fix it:

# gpart show => 40 976773088 mirror/gm0 GPT (466G) [CORRUPT] 40 409600 1 efi (200M) 409640 952107008 2 freebsd-ufs (454G) 952516648 16777216 3 freebsd-swap (8.0G) 969293864 7479264 - free - (3.6G) # gpart recover mirror/gm0 mirror/gm0 recovered root@oto12:~ # gpart show => 40 976773088 mirror/gm0 GPT (466G) 40 409600 1 efi (200M) 409640 952107008 2 freebsd-ufs (454G) 952516648 16777216 3 freebsd-swap (8.0G) 969293864 7479264 - free - (3.6G) # reboot root@oto12:~ # reboot FreeBSD/amd64 (host) (ttyu0) login: root Password: Last login: Thu Oct 6 16:14:10 on ttyu0 FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC # gpart show => 40 976773088 mirror/gm0 GPT (466G) [CORRUPT] 40 409600 1 efi (200M) 409640 952107008 2 freebsd-ufs (454G) 952516648 16777216 3 freebsd-swap (8.0G) 969293864 7479264 - free - (3.6G) root@oto12:~ # gpart recover mirror/gm0 mirror/gm0 recovered root@oto12:~ # gpart show => 40 976773088 mirror/gm0 GPT (466G) 40 409600 1 efi (200M) 409640 952107008 2 freebsd-ufs (454G) 952516648 16777216 3 freebsd-swap (8.0G) 969293864 7479264 - free - (3.6G)
 
to use dump on live file system you need to disable the journal on it. You can do this only from single user mode using tunefs -j disable /
 
Yes but he aslo experience a GPT corruption inside the gm0 (mirror) so it must something else going on.
I agree.

The original post is clear, he overwrote it with the filesystem creation as the steps to create that were out of the order.
But I think all we could say was said.

edit: DonK: please can you share the output of the gpart show before you create mirror and then after you create all partitions ? Also add the diskinfo for all providers (ada0,ada1,mirror/gm0).
 
Perhaps the details shown below will help people to understand my temptation to simply gpart recover mirror/gm0 in a startup script. (And optionally gpart recover mirror/gm1, when a second mirror's present, in the same script.)

My test scenario: ada0 and ada1 are mirrored into gm0. Its sole purpose is to provide a FreeBSD 13v1 test-bed to investigate two, previously unknown to this thread, HDDs on ada2 and ada3. gm0 is cloned to gm1 then the host is rebooted with gm1 used as root. But first, as expected, gmirror logs gm0 corruption when the test-bed host boots:

# dmesg | grep GEOM GEOM_MIRROR: Device mirror/gm0 launched (2/2). GEOM: mirror/gm0: the secondary GPT table is corrupt or invalid. GEOM: mirror/gm0: using the primary only -- recovery suggested. # gpart show ada2 => 63 976773105 ada2 MBR (466G) 63 80262 1 !222 (39M) 80325 1595 - free - (798K) 81920 1540096 2 ntfs [active] (752M) 1622016 974038875 3 ntfs (464G) 975660891 165 - free - (83K) 975661056 1101824 4 !39 (538M) 976762880 10288 - free - (5.0M) # gpart show ada3 => 34 976773101 ada3 GPT (466G) 34 2014 - free - (1.0M) 2048 1331200 1 efi (650M) 1333248 262144 2 ms-reserved (128M) 1595392 973123584 3 ms-basic-data (464G) 974718976 2027520 4 ms-recovery (990M) 976746496 26639 - free - (13M) # gpart destroy -F ada2 ada2 destroyed # gpart destroy -F ada3 ada3 destroyed # gmirror label -v gm1 /dev/ada2 /dev/ada3 # gpart create -s gpt /dev/mirror/gm1 mirror/gm1 created # gpart add -t efi -a4k -s 200M /dev/mirror/gm1 mirror/gm1p1 added # gpart add -t freebsd-ufs -s 454G /dev/mirror/gm1 mirror/gm1p2 added # gpart add -t freebsd-swap -s 8G /dev/mirror/gm1 mirror/gm1p3 added # newfs_msdos -F 32 -c 1 /dev/mirror/gm1p1 /dev/mirror/gm1p1: 403266 sectors in 403266 FAT32 clusters (512 bytes/cluster) BytesPerSec=512 SecPerClust=1 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=409600 FATsecs=3151 RootCluster=2 FSInfo=1 Backup=2 # mount -t msdosfs /dev/mirror/gm1p1 /mnt # mkdir -p /mnt/EFI/BOOT # cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi # umount /mnt # newfs -U /dev/mirror/gm1p2 > /dev/null # mount /dev/mirror/gm1p2 /mnt # dump -C16 -b64 -0a -f - / | (cd /mnt && restore -rf -) DUMP: WARNING: should use -L when dumping live read-write filesystems! DUMP: Date of this level 0 dump: Fri Oct 7 20:32:54 2022 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/mirror/gm0p2 (/) to standard output DUMP: mapping (Pass I) [regular files] DUMP: Cache 16 MB, blocksize = 65536 DUMP: mapping (Pass II) [directories] DUMP: estimated 2766714 tape blocks. DUMP: dumping (Pass III) [directories] DUMP: dumping (Pass IV) [regular files] warning: ./.snap: File exists DUMP: DUMP: 2760830 tape blocks DUMP: finished in 259 seconds, throughput 10659 KBytes/sec DUMP: DUMP IS DONE # echo "/dev/mirror/gm1p1 /boot/efi msdosfs rw 2 2" > /mnt/etc/fstab # echo "/dev/mirror/gm1p2 / ufs rw 1 1" >> /mnt/etc/fstab # echo "/dev/mirror/gm1p3 none swap sw 0 0" >> /mnt/etc/fstab # gpart show ada2 gpart: No such geom: ada2. # gpart show mirror/gm1 => 40 976773088 mirror/gm1 GPT (466G) 40 409600 1 efi (200M) 409640 952107008 2 freebsd-ufs (454G) 952516648 16777216 3 freebsd-swap (8.0G) 969293864 7479264 - free - (3.6G) # diskinfo ada2 ada2 512 500107862016 976773168 4096 0 969021 16 63 # diskinfo ada3 ada3 512 500107862016 976773168 4096 0 969021 16 63 # diskinfo mirror/gm1 mirror/gm1 512 500107861504 976773167 4096 0 # gpart recover mirror/gm0 mirror/gm0 recovered # reboot login: root Password: Last login: Fri Oct 7 20:00:38 on ttyu0 FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC # dmesg | grep GEOM GEOM_MIRROR: Device mirror/gm0 launched (2/2). GEOM_MIRROR: Device mirror/gm1 launched (2/2). GEOM: mirror/gm0: the secondary GPT table is corrupt or invalid. GEOM: mirror/gm0: using the primary only -- recovery suggested. GEOM: mirror/gm1: the secondary GPT table is corrupt or invalid. GEOM: mirror/gm1: using the primary only -- recovery suggested. # gpart recover mirror/gm0 mirror/gm0 recovered # gpart recover mirror/gm1 mirror/gm1 recovered # efibootmgr Boot to FW : false BootCurrent: 0008 Timeout : 0 seconds BootOrder : 0001, 0002, 0008, 0009, 000A, 000B, 0005, 0006, 0007 Boot0001* DTO UEFI USB Floppy/CD Boot0002 DTO UEFI USB Hard Drive +Boot0008* TOSHIBA MQ01ACF050 Boot0009* TOSHIBA MQ01ACF050 Boot000A* WDC WD5000BPKT-75PK4T0 Boot000B* WDC WD5000LPLX-75ZNTT0 Boot0005* DTO Legacy USB Floppy/CD Boot0006* Hard Drive Boot0007* IBA GE Slot 00C8 v1381 # efibootmgr -n -b 000A Boot to FW : false BootNext : 000a BootCurrent: 0008 Timeout : 0 seconds BootOrder : 0001, 0002, 0008, 0009, 000A, 000B, 0005, 0006, 0007 Boot0001* DTO UEFI USB Floppy/CD Boot0002 DTO UEFI USB Hard Drive +Boot0008* TOSHIBA MQ01ACF050 Boot0009* TOSHIBA MQ01ACF050 Boot000A* WDC WD5000BPKT-75PK4T0 Boot000B* WDC WD5000LPLX-75ZNTT0 Boot0005* DTO Legacy USB Floppy/CD Boot0006* Hard Drive Boot0007* IBA GE Slot 00C8 v1381 # reboot login: root Password: Last login: Fri Oct 7 20:00:38 on ttyu0 FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC # mount /dev/mirror/gm1p2 on / (ufs, local, soft-updates) devfs on /dev (devfs) /dev/mirror/gm1p1 on /boot/efi (msdosfs, local) # dmesg | grep GEOM GEOM_MIRROR: Device mirror/gm0 launched (2/2). GEOM_MIRROR: Device mirror/gm1 launched (2/2). GEOM: mirror/gm0: the secondary GPT table is corrupt or invalid. GEOM: mirror/gm0: using the primary only -- recovery suggested. GEOM: mirror/gm1: the secondary GPT table is corrupt or invalid. GEOM: mirror/gm1: using the primary only -- recovery suggested. # gpart recover mirror/gm0 mirror/gm0 recovered # gpart recover mirror/gm1 mirror/gm1 recovered
 
All makes sense till the command gpart recover mirror/gm0. What is the point of that command?
gm0 is cloned to gm1
How do you do that?

Steps you provided here (excluding the original post) are ok, there's no reason for any corruption to happen inside mirror.
 
Every command shown above from gpart destroy -F ada2 through dump -C16 -b64 -0a -f - / | (cd /mnt && restore -rf -) helps clone gm0 to gm1. Then gm1's /etc/fstab is replaced to mount gm1 as root instead of gm0.

The mirror itself is corrupted, not the providers within.
 
There's no reason for mirror to be corrupted at all, not even with the steps you provided. That means you're doing something to corrupt it. That's why I asked about the "cloning", maybe the metadata from one mirror are messing up with the other one.
 
Back
Top