在编程上,如何检查lun节点是否是引导卷( lun节点是在/dev/下在Linux系统上创建的(例如RHEL或Ubuntu或任何其他linux风格)。
据我所知,有一种方法可以使用dd、hexdump、file等实用工具进行检查,或者通过编程方式读取前512个字节等(从lun节点检查/读取头512个字节)。
有没有其他有效的方法来做到这一点?提前谢谢。
发布于 2014-06-28 18:47:00
在确定一个分区是否可引导方面,可以使用sfdisk来标识这一点:
$ 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任何可引导的,都会在输出的第二列中有一个*。对于其他类型的设备,如LVM和SD卡:
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逻辑卷(LVM逻辑卷,LVM)不能引导,*也适用于这些其他类型的媒体,如SD卡。
https://unix.stackexchange.com/questions/139245
复制相似问题