硬盤
CHS結構體系的硬盤
磁頭:Heads
柱面:Cylinders
扇區:Sector 每個扇區存儲512字節 (512B)
現在硬盤都採用ZBR技術:
ZBR(Zoned Bit Recording)區位記錄
操作系統讀取硬盤的時候,不會一個個扇區地讀區,這樣效率太低,而是一次性連續讀取多個扇區,即一次性讀取一個"塊"(block)。這種由多個扇區組成的"塊",是文件存取的最小單位。"塊"的大小,最常見的是1KB,即連2個sector組成一個block。4K=8(扇區)sector
查看系統塊大小
[root@localhost ~]# xfs_growfs -l /dev/sda3 |grep --color size (XFS文件系統查看明亮)
log size unchanged, skipping
meta-data=/dev/sda3 isize=256 agcount=4, agsize=3656896 blks
data = bsize=4096 blocks=14627584, imaxpct=25
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=7142, version=2
[root@localhost ~]# tune2fs -l /dev/sda3 | grep --color size (ext4文件系統查看命令)
磁盤管理
MBR:Master boot record 主引導記錄
硬盤的0柱面、0磁頭、第一個扇區稱爲主引導記錄(MBR)它由三個部分組成,主引導程序、硬盤分區表DPT(disk partition table)和分區有效標誌(55AA)。
在總共512字節的主引導記錄裏主引導程序(boot loader)佔446字節,分區表DPT佔用64字節16*4=64,magic number佔2個字節固定爲55AA
分區
添加磁盤步驟
添加設備 分區 格式化(創建文件系統) 「起名」修改配置文件 創建掛載點 掛載
fdisk
fdisk -l #查看磁盤信息
[root@localhost ~]# fdisk /dev/sdb #創建&管理分區
命令(輸入 m 獲取幫助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
e 擴展分區
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
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)