• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

how to boot from the zfs mirror when 1 disk failed?

Scheduled Pinned Locked Moved General pfSense Questions
6 Posts 2 Posters 1.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    ceffy
    last edited by Feb 26, 2024, 6:41 PM

    Yesterday my mini pc running pfsense CE v2.7 failed to boot after a planned reboot (as it was behaving strangely lately), connecting HDMI let me quickly found out one of the ssd failed, but somehow the other ssd couldn't finish the boot process, half way thru, it had this error:

    ...
    Configuring crash dumps...
    Using /dev/ada0p3 for dump device.
    Canβ€˜t open '/dev/gpt/efiboot0'
    /dev/gpt/efiboot0: UNEXPECTED INCONSISTENCY: RUN fsck_msdosfs MANUALLY.
    THE FOLLOMWING FILE SYSTEM HAD AN UNEXPECTED INCONSISTENCY:
    msdosfs: /dev/gpt/efiboot0 (/boot/efi)
    Preen mode recommended running a check that will be performed now now.
    
    Warning: Trying to recover filesystem from inconsistency...
    ERROR: Impossible to mount filesystem., use interactive shell to attempt to recover it
    #
    

    Taking out the bad disk had the same output.

    At this stage, if I ran zfs pool I could still see all the zfs pools, and I did managed to recover the config from /conf/config.xml, after manually mounting /pfSense/ROOT/default/cf, which was not auto-mounted.

    Many filesystems were read-only and I couldn't mount all zfs datasets as the export.lock file was read-only, too (probably reason why the /pfSense/ROOT/default/cf dataset wasn't mounted).

    /dev/gpt/efiboot0 was from the bad drive, so as a linux person with no freebsd experience I wanted to edit /etc/fstab and change the esp partition to /dev/gpt/efiboot1 hoping it would boot, for editors, i've only used nano my life (which was not present in pfsense), so I tried vi, when trying to save after editing, I was told the file was read-only, then I couldn't manage to leave with :q, :wq, :wq! or ESC or Ctrl + C, and the screen became very messy. BGM Hotel California intensified.

    The family was waiting for internet to come back, so I gave up recovering the zfs mirror and re-installed a single-disk version with the recovered config.xml, so we're good for now.

    May I ask what are the steps to boot from the good drive(s) when we use zfs mirror, when pfsense normally booted from the failed drive?

    For example, in Linux the EFI partition cannot be zfs, and have to be synchronized manually across the mirrors. Is it the same with pfsense / freebsd?

    Does pfsense synchronize the "EFI" and "boot" mountpoints? If not, anyway to make sure when any one of the disks failed, one can still boot from the other good disk(s) temporarily until we can resilver the mirror?

    Thanks a lot!

    1 Reply Last reply Reply Quote 0
    • S
      stephenw10 Netgate Administrator
      last edited by Feb 26, 2024, 7:09 PM

      Probably this unfortunately: https://redmine.pfsense.org/issues/15083

      Steve

      C 1 Reply Last reply Feb 26, 2024, 7:29 PM Reply Quote 0
      • C
        ceffy @stephenw10
        last edited by Feb 26, 2024, 7:29 PM

        @stephenw10 Thank you very much, that looks like it. I'll give it a try soon, after i receive my new disk and re-create a mirror. Thanks again!

        1 Reply Last reply Reply Quote 1
        • S
          stephenw10 Netgate Administrator
          last edited by Feb 26, 2024, 11:06 PM

          Hmm, actually it may not be that issue. Some testing here shows it's incorrectly trying to mount the efi partition using a missing label. But it doesn't need to mount that at all.

          Simply commenting out that line from the fstab should allow it to boot.

          You can use the included Easy Editor ee to avoid vi induced insanity. πŸ˜‰

          Steve

          C 1 Reply Last reply Mar 28, 2024, 4:24 PM Reply Quote 0
          • C
            ceffy @stephenw10
            last edited by ceffy Mar 28, 2024, 4:39 PM Mar 28, 2024, 4:24 PM

            @stephenw10 Thank you sir, it worked beautifully!

            Following the guide, i found /dev/gpt/efiboot1 was indeed empty, so if it were the remaining esp (EFI) partition, there would be nothing to boot from.

            So i copied everything, as shown in the guide, from (/boot/efi/) (i.e. /dev/gpt/efiboot0) to /dev/gpt/efiboot1.

            I then used ee to edit /etc/fstab, changing:

            /dev/gpt/efiboot0               /boot/efi       msdosfs rw              2       2
            /dev/ada0p3                     none            swap    sw              0       0
            

            to:

            #/dev/gpt/efiboot0               /boot/efi       msdosfs rw              2       2
            #/dev/ada0p3                     none            swap    sw              0       0
            
            # when the above disk failed, comment the 2 lines above
            # and uncomment the 2 lines below, to boot from the remaining disk
            
            /dev/gpt/efiboot1              /boot/efi       msdosfs rw              2       2
            /dev/ada1p3                    none            swap    sw              0       0
            
            

            Here, /etc/fstab tells the system to boot from /dev/gpt/efiboot1 (mounted as /boot/efi), also to use /dev/ada1p3 as the new swap.

            I then (after weeks of having edited the lines above) rebooted and voila it booted normally.

            Also, ee looks very similar to nano, and i managed to quit very easily πŸ˜€

            Thank you very much for the help!

            It would be awesome if pfSense could have some kind of script to format and sync the esp partition during or post installation so the system can be more resilient.

            edit: sorry i missed the part where you said uncommenting that line is sufficient. I'll test it on another day. thanks!

            1 Reply Last reply Reply Quote 0
            • S
              stephenw10 Netgate Administrator
              last edited by Mar 28, 2024, 6:04 PM

              Great. Yes there are a bunch of improvements there coming in 24.03.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                This community forum collects and processes your personal information.
                consent.not_received