FreeBSD 11 gpt boot issue

Well, I have come across a very strange issue that I can not fix. I hope someone on here can help me! I have been with FreeBSD from before version 1 when it was called 386BSD! I am at a loss on how to get this box back working!

Some very strange reason after a reboot the GPT boot for the SSD on p1 stop booting on the second reboot. The box has been running fine and has been rebooted several time. All drives will fsck the SSD does not have any issues. So I am at a loss at to why this has happen. Never have had this happen to me before and I have been running FreeBSD for a VERY LONG TIME....

When using the cd to restore the boot part of p1 on the ssd did not fix the SSD and it will now just give the _ at boot and sit there forever!

Spending hours and hour with the CD I finally gave up and took a USB drive and loaded the OS on the USB drive so I have a working OS to try and fix the bad OS boot on the SSD.

this is the usb drive:
Code:
root@db:~ # diskinfo -v /dev/da2
/dev/da2
        512                      # sectorsize
        256060514304    # mediasize in bytes (238G)
        500118192          # mediasize in sectors
        0                          # stripesize
        0                          # stripeoffset
        31130                  # Cylinders according to firmware.
        255                      # Heads according to firmware.
        63                        # Sectors according to firmware.
        5111611150441B970020    # Disk ident.
        Not_Zoned           # Zone Mode
this is the boot on usb drive:
Code:
root@db:~ # diskinfo -v /dev/da2p1
/dev/da2p1
        512                      # sectorsize
        524288                # mediasize in bytes (512K)
        1024                    # mediasize in sectors
        0                          # stripesize
        20480                  # stripeoffset
        0                          # Cylinders according to firmware.
        255                      # Heads according to firmware.
        63                        # Sectors according to firmware.
        5111611150441B970020    # Disk ident.
this is the gpart show of the USB drive:
Code:
root@db:~ # gpart show /dev/da2
=>         40   500118112  da2  GPT  (238G)
              40   1024              1  freebsd-boot  (512K)
          1064   490732544    2  freebsd-ufs  (234G)
490733608   8388608        3  freebsd-swap  (4.0G)
499122216   995936          -   free -  (486M)
This show "gptboot: invalid backup gpt header" on boot for USB Drive....do not understand that...but it does boot

The SSD that refuses too boot is:
Code:
root@db:~ # gpart show /dev/ada0
=>           40   4000797280  ada0  GPT  (1.9T)
                40   1024                 1  freebsd-boot  [bootme]  (512K)
            1064   3992976376     2  freebsd-ufs  [bootme]  (1.9T)
3992977440   7819879           3  freebsd-swap  (3.7G)
4000797319   1                       - free -  (512B)
SSD:
root@db:~ # diskinfo -v /dev/ada0
Code:
/dev/ada0
        512                      # sectorsize
        2048408248320  # mediasize in bytes (1.9T)
        4000797360        # mediasize in sectors
        4096                    # stripesize
        0                          # stripeoffset
        3969045              # Cylinders according to firmware.
        16                        # Heads according to firmware.
        63                        # Sectors according to firmware.
        S2KMNWAG701314T # Disk ident.
        Not_Zoned           # Zone Mode
SSD Boot part is:
Code:
root@db:~ # diskinfo -v /dev/ada0p1
/dev/ada0p1
        512                      # sectorsize
        524288                # mediasize in bytes (512K)
        1024                    # mediasize in sectors
        4096                    # stripesize
        0                          # stripeoffset
        1                          # Cylinders according to firmware.
        16                        # Heads according to firmware.
        63                        # Sectors according to firmware.
        S2KMNWAG701314T # Disk ident.
It appears ada0p1 and da2p1 are the same. If one was to dd(1) da2p1 to ada0p1 would this solve the problem and allow the SSD to boot?

Running all the standard commands like
Code:
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
gpart set -a active -i 1 ada0
Should solve the problem but it does not fix the BTX Loader... something is stopping the BTX Loader from getting called. I do not understand what is going on and why this is not working. If anyone out there has any idea or has run across the problem with other version of FreeBSD and you have fixed a non booting system to boot via BTX Loader then I would like to know what steps you took to get BTX Loader to get called?
 
Last edited by a moderator:
It shouldn't be a problem, but it looks like your SSD has both the freebsd-boot and freebsd-ufs partition set to bootable ("bootme"). IIRC, the freebsd-boot partition never has a need to be set to bootable, it is the freebsd-ufs partition you want to boot from that needs a "bootme" flag (unless it is the first freebsd-ufs partition on the drive).
Also, the boot flags are different for MBR and GPT layouts. Alle the details you need are in the gpart(8) man page.
 
It shouldn't be a problem, but it looks like your SSD has both the freebsd-boot and freebsd-ufs partition set to bootable ("bootme"). IIRC, the freebsd-boot partition never has a need to be set to bootable, it is the freebsd-ufs partition you want to boot from that needs a "bootme" flag (unless it is the first freebsd-ufs partition on the drive).
Also, the boot flags are different for MBR and GPT layouts. Alle the details you need are in the gpart(8) man page.

I have been unable to find a way to remove bootme from the partitions on p1 or p2. I have been all through gpart man page! Even with the bootme removed it would not boot. I will not load the BTX Loader code. I set the bootme in hopes it would force the BTX Loader code to run, but it did not!

Only reason why I set bootme on p1 and then p2 hopping it would roll over until it did find BTX Loader....that did not work...and since I can not figure out how to remove bootme from p1 and p2 I can not roll it back.

Either way with bootme and with out it dose not run BTX Loader....
 
Is yours a Lenovo system ? (some require a "fix" to boot from GPT).
 
Is yours a Lenovo system ? (some require a "fix" to boot from GPT).
Nope It is a 1u HP DL box. Box was working fine for almost 2 years. Then on reboot ( NOTE: box has been rebooted many times before ) it would not boot. Check the SSD no problems.

At this point I am thinking about just doing a DD from the USB Flash drive for p1 and DD that image from p1 to the SSD for p1... I am at a loss on how to get it to load BTX Loader. I have tried everything I can think of. Now I am down too non normal stuff to try... Out of options... Going to wait a few more days. Think about it... If I can not get it to work by end of week I am going to try DD of p1.
 
Strange. Doesn't # gpart unset ... work? Do you get an error message?
I did gpart unset -a active -i 2 ada0 that error out tried with bootme that did remove the bootme flag.

redid gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 /dev/ada0
it did write it to ada0 and ada0p1 like it should

reboot just give the _ it never makes it too BTX Loader... I do not know what is going on... it should boot but dose not!!!!
 
I did gpart unset -a active -i 2 ada0 that error out tried with bootme that did remove the bootme flag.
Yes, as I wrote earlier in this thread: the boot flags are different for MBR and GPT layouts. 'active' is a MBR boot flag, while 'bootme' is a GPT boot flag. The two doesn't mix.
 
Ignore the USB drive, it doesn't matter. Have you backed up the data on ada0p2? After that, it is safe to experiment with the bootcode.
 
Ignore the USB drive, it doesn't matter. Have you backed up the data on ada0p2? After that, it is safe to experiment with the bootcode.
That was the first thing I did was dump everything before and after fsck ada0p2. I just do not want to rebuild the OS Drive. I am going to try unset everything and redo the boot load again from a new cd.
 
Just to confirm as it's slightly unusual, you have a 250GB USB disk and a 2TB SSD?
Yes... 256gb usb flash drives they are about 100$ per drive. I use them for zfs backups because you can mirror those fast and take a usb hub and dump stuff faster than you can by ftp or some other method. 2TB SSD is just a samsung ssd... I should have zfs root that so I would not have this issue... my mistake... I am going to correct that this weekend! I can not figure out how to get it to load BTX Loader to load... So I am just going to put 2 ssd in and zfs root it and move on down the road. I am giving up....
 
Back
Top