(Originally posted on stackoverflow, closed as off topic. Closing message recommended I ask on superuser instead.)
I've been reading about the Linux boot process, and tried to orient myself by looking at my machine's boot device:
mcarilli:tmp$ mount | grep boot
/dev/sdc5 on /boot type ext4 (rw,relatime)
/dev/sdc1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
root:tmp# parted -l
...
Model: ATA Samsung SSD 860 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos (msdos = MBR, according to google)
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 538MB 537MB primary fat32 boot
2 539MB 1000GB 1000GB extended
5 539MB 1305MB 767MB logical ext4
6 1307MB 1000GB 999GB logical
So I expect /dev/sdc1 is my EFI system partition. According to wikipedia, the EFI system partition's "ID in the master boot record (MBR) partition-table scheme is 0xEF."). As an exercise, I tried to verify this.
MBR sector layout says "Partition entry No1" (probably) starts at 0x01BE and the partition type (ID) should be found at offset 0x04 in this entry. So, on the MBR disk hosting the partition (/dev/sdc), I expect to see 0xEF at 0x01BE + 0x04 = 1C2. But I don't:
root:tmp# xxd /dev/sdc | head -n 50
...
000001b0: cd10 ac3c 0075 f4c3 b1df bbbc 0000 8004 ...<.u..........
000001c0: 0104 0bfe c2ff 0008 0000 0000 1000 00fe ................
^ Expected to see "ef" here
What am I missing?
note: i don't think my machine actually starts booting with UEFI firmware, I think it uses BIOS (either natively or via CSM fallback), because after login there's no /sys/firmware/efi folder. Not sure if this is relevant to why /dev/sdc1 appears not to be tagged as 0XEF.
parted
installed you can check flags by runningsudo parted -l
. The far right column (flags) should say "esp" if it is flagged as an EFI partition. Also if you havefdisk
you can runsudo fdisk -l
which will tell you the partition type for each partition. As to why the partition would be created if it's not used - I have no idea lol. You might check if there are actually files under /boot/efi. If not, you could probably change the type to EFI system using, e.g., fdisk, and then check again, although I don't want to be responsible if this breaks stuff.