Mke2fsk 命令
光分区了还不算, 还要给分的区建立一种格式, 让磁盘有组织有纪律的存放文件.
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.
看吧, 找不到superblock
, 话说这个superblock
是个什么?
A superblock is a record of the characteristics of a filesystem, including its size, the block size, the empty and the filled blocks and their respective counts, the size and location of the inode tables, the disk block map and usage information, and the size of the block groups.
可以简单地理解为一张大饼表, 上面记录了各种文件的信息, 系统的信息, 谁放在哪儿了, 哪里还有空位子, 等等等等…
然后我们开始格式化这个分区:
# mke2fs /dev/sda1
说道格式化分区, Gparted
实在是一个不可多得的好工具.
# 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.
这里来一点注释:
-m 0
设置保留块的百分比为0, 默认是5%. 保留的地方是给root的.-b 4096
设置每一块多少比特, 可用的有1024, 2048 和 4096.
上面的过程, 创建了一个ext2
的分区.
你可以用下面的两条命令来创建ext3
的分区:
# mkfs.ext3 /dev/sda1
# mke2fs –j /dev/sda1
当然, 还是推荐使用Gparted
, 图形化, 更直观.