fdisk 输出解释
# fdisk -l
Disk /dev/sda: 1.1 TiB, 1200210141184 bytes, 2344160432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disklabel type: gpt
Disk identifier: D29C9FE4-3872-4296-AF86-ED271AA22229
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disklabel type: gpt
Disk identifier: D29C9FE4-3872-4296-AF86-ED271AA22229
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 2277318655 2276268032 1.1T Linux filesystem
/dev/sda3 2277318656 2344159231 66840576 31.9G Linux swap
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 2277318655 2276268032 1.1T Linux filesystem
/dev/sda3 2277318656 2344159231 66840576 31.9G Linux swap
heads/sectors/cylinders,分别就是磁头/扇区/柱面,每个扇区512byte(现在新的硬盘每个扇区有4K)了
硬盘容量就是heads*sectors*cylinders*512=255*63*17844*512=146771896320b=146.7G
硬盘容量就是heads*sectors*cylinders*512=255*63*17844*512=146771896320b=146.7G
硬盘的最小存储单位是扇区,硬盘本身没有block的概念
文件系统
文件系统若按照一个扇区一个扇区读数据速度太慢,所以有了block(块)的概念,是一个块一个块读取的, block才是文件存取的最小单位。
# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
udev devtmpfs 16373320 0 16373320 0% /dev
tmpfs tmpfs 3280540 3260 3277280 1% /run
/dev/sda2 ext4 1120143396 813369320 249850992 77% /
tmpfs tmpfs 16402684 133916 16268768 1% /dev/shm
tmpfs tmpfs 5120 0 5120 0% /run/lock
udev devtmpfs 16373320 0 16373320 0% /dev
tmpfs tmpfs 3280540 3260 3277280 1% /run
/dev/sda2 ext4 1120143396 813369320 249850992 77% /
tmpfs tmpfs 16402684 133916 16268768 1% /dev/shm
tmpfs tmpfs 5120 0 5120 0% /run/lock
# sudo tune2fs -l /dev/sda2 |grep "Block size"
Block size: 4096
Block size: 4096
一个block是4K,该文件系统中1个块是由连续的8个扇区组成。
扇区是对硬盘而言,块是对文件系统而言。