GPT Partition table corruption on boot disk

Let’s suppose that it is Grub that is causing this issue.

From memory, IIRC Grub can be installed in a special partition at the start of the disk or for a UEFI system it can be installed in the UEFI partition.

A parted listing of the boot disk partitions looks like this:

Number  Start   End     Size    File system  Name  Flags
 1      2097kB  3146kB  1049kB                     bios_grub, legacy_boot
 2      3146kB  540MB   537MB   fat32              boot, esp
 4      540MB   17.7GB  17.2GB                     swap
 3      17.7GB  34.9GB  17.2GB  zfs
 5      34.9GB  239GB   204GB   zfs

So on this UEFI system, Grub is NOT using the UEFI version, but rather the legacy version, and since the GRUB boot is not therefore following normal UEFI standards, all sorts of kludges may apply and glitches may result.

Given that UEFI is not a mandatory pre-requisite for TrueNAS SCALE, and is unlikely to be so for some time, ixSYstems is left with a choice:

  1. Use a common Grub approach across both non-UEFI and UEFI systems; or
  2. Implement a different Grub approach for non-UEFI and UEFO systems.

and they have chosen the least effort option 1.

So, assuming that this is true, can anyone help with some ideas on how to track this down?

As an aside, before I decided to install TrueNAS on my TerraMaster, I was planningto install TOS, and that works by having a small flash drive on the internal USB port with GRUB that looks for the main O/S on the normal disks in the drive bays - and if it can’t find it then it loads a stub O/S makes itself visible on the LAN so that you can install the O/S over the LAN. It is a crap idea to use a HDD for O/S and in an otherwise useful drive bay too - though I suppose you could RAIDZ the boot pool across all the drives to speed up boot. But it is a nice idea to do O/S install over the network if it is done well - but unfortunately it isn’t.

When I received my ebay-seller “refurbished” TerraMaster, the boot loader was broken - not finding the network and I needed to fix this first. The “refurbishment” obviously did NOT include testing that it actually worked!!!

I looked at this and decided that the existing stub firmware was … um … how can I say this nicely … um … actually I can’t say it nicely, so … “a heap of crap”. If you hunted them down there were a bunch of different images for non-UEFI, UEFI etc. but they were not easy to find. Although each of these loaded the same stub o/s if there was no main o/s, each of the GRUB scripts was built slightly differently, the UEFI one was not using GRUB in UEFI mode etc.

So I built a common boot environment that would work on both non-UEFI and UEFI systems, and learned a lot about how awful GRUB is in the process.

That doesn’t sound right. GRUB has to live in an EFI System Partition if it’s to be loaded by a UEFI firmware. As for legacy BIOS boot (which you really should not be using in 2024), my understanding is that GRUB basically installs a boot sector and one or more intermediate loaders that then load GRUB from what is, essentially, an EFI system partition (which is just a FAT32 partition with a special ID).

On my TrueNAS SCALE boot drive, there is a Grub boot partition as the first partition on the disk.

And indeed, when I went to the GRUB UEFI pages, that is how it said it works.

But I have a feeling (and I may be mis-remembering) that there is a way you can store the GRUB code and configuration inside the UEFI partition (which is where it really should be in a UEFI system).

Here’s an idea to make sure the setup is sensible:

  1. Install to a smallish device, like a USB flash drive
  2. Copy everything over to the larger device
  3. Manually fix the partition layout, create an extra partition for whatever other ZFS pool you want
  4. Create the ZFS pool

Sorry if I am being dense, but I have no idea what you are proposing here.

I don’t personally have any issues with the layout I have except for the repeating loss of the Partition Table - and I have no reason to believe that this is because the apps pool is on the boot device (though it could be because the boot device is a USB SSD).

But if you think that there is something easy that will make the setup “sensible”, then I am definitely open to suggestions providing that I understand exactly what you are proposing and why it is more sensible.

  1. Use FreeBSD-based CORE.
  2. Enjoy.

My suggestion was for when creating the setup, so that TrueNAS’ stuff is all handled properly.

At the very least, reinstall to use UEFI boot.
GRUB is a pain. But legacy GRUB…

It’s 2024. Legacy aka EFI should be left to the graveyard, you bloody technomancers!

I am sorry if I did not make myself clear in earlier posts. My system is setup to use EUFI and was installed that way from scratch. But the GRUB setup is still using a GRUB boot partition.

You mean CSM, presumably. EFI is crappy, but livable if only AMI could ship less buggy software.

What I mean is that I have set the BIOS to UEFI boot only.