Linux下使用mke2fsk格式化分區(qū)的方法
上一篇,我們在Linux下用fdisk實現(xiàn)了硬盤的分區(qū),在硬盤分區(qū)后,硬盤沒有被格式化,因此,分區(qū)尚不能使用。在這個階段,如果我們嘗試去查看硬盤信息的話,系統(tǒng)將會給出以下的錯誤信息說明有效的超級塊(superblock)不存在:
# tune2fs -l /dev/sda1
tune2fs 1.35 (28-Feb-2004)
tune2fs: Bad magic number in super-block while trying to open /dev/sda1
Couldn't find valid filesystem superblock.
可以使用mke2fs來格式化硬盤。
# mke2fs /dev/sda1
你也可以在mke2fs中使用如下參數(shù) :
1) -m 0 : reserved-blocks-percentage –這個用來指示文件系統(tǒng)保留給根用戶的塊的比例。默認(rèn)情況下是5%。在下面的例子中,它設(shè)置為0 。
2) -b 4096 : block-size specified in bytes. 有效值為每個塊 1024,2048 或 4096 字節(jié)。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# mke2fs -m 0 -b 4096 /dev/sda1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
205344 inodes, 70069497 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=71303168
2139 block groups
32768 blocks per group, 32768 fragments per group
96 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
|
以上命令會創(chuàng)建一個ext2的文件系統(tǒng)。如果想創(chuàng)建ext3文件系統(tǒng)則用如下命令:
# mkfs.ext3 /dev/sda1
# mke2fs –j /dev/sda1
這樣,我們就在Linux下用mke2fsk完成了格式化。
【編輯推薦】