如何获取磁盘驱动器扇区大小
可以通过Linux API/ABI获取磁盘扇区的大小吗?这是关于I/O磁盘的量子,通常是相等的512个字节,但其他值也可以(通常是多个512字节)。 另外,它不应将逻辑块的大小或文件系统扇区的大小混淆。
块设备在UNIX(/dev/sda,/dev/sr等)的文件系统中反映为文件,这意味着可以打开该文件并对其内容进行一些操纵,例如与相应的块设备的内容一样。
因此,特别是对真实块设备的工作类似于虚拟硬盘(例如,.VHD格式)。 但是我不知道在通常的情况下如何获得行业的规模。 片刻,我单个解决方案:获得最大的CHS地址和硬盘驱动器的大小,这均通过BIOS操作。但是我认为这是坏主意,因为便携性丢失了
Can get size of disk sector via the Linux API/ABI? It's about the quantum of I/O disk, normally it's equal 512 bytes, but others values can be too (usually multiple 512 bytes).
Also it should not confuse to size of logical block or to size of sector of a file system.
A block device is reflected as file in a file system of an UNIX (/dev/sda, /dev/sr etc.) It means, can open that file and make some manipulations to its content like with content of the corresponded block device.
So specifically the work to a true block device similar the work to a virtual hard disk (the .vhd format for instance).
But i don't know how to get size of sector in general case.
At moment i've single solution: get the maximal CHS address and size of hard drive, both action via BIOS. But i think, it's bad idea, because portability lost
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论