![Syslinux erstellt unerwartete Partitionen auf dem Disk-Image](https://rvso.com/image/231062/Syslinux%20erstellt%20unerwartete%20Partitionen%20auf%20dem%20Disk-Image.png)
Beim Versuch, einen Bootloader auf einem Disk-Image zu installieren, stelle ich ein merkwürdiges Verhalten fest. So habe ich es gemacht:
$ dd if=/dev/zero of=test.img status=progress bs=200M count=1
1+0 records in
1+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 0.190117 s, 1.1 GB/s
$ mkfs.ext2 test.img
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 204800 1k blocks and 51200 inodes
Filesystem UUID: f6442813-7b8c-4636-b69e-334696e0840b
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
$ sudo mount test.img mount-point/ -o loop
$ fdisk -l test.img
Disk test.img: 200 MiB, 209715200 bytes, 409600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
$ sudo extlinux -i mount-point/
mount-point/ is device /dev/loop0
Warning: unable to obtain device geometry (defaulting to 64 heads, 32 sectors)
(on hard disks, this is usually harmless.)
$ fdisk -l test.img
Disk test.img: 200 MiB, 209715200 bytes, 409600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x20ac7dda
Device Boot Start End Sectors Size Id Type
test.img1 3224498923 3657370039 432871117 206.4G 7 HPFS/NTFS/exFAT
test.img2 3272020941 5225480974 1953460034 931.5G 16 Hidden FAT16
test.img3 0 0 0 0B 6f unknown
test.img4 50200576 974536369 924335794 440.8G 0 Empty
Partition table entries are not in disk order.
Ich verstehe nicht, warum der extlinux -i
Befehl neue Partitionen auf dem Disk-Image erstellen würde. Ich vermute, dass er einige Dateisystem-Metadaten ändern könnte, aber ich wäre für eine Erläuterung der Details dankbar. Ist es außerdem möglich, Syslinux auf einem unpartitionierten Disk-Image zu installieren?
Antwort1
Die MBR-Partitionstabelle ist eine sehr einfache Struktur am Ende des ersten 512-Byte-Blocks der Festplatte. Sie enthält keine Prüfsummen, Hashes oder andere Fehlerschutzfunktionen.
Indem Sie fdisk -l
das von Ihnen erstellte Dateisystem-/Partitionsabbild ausführen, zwingen Sie es effektiv dazu, seinen ersten Block (den Partition Boot Record, kurz PBR) als MBR falsch zu interpretieren. Dies führt zu einer unsinnigen Ausgabe, wie Sie gezeigt haben.
Wenn ich mich richtig erinnere, würde das von erstellte PBR extlinux
enthaltenBoot-Codean den Stellen, die von der eigentlichen Partitionstabelle in einem MBR belegt werden. Das fdisk
würde also Teile des extlinux
PBR-Bootcodes lesen und versuchen, ihn als MBR-Inhalt anzuzeigen. Kein Wunder, dass die Ausgabe keinen Sinn ergibt!