分区工具,输出与/proc/partitions类似
显示硬盘的磁头,磁柱名义都是逻辑上的,称LBA地址,是由CHS转换过来的.
选项:
-l [device] 显示设备的分区信息
[device] 进行分区操作
显示硬盘的磁头,磁柱名义都是逻辑上的,称LBA地址,是由CHS转换过来的.
选项:
-l [device] 显示设备的分区信息
[device] 进行分区操作
root@zhentao-desktop:~# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
root@zhentao-desktop:~# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x00037c48
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 96256 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 1306 10386433 5 Extended
/dev/sda5 13 137 999424 82 Linux swap / Solaris
/dev/sda6 137 259 975872 83 Linux
/dev/sda7 259 1306 8409088 83 Linux
root@zhentao-desktop:~# cat /proc/partitions
major minor #blocks name
8 0 10485760 sda
8 1 96256 sda1
8 2 1 sda2
8 5 999424 sda5
8 6 975872 sda6
8 7 8409088 sda7
root@zhentao-desktop:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 8276936 2674300 5182184 35% /
none 248640 232 248408 1% /dev
none 254236 240 253996 1% /dev/shm
none 254236 104 254132 1% /var/run
none 254236 0 254236 0% /var/lock
/dev/sda1 93207 42836 45559 49% /boot
/dev/sda6 960504 613192 298520 68% /home
sz 35840980 18749180 17091800 53% /media/sf_sz
附:硬盘相关概念
相关概念:磁头<heads>,磁柱<cylinder>,扇区<sector>,磁道<track>
1.硬盘有单碟,多碟之分;这里的碟指的是磁片
磁头 每张磁片正反面都有一个磁头
磁道 磁片中半径相同的磁轨
磁柱 所有磁片相同的磁道构成磁柱
分区的最小单位
分区记录的是起始磁柱和结束磁柱
扇区 从圆心向外划直线,即将磁道细分为一个又一个的扇区
块 分区时指定的逻辑区块大小,为扇区大小倍数;改善每次读写一个扇区效率过低
2.主要启动扇区MBR
master boot recorder
位于硬盘的0磁柱
3.磁盘容量=磁头数*磁柱数*扇区数*512
参考: http://www.c-jump.com/CIS24/Slides/DiskDrives/DiskDrives.html