Thursday, March 12, 2009

066 使用mke2fsk格式化分区

分区之后还不能直接使用,我们必须对磁盘进行格式化。如果你现在就尝试查看磁盘内容的话,你会得到一个错误信息,它告诉你这不是一个有效的主磁盘。
# 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.

你可以使用下面的mke2fsk来格式化磁盘
# mke2fs /dev/sda1

mke2fs有如下参数:
-m 0 :这个参数可以指定预留给管理员用户的存储空间百分比,缺省是5%,在下面的例子中我们把它改成0。
-b 4096:指定字节块的大小。有效值是024, 2048 和 4096
# 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.

上面的命令创建了ext2格式的文件系统。要创建ext3格式,使用下面的命令;
# mkfs.ext3 /dev/sda1 

# mke2fs –j /dev/sda1

No comments:

Post a Comment