當硬碟分區完成後,需要對分區進行格式化。
使用mkfs工具對硬碟分區進行格式化,支援MBR和GPT兩種分區表。
##指令1:格式化sdb1分區為ext3格式
mkfs.ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
檔案系統标簽=
作業系統:Linux
塊大小=4096 (log=2)
分塊大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
第一個資料塊=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
正在寫入inode表: 完成
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
##指令2:格式化sdb5分區為ext4格式
mkfs -t ext4 /dev/sdb5
mke2fs 1.41.12 (17-May-2010)
檔案系統标簽=
作業系統:Linux
塊大小=4096 (log=2)
分塊大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
第一個資料塊=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
正在寫入inode表: 完成
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
##p.s.
- MBR分區表磁盤中的擴充分區不能格式化,即隻能格式化主分區和邏輯分區;
- 格式化操作是即時生效的,不需要重新開機Linux系統,但此時用df指令并不能檢視到磁盤的檔案系統和類型,原因是還沒有進行挂載。
df -hT /dev/sdb1
Filesystem Type Size Used Avail Use% Mounted on
- - 492M 260K 491M 1% /dev