Überprüfen des Startvolumes

Überprüfen des Startvolumes

Wie kann ich programmgesteuert überprüfen, ob der LUN-Knoten ein Startvolume ist oder nicht (der LUN-Knoten wird auf /dev/Linux-Systemen (wie RHEL oder Ubuntu oder einer anderen Linux-Variante) erstellt).

Meines Wissens gibt es eine Möglichkeit, dies mit einem Dienstprogramm wie dd, hexdump, file, oder durch programmgesteuertes Lesen der ersten 512 Bytes usw. zu überprüfen (indem die ersten 512 Bytes vom LUN-Knoten überprüft/gelesen werden).

Gibt es eine andere, effizientere Möglichkeit, dies zu tun? Vielen Dank im Voraus.

Antwort1

Um zu ermitteln, ob eine Partition bootfähig ist, können Sie sfdiskFolgendes verwenden:

$ sudo sfdisk -l

Disk /dev/sda: 60801 cylinders, 255 heads, 63 sectors/track
Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+     63-     64-    512000   83  Linux
/dev/sda2         63+  60801-  60738- 487873536   8e  Linux LVM
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty

Alle bootfähigen Geräte haben ein *in der zweiten Spalte der Ausgabe. Für andere Gerätetypen wie LVM und SD-Karten:

Disk /dev/mapper/fedora_greeneggs-swap: 997 cylinders, 255 heads, 63 sectors/track

Disk /dev/mapper/fedora_greeneggs-root: 6527 cylinders, 255 heads, 63 sectors/track

Disk /dev/mapper/fedora_greeneggs-home: 53212 cylinders, 255 heads, 63 sectors/track

Disk /dev/mmcblk0: 488672 cylinders, 4 heads, 16 sectors/track
sfdisk: Warning: The partition table looks like it was made
  for C/H/S=*/255/63 (instead of 488672/4/16).
For this listing I'll assume that geometry.

Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/mmcblk0p1          0+   1946-   1947-  15633408    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          0       -       0          0    0  Empty
/dev/mmcblk0p3          0       -       0          0    0  Empty
/dev/mmcblk0p4          0       -       0          0    0  Empty

LVM-logische Volumes (LVs) können meines Wissens nicht bootfähig sein und das Sternchen *gilt auch für diese anderen Medientypen, wie etwa SD-Karten.

verwandte Informationen