Installing to DA4 not able to boot gptboot: invalid backup GPT header

I'm trying to install 10.1 onto an external USB HDD, and then boot from the drive directly ignoring the internal drive which has windows 7 on it. The BIOS is configured to boot directly from the USB HDD.

If during the install, I select to automatically partition with GPT, upon reboot after installation I get:
Code:
gptboot: invalid backup GPT header
|

If I select MBR then I get the boot menu with a FreeBSD option on F1 and the windows drive as 5 (default is FreeBSD), if I select F1 then I simply get a "|" and nothing more. If I select the windows drive it boots into windows.

I've tried everything I can find online from rebuilding the MBR and boot0, setting the primary partition as active, zeroing out both the first and last 15 sectors, checking the /etc/fstab for the correct HD locations and deleted all partitions and started over about 10 times without any success.

If I boot from the live CD then I can mount and browse the da4s1 UFS partition.

At present, gpart show ad4 yields the following:

Code:
=>             34    1953525101  da4  GPT  (932G)
               34          1024  1   freebsd-boot   (512k)
             1058     1946156032  2  freebsd-ufs  (928G)
       1926157090     7368044  3  freebsd-swap  (3.5G)
       1953525134          1        - free -  (512B)

I'm at a loss and can't find any new information on google, hopefully someone can identify what I'm doing wrong.
 
Why da4? How many disks do you have? If you have only one other disk it should be da0 or da1. I've installed FreeBSD 10.1 on a disk connected through USB and for me it works fine, doesn't complain about invalid header, but the disk shows as da1. Zeroing 15 sectors is not enough, you need at least 34. Another thing to check, you might have some read error, sometimes FreeBSD can behave strangely on default settings (at least it does it for me, I need to correct PMBR first to avoid it), if this is the case, zeroing your disk should help for a while.
 
Pick MBR or GPT, but don't mix the two. Do not modify the PMBR on a GPT disk. This could also be a problem with a USB enclosure with poor firmware that has an off-by-one error so the last block can't be read. That would give the error, although it still should boot. See http://www.freebsd.org/releases/9.0R/relnotes-detailed.html#AEN1277 for an override setting.

Just to nitpick a little, it is ok to modify the boot code part of the PMBR (for example with boot0cfg(8)) because the bootcode is just arbitrary real-mode x86 code that doesn't have to follow a standard as long as it does the job of enabling boot. What you shouldn't do is to modify the partition table part of the PMBR because the table has to be set up exactly as required by the GPT standard.
 
That would give the error, although it still should boot. See http://www.freebsd.org/releases/9.0R/relnotes-detailed.html#AEN1277 for an override setting.

Certainly everything I read online suggested this error wasn't fatal and boot would continue, but that is not my experience at present. The override didn't seem to make a difference. Interestingly the document suggest the command can be entered either at the boot prompt, or by adding it to loader.conf I do not get any type of boot prompt, as the error is the first thing I get after the BIOS finished loading. I added to loader.conf but wittout any result.

Why da4? How many disks do you have? If you have only one other disk it should be da0 or da1.

I have an SATA internal dive which is on ada0 and plus the USB drive on da4. At boot, it looks as though da1 is getting assigned to my keyboard, and da2 to my mouse. Being fairly new at this it looked more like the port was driving the number assignment rather than it incrementing with each added drive/device.

Zeroing 15 sectors is not enough, you need at least 34.

You're right, this was me misremembering, in fact I zero'd out the first and last 36 sectors.
 
Hmm, the da driver is purely for disks. You will not have da device nodes assigned to your keyboard/mouse etc. As far as I'm aware it's not related to physical ports either, so if you only have one disk using the da device driver, it should be da0.

However, it's possible you have a disk called ad4. This will likely be the exact same disk as ada0.
If you look in /dev, you'll probably see a symlink from /dev/ad4 -> /dev/ada0.

It would be useful to see dmesg output to confirm exactly what disks are being picked up and their device names. You can also confirm the model & size of any disk that appears in /dev by running diskinfo -v /dev/[ad|ada|da]X.

If you partition a disk with GPT, which I would usually recommend these days, you shouldn't have an daXs1 slice. The disk will just be split into partitions -

Code:
/dev/daX - raw disk
/dev/daXp1 - partition 1 (boot, if laid out like your example)
/dev/daXp2 - partition 2 (ufs)
/dev/daXp3 - partition 3 (swap)
As mentioned it may be an issue with using USB that is causing the system to think the backup GPT header is corrupt. Shouldn't stop it booting though, strange that it appears to find boot information on the disk but won't go any further.
 
Hmm, the da driver is purely for disks. You will not have da device nodes assigned to your keyboard/mouse etc. As far as I'm aware it's not related to physical ports either, so if you only have one disk using the da device driver, it should be da0.

You are of course right, on boot it flashes by really quickly but I managed to take a picture and so despite what I said it seems that da0,da1,da2,da3 are in fact my memory card reader, I was confused by the only thing I saw on which was the MS /MS-Pro and thought it was my keyboard - sorry for the confusion.

Code:
da0 at umass-sim0 bus 0 schbus4 target 0 lun 0
da0: <Generic- Compact Flash 1.00> Removable Direct Access SCSI-0 device
da0: Serial Number 200604130921000000
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
da0: quirks=0x2<NO_6_BYTE>
da1 at umass-sim0 bus 0 schbus4 target 0 lun 1
da1: <Generic- SM/xD-Picture 1.00> Removable Direct Access SCSI-0 device
da1: Serial Number 200604130921000000
da1: 40.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
da1: quirks=0x2<NO_6_BYTE>
da2 at umass-sim0 bus 0 schbus4 target 0 lun 2
da2: <Generic- SD/MC 1.00> Removable Direct Access SCSI-0 device
da2: Serial Number 200604130921000000
da2: 40.000MB/s transfers
da2: Attempt to query device size failed: NOT READY, Medium not present
da2: quirks=0x2<NO_6_BYTE>
da3 at umass-sim0 bus 0 schbus4 target 0 lun 3
da3: <Generic- MS/MS-Pro 1.00> Removable Direct Access SCSI-0 device
da3: Serial Number 200604130921000000
da3: 40.000MB/s transfers
da3: Attempt to query device size failed: NOT READY, Medium not present
da3: quirks=0x2<NO_6_BYTE>

However, it's possible you have a disk called ad4. This will likely be the exact same disk as ada0.
If you look in /dev, you'll probably see a symlink from /dev/ad4 -> /dev/ada0.
Yes, in /dev I see
Code:
ad4 -> ada0
ad4s1 -> ada0s1
ad4s2 -> ada0s2
ad4s3 -> ada0s3

It would be useful to see dmesg output to confirm exactly what disks are being picked up and their device names. You can also confirm the model & size of any disk that appears in /dev by running diskinfo -v /dev/[ad|ada|da]X.

I had an issue running the command you mentioned, hopefully the output below provides the answer you were looking for. As you can see da0 through da3 are detected but diskinfo confirms they are not available disks.

Code:
root@:~ # diskinfo -v /dev/[ad|ada|da]X
diskinfo: /dev/[ad: No such file or directory
ada: Command not found.
da]X: Command not found.

root@:/dev # ls
acpi            atkbd0          da3             gptid           md1             ntfs            random          ttyv5           ufsid           ugen7.2
ad4             audit           da4             io              mdctl           null            sndstat         ttyv6           ufssuspend      ugen7.3
ad4s1           bpf             da4p1           iso9660         mem             pass0           stderr          ttyv7           ugen0.1         ukbd0
ad4s2           bpf0            da4p2           kbd0            midistat        pass1           stdin           ttyv8           ugen1.1         urandom
ad4s3           cd0             da4p3           kbd1            mixer0          pass2           stdout          ttyv9           ugen2.1         usb
ada0            console         devctl          kbd2            mixer1          pass3           sysmouse        ttyva           ugen2.2         usbctl
ada0s1          consolectl      devstat         kbdmux0         mixer2          pass4           ttyv0           ttyvb           ugen3.1         xpt0
ada0s2          ctty            diskid          klog            mixer3          pass5           ttyv1           ttyvc           ugen4.1         zero
ada0s3          da0             fd              kmem            mixer4          pass6           ttyv2           ttyvd           ugen5.1
apm             da1             fido            log             msdosfs         pci             ttyv3           ttyve           ugen6.1
apmctl          da2             geom.ctl        md0             nfslock         pts             ttyv4           ttyvf           ugen7.1
root@:/dev # diskinfo -v /dev/da0
diskinfo: /dev/da0: ioctl(DIOCGMEDIASIZE) failed, probably not a disk.
root@:/dev # diskinfo -v /dev/da1
diskinfo: /dev/da1: ioctl(DIOCGMEDIASIZE) failed, probably not a disk.
root@:/dev # diskinfo -v /dev/da2
diskinfo: /dev/da2: ioctl(DIOCGMEDIASIZE) failed, probably not a disk.
root@:/dev # diskinfo -v /dev/da3
diskinfo: /dev/da3: ioctl(DIOCGMEDIASIZE) failed, probably not a disk.
root@:/dev #

root@:~ # diskinfo -v /dev/ad4
/dev/ad4
        512             # sectorsize
        1000204886016   # mediasize in bytes (932G)
        1953525168      # mediasize in sectors
        0               # stripesize
        0               # stripeoffset
        1938021         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/ad4s1
/dev/ad4s1
        512             # sectorsize
        65769984        # mediasize in bytes (63M)
        128457          # mediasize in sectors
        0               # stripesize
        32256           # stripeoffset
        127             # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/ad4s2
/dev/ad4s2
        512             # sectorsize
        16106127360     # mediasize in bytes (15G)
        31457280        # mediasize in sectors
        0               # stripesize
        66060288        # stripeoffset
        31207           # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/ad4s3
/dev/ad4s3
        512             # sectorsize
        984030904320    # mediasize in bytes (916G)
        1921935360      # mediasize in sectors
        0               # stripesize
        3287285760      # stripeoffset
        1906681         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/ada0
/dev/ada0
        512             # sectorsize
        1000204886016   # mediasize in bytes (932G)
        1953525168      # mediasize in sectors
        0               # stripesize
        0               # stripeoffset
        1938021         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/ada0s1
/dev/ada0s1
        512             # sectorsize
        65769984        # mediasize in bytes (63M)
        128457          # mediasize in sectors
        0               # stripesize
        32256           # stripeoffset
        127             # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/ada0s2
/dev/ada0s2
        512             # sectorsize
        16106127360     # mediasize in bytes (15G)
        31457280        # mediasize in sectors
        0               # stripesize
        66060288        # stripeoffset
        31207           # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/ada0s3
/dev/ada0s3
        512             # sectorsize
        984030904320    # mediasize in bytes (916G)
        1921935360      # mediasize in sectors
        0               # stripesize
        3287285760      # stripeoffset
        1906681         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        S1FXJDWS200611  # Disk ident.

root@:~ # diskinfo -v /dev/da4
/dev/da4
        512             # sectorsize
        1000204886016   # mediasize in bytes (932G)
        1953525168      # mediasize in sectors
        0               # stripesize
        0               # stripeoffset
        121601          # Cylinders according to firmware.
        255             # Heads according to firmware.
        63              # Sectors according to firmware.
        20130714006233F # Disk ident.

root@:/dev # diskinfo -v /dev/da4p1
/dev/da4p1
        512             # sectorsize
        524288          # mediasize in bytes (512K)
        1024            # mediasize in sectors
        0               # stripesize
        17408           # stripeoffset
        0               # Cylinders according to firmware.
        255             # Heads according to firmware.
        63              # Sectors according to firmware.
        20130714006233F # Disk ident.

root@:/dev # diskinfo -v /dev/da4p2
/dev/da4p2
        512             # sectorsize
        996431888384    # mediasize in bytes (928G)
        1946156032      # mediasize in sectors
        0               # stripesize
        541696          # stripeoffset
        121142          # Cylinders according to firmware.
        255             # Heads according to firmware.
        63              # Sectors according to firmware.
        20130714006233F # Disk ident.

root@:/dev # diskinfo -v /dev/da4p3
/dev/da4p3
        512             # sectorsize
        3772438528      # mediasize in bytes (3.5G)
        7368044         # mediasize in sectors
        0               # stripesize
        17408           # stripeoffset
        458             # Cylinders according to firmware.
        255             # Heads according to firmware.
        63              # Sectors according to firmware.
        20130714006233F # Disk ident.
 
Just to nitpick a little, it is ok to modify the boot code part of the PMBR (for example with boot0cfg(8)) because the bootcode is just arbitrary real-mode x86 code
Yes, it's normal bootcode. But using boot0cfg(8) on a GPT disk is not useful, either. Well, it might be useful to boot other disks, but boot0 is going to have a problem with locating the GPT partitions unless you get into hybrid GPT/MBR partition tables... which gives a non-standard partition table in the PMBR.
 
I had an issue running the command you mentioned

Guessing you haven't done much with regular expressions. That wasn't an actual command you could run as-is. I was trying to show that you can run diskinfo() on any da, ad, or ada device to view details about it. There's also generally no reason to run that command on a partition.

It does however appear that your USB disk is appearing as da4. The other da devices, as you say, seem to point to ports on your card reader. Remember not to confuse it with ad4, which points to your ada0 SATA disk. I won't bother going into why those devices have ID's 0 & 4.

Regarding boot, I'm out of ideas. I assume you used bsdinstall() to create the install (you mention using the automatic partition option) so there's no point asking if boot code was installed correctly. If it's just a disk in a USB caddy, rather than a moulded of-the-shelf USB drive, I would try plugging directly into a SATA port to see if it boots that way. Would pretty much confirm whether it's a problem caused by it being USB.
 
Are you 100% sure it's BIOS, not UEFI? If you have UEFI make sure you set it to legacy mode. Have you tried installing on ZFS partitions and gptzfsboot? Could you post files of your first and last 34 sectors? I agree with usdmatt, and if you can't connect it to SATA port have you tried to install some other OS on it to confirm that it works?
 
Guessing you haven't done much with regular expressions. That wasn't an actual command you could run as-is. I was trying to show that you can run diskinfo() on any da, ad, or ada device to view details about it. There's also generally no reason to run that command on a partition.

It does however appear that your USB disk is appearing as da4. The other da devices, as you say, seem to point to ports on your card reader. Remember not to confuse it with ad4, which points to your ada0 SATA disk. I won't bother going into why those devices have ID's 0 & 4.

Regarding boot, I'm out of ideas. I assume you used bsdinstall() to create the install (you mention using the automatic partition option) so there's no point asking if boot code was installed correctly. If it's just a disk in a USB caddy, rather than a moulded of-the-shelf USB drive, I would try plugging directly into a SATA port to see if it boots that way. Would pretty much confirm whether it's a problem caused by it being USB.

Thanks, for your assistance, this is a package USB HD so I can't take it appart.


Are you 100% sure it's BIOS, not UEFI? If you have UEFI make sure you set it to legacy mode. Have you tried installing on ZFS partitions and gptzfsboot? Could you post files of your first and last 34 sectors? I agree with usdmatt, and if you can't connect it to SATA port have you tried to install some other OS on it to confirm that it works?

No, not sure it's not UEFI, unfortunately this is a Dell Studio and other than changing the boot order there pretty much nothing you can change (I can't even disable the SATA HD.

I've not tried ZFS, but I figured out that even though I can't run FreeBSD amd64 in a virtual machin on my windows 7 laptop, it runs perfectly happily in a virtual machine on my Mac book Pro, and since all I was looking for was a development environment to build a package from a pfSense machine, this solved my issue.

Thanks also for your help, but even though I would have liked to solve this issue in case someone else had the same problem in the future, at this point I'm going to let the thread die.
 
...unfortunately this is a Dell Studio and other than changing the boot order there pretty much nothing you can change (I can't even disable the SATA HD).
You should be able to find an unlocked BIOS for your studio on techinferno or another site such as notebookreview's forums (forum.notebookreview.com). Dell is notorious for locking out ~90% of BIOS options and flashing an unlocked BIOS is more than worth it.
 
Back
Top