Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP partition on MDRAID 1 #214

Open
doublez13 opened this issue Apr 11, 2023 · 1 comment
Open

ESP partition on MDRAID 1 #214

doublez13 opened this issue Apr 11, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@doublez13
Copy link

doublez13 commented Apr 11, 2023

I've got the following setup on my machine...

   "blockdevices": [
      {
         "parttype": null,
         "mountpoint": "/boot",
         "pttype": null,
         "fstype": "vfat",
         "kname": "md127",
         "pkname": "nvme0n1p1",
         "type": "raid1"
      },{
         "parttype": null,
         "mountpoint": "/boot",
         "pttype": null,
         "fstype": "vfat",
         "kname": "md127",
         "pkname": "nvme1n1p1",
         "type": "raid1"
      },{
         "parttype": "c12a7328-f81f-11d2-ba4b-00a0c93ec93b",
         "mountpoint": null,
         "pttype": "gpt",
         "fstype": "linux_raid_member",
         "kname": "nvme0n1p1",
         "pkname": "nvme0n1",
         "type": "part"
      },{
         "parttype": "c12a7328-f81f-11d2-ba4b-00a0c93ec93b",
         "mountpoint": null,
         "pttype": "gpt",
         "fstype": "linux_raid_member",
         "kname": "nvme1n1p1",
         "pkname": "nvme1n1",
         "type": "part"
      }
   ]
}

In this particular case, the MDRAID metadata is at the back of the drives, so the motherboard just sees two identical ESP partitions, then Linux assembles them into a RAID 1.

Unfortunately sbctl fails to detect the EFI partition.

  for _, entryToCheck := range []*LsblkEntry{pathEfiEntry, pathBootEntry, pathBootEfiEntry} {
    if entryToCheck.Pttype != "gpt" {
      continue
    }

    if entryToCheck.Fstype != "vfat" {
      continue
    }

    if entryToCheck.Parttype != "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" {
      continue
    }

    return entryToCheck.Mountpoint, nil
  }

  return "", ErrNoESP

I'm wondering if it would be possible to add another check after the for loop to check for RAID?
Pseudocode:

# RAID check
for entryToCheck:
  if fstype != vfat:  continue
  if type != raid1: continue
  if Pttype of parent != gpt:  continue
  if Parttype of parent != c12a7328-f81f-11d2-ba4b-00a0c93ec93b:  continue
  return entryToCheck.Mountpoint, nil
@sedrubal
Copy link

sedrubal commented Feb 8, 2024

I have the same problem:

$ lsblk --json --output PARTTYPE,MOUNTPOINT,PTTYPE,FSTYPE,MOUNTPOINTS,TYPE,PKNAME,KNAME

Partial output:

{
   "blockdevices": [
      {
         "parttype": "c12a7328-f81f-11d2-ba4b-00a0c93ec93b",
         "mountpoint": null,
         "pttype": "gpt",
         "fstype": "linux_raid_member",
         "mountpoints": [
             null
         ],
         "type": "part",
         "pkname": "sda",
         "kname": "sda3"
      },{
         "parttype": "c12a7328-f81f-11d2-ba4b-00a0c93ec93b",
         "mountpoint": null,
         "pttype": "gpt",
         "fstype": "linux_raid_member",
         "mountpoints": [
             null
         ],
         "type": "part",
         "pkname": "sdb",
         "kname": "sdb2"
      },{
         "parttype": null,
         "mountpoint": "/efi",
         "pttype": null,
         "fstype": "vfat",
         "mountpoints": [
             "/efi"
         ],
         "type": "raid1",
         "pkname": "sdb2",
         "kname": "md127"
      },{
         "parttype": null,
         "mountpoint": "/efi",
         "pttype": null,
         "fstype": "vfat",
         "mountpoints": [
             "/efi"
         ],
         "type": "raid1",
         "pkname": "sda3",
         "kname": "md127"
      }
   ]
}

Same thing in user readable:

$ lsblk -f
NAME      FSTYPE            FSVER LABEL      MOUNTPOINTS
sda                                                                                              
├─...
└─sda3    linux_raid_member 1.0   linux:0
  └─md127 vfat              FAT32 EFI        /efi
sdb                                                                                              
├─...
└─sdb2    linux_raid_member 1.0   linux:0
  └─md127 vfat              FAT32 EFI        /efi

@Foxboron Foxboron added bug Something isn't working good first issue Good for newcomers labels Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants