當(dāng)硬盤分區(qū)完成后,需要對分區(qū)進(jìn)行格式化。
使用mkfs工具對硬盤分區(qū)進(jìn)行格式化,支持mbr和gpt兩種分區(qū)表。
命令1:格式化sdb1分區(qū)為ext3格式
mkfs.ext3 /dev/sdb1
mke2fs 1.41.12 (17-may-2010)
文件系統(tǒng)標(biāo)簽=
操作系統(tǒng):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
第一個數(shù)據(jù)塊=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分區(qū)為ext4格式
mkfs -t ext4 /dev/sdb5
mke2fs 1.41.12 (17-may-2010)
文件系統(tǒng)標(biāo)簽=
操作系統(tǒng):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
第一個數(shù)據(jù)塊=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分區(qū)表磁盤中的擴(kuò)展分區(qū)不能格式化,即只能格式化主分區(qū)和邏輯分區(qū);
格式化操作是即時生效的,不需要重啟linux系統(tǒng),但此時用df命令并不能查看到磁盤的文件系統(tǒng)和類型,原因是還沒有進(jìn)行掛載。
df -ht /dev/sdb1
filesystem type size used avail use% mounted on
- - 492m 260k 491m 1% /dev