首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >检查启动量

检查启动量
EN

Unix & Linux用户
提问于 2014-06-25 23:23:46
回答 1查看 245关注 0票数 2

在编程上,如何检查lun节点是否是引导卷( lun节点是在/dev/下在Linux系统上创建的(例如RHEL或Ubuntu或任何其他linux风格)。

据我所知,有一种方法可以使用ddhexdumpfile等实用工具进行检查,或者通过编程方式读取前512个字节等(从lun节点检查/读取头512个字节)。

有没有其他有效的方法来做到这一点?提前谢谢。

EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2014-06-28 18:47:00

在确定一个分区是否可引导方面,可以使用sfdisk来标识这一点:

代码语言:javascript
复制
$ 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卡:

代码语言:javascript
复制
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卡。

票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/139245

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档