Solved Disappearing disk

I have a 320GB Hitachi disk from which I can boot via Ventoy. It appears as a BIOS boot option, and I can successfully boot mfsBSD and Debian which are installed on various partitions on the disk.

What I can't figure out is why the partitions don't show up when I run gpart show from mfsBSD.

diskinfo -v /dev.ada0 shows some stats about the disk, but if I connect it to another system gpart show


dmseg shows

Code:
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: <Hitachi HTS545032B9SA00 3202> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number 12033002E3624972E5D2
da0: 40.000MB/s transfers
da0: 305245MB (625142448 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
GEOM: da0: the secondary GPT header is not in the last LBA.
GEOM_PART: integrity check failed (da0, GPT)

Is there any way I can fix this? It's odd that Ventoy can boot from it.
 
we would gpart recover da0, per the man page. As to why ventoy can boot it, we would assume that ventoy does not validity-check the whole GPT, and just parses enough of the primary to boot.
Code:
     If the size of the device has changed (e.g., volume expansion) the
     secondary GPT header will no longer be located in the last sector.  This
     is not a metadata corruption, but it is dangerous because any corruption
     of the primary GPT will lead to loss of the partition table.  This
     problem is reported by the kernel with the message:

           GEOM: provider: the secondary GPT header is not in the last LBA.

     This situation can be recovered with the recover command.  This command
     reconstructs the corrupt metadata using known valid metadata and
     relocates the secondary GPT to the end of the device.
 
Too specific. Boot a major FreeBSD release and show what gpart tells about the disk. In case nothing while the device exists, the partition table is obscure. I don't think anyone here knows what Ventoy linux cooked of your disk.
 
I've found that I can boot Arch Linux which is installed on partiion 9 and lsblk shows all the available partitions without any problem.

Is this a FreeBSD specific problem?
 
When booting Debian, it shows all my partitions.

Apparently some tool call gdisk can identify problems and correct them.

And I've just discovered that it is available on FreeBSD.

It is able to get info from /dev/da0 so I may be able to identify the problem.

gdisk /dev/da0 -v tells me:-

Code:
Command (? for help): v

Problem: The secondary header's self-pointer indicates that it doesn't reside
at the end of the disk. If you've added a disk to a RAID array, use the 'e'
option on the experts' menu to adjust the secondary header's and partition
table's locations.

Warning: There is a gap between the secondary partition table (ending at sector
625142436) and the secondary metadata (sector 625142443).
This is helpful in some exotic configurations, but is generally ill-advised.
Using 'k' on the experts' menu can adjust this gap.

Warning: There is a gap between the main partition table (ending sector 33)
and the first usable sector (40). This is helpful in some exotic configurations,
but is unusual. The util-linux fdisk program often creates disks like this.
Using 'j' on the experts' menu can adjust this gap.

Warning! Secondary partition table overlaps the last partition by
3 blocks!
Try reducing the partition table size by 12 entries.
(Use the 's' item on the experts' menu.)

Identified 2 problems!

Since I'm not an expert I haven't ventured into 's' yet.
 
v k j w

j Adjust the location of the main partition table. This value is normally 2, but it may need to be increased in some cases,
such as when a system-on-chip (SoC) is hard-coded to read boot code from sector 2. I recommend against adjusting this value
unless doing so is absolutely necessary.

k Adjust the location of the backup partition table. This partition table is normally located just before the backup metadata
at the end of the disk, but it may need to be moved in some very rare cases. I recommend against adjusting this value unless
doing so is absolutely necessary.
 
gdisk -v tells me:-

Code:
Expert command (? for help): v

Problem: The secondary header's self-pointer indicates that it doesn't reside
at the end of the disk. If you've added a disk to a RAID array, use the 'e'
option on the experts' menu to adjust the secondary header's and partition
table's locations.

Problem: The backup partition table overlaps the backup header.
Using 'e' on the experts' menu may fix this problem.

Warning: There is a gap between the main partition table (ending sector 33)
and the first usable sector (40). This is helpful in some exotic configurations,
but is unusual. The util-linux fdisk program often creates disks like this.
Using 'j' on the experts' menu can adjust this gap.

Identified 2 problems!
Code:
Expert command (? for help): p
Disk /dev/da0: 625142448 sectors, 298.1 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): F72FE186-F4DD-4659-9D1C-68D5F035B824
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 40, last usable sector is 625142414
Partitions will be aligned on 8-sector boundaries
Total free space is 12586975 sectors (6.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048       100722687   48.0 GiB    8300  Ventoy
   2       100722688       100788223   32.0 MiB    0700  VTOYEFI
   3       100788224       101836799   512.0 MiB   A503  mfsBSD
   4       101836800       112322559   5.0 GiB     A503  FreeBSD-14.0-pristine
   5       112322560       113436671   544.0 MiB   A503
   6       113437320       134408839   10.0 GiB    A503  FreeBSD-14.0
   7       134410240       144895999   5.0 GiB     8300  openSUSE
   8       144896000       165867519   10.0 GiB    8300  Arch-Linux-!!!
   9       178450432       625142407   213.0 GiB   A503  save-area

Can someone tell me what is wrong here?


gpart show da0 says there is no such geom as da0:
 
So just v k j w?

And that means that gpart show da0 will suddenly work?
After backing up all the partitions I'm going to select v k j w after running gdisk /dev/da0.

Should I expect this to clear the problem?

I find it strange that gdisk /dev/da0 p will display all the partition information, whereas gpart da0 tells me there is no such geom.

Whilst trying this sequence I'm told:-

Currently, main partition table begins at sector 2 and ends at sector 33
Enter new starting location (2 to 2016; default is 2; 1 to abort): 2

I pressed 2 and the w (write)

and then
Expert command (? for help): w and then:-

Warning! Secondary partition table overlaps the last partition by
3 blocks!
Try reducing the partition table size by 12 entries.
(Use the 's' item on the experts' menu.)
Warning! Secondary header is placed too early on the disk! Do you want to
correct this problem? (Y/N):


Help!
 
Isn't normal that a tool made to fix broken stuff [GDISK ] sees more than something which is made to work with only good stuff [GPART] in order to prevent corruption ?
 
Back
Top