1月 222017
 

by Rod Smith, [email protected]
Last Web page update: 3/11/2011
The GNU libparted library is an extremely important partitioning tool for Linux and some other operating systems (OSes). Programs such as the text-mode GNU Parted (aka parted) and the GUI GNOME Partition Editor (aka GParted) are built atop libparted, as are the partitioning tools employed by many Linux distributions’ installation routines.

Unfortunately, although libparted has many very useful features, it also has some bugs and limitations. Some of these motivated me to write my own partitioning tool for GUID Partition Table (GPT) disks, GPT fdisk. Another issue motivates this Web page: GParted sometimes claims that disks have no partitions, even though other tools, such as the Linux kernel and the fdisk utility, clearly see partitions on the disk. This problem has been cropping up a lot lately on Web forums. Continue reading »

1月 222017
 


Cylinder 柱面数 表示硬盘每面盘面上有几条磁道。
Head 磁头数 表示磁盘共有几个磁头,也就是几面盘面。
Sector/Track 扇区数 表示每条磁道上有几个扇区。
逻辑区块 Block:逻辑区块 是在 partition 进行 filesystem 的格式化时,所指定的最小存储单位。Block 的大小为 Sector 的 2 的次方倍数。磁头一次可以读取一个 block。

看 fdisk -l 的输出例子:

Disk /dev/vm_storage_pool_vg/vm4: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00014b4f

Device Boot Start End Blocks Id System
/dev/vm_storage_pool_vg/vm4p1 * 1 66 524288 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vm_storage_pool_vg/vm4p2 66 588 4194304 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/vm_storage_pool_vg/vm4p3 588 2350 14154752 8e Linux LVM

这里有 255 个磁头,每个磁道有 63 个扇区,一个盘片有 2349 个磁道。

一个扇区的大小是 512 bytes。

计算一下,255 * 63 * 512 * 2349 = 19321182720 bytes,和 19327352832 有点差距(为什么?)。

看 Units 这一行,16065 = 255 * 63,是 Sector/Track 和 Head 的乘积,它再乘以 Sector 大小(512 bytes) 即是 Units,它表示一个垂直 Cylinder 的字节数。

另外,fdisk -l 使用 cylinders,加上 -u 表示使用 sectors。

-u When listing partition tables, give sizes in sectors instead of cylinders. Continue reading »