格式化磁盘,将磁盘分区以后就要将磁盘格式化,否则是无法使用的。
[root@localhost ~]# mke2fs
-b:指定文件系统的block的大小,支持1024,2048,4096 bytes,默认4096 bytes
-i:多少容量分配一个inode
-j:默认的mke2fs 是ext2,加上-j 格式化为ext3 型文件系统。
-c:检查磁盘错误,-c 会很快进行测试,-c -c 则会以read-write方式进行测试,时间会很长的、
-L: 给文件系统一个标签。
#将/dev/sdb5 格式化为ext3 并且命名为logicl
[root@localhost ~]# mke2fs -j -L "logicl" /dev/sdb5
mke2fs 1.39 (29-May-2006)
Filesystem label=logical
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
100576 inodes, 200804 blocks
10040 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=209715200
7 block groups
32768 blocks per group, 32768 fragments per group
14368 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#将刚才的文件系统的block 改为2048 并且inode 改为4096
[root@localhost ~]# mke2fs -j -L "logical" -b 2048 -i 4096 /dev/sdb5
mke2fs 1.39 (29-May-2006)
Filesystem label=logical
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
201200 inodes, 401608 blocks
20080 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=412090368
25 block groups
16384 blocks per group, 16384 fragments per group
8048 inodes per group
Superblock backups stored on blocks:
16384, 49152, 81920, 114688, 147456
Writing inode tables: done
Creating journal (8192 blocks): 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.
#也可以将设备格式化为其他的格式,查看一下系统所支持的系统格式:
[root@localhost ~]# ls -l /sbin/mkfs*
-rwxr-xr-x 1 root root 7072 2007-01-12 /sbin/mkfs
-rwxr-xr-x 1 root root 18100 2007-01-12 /sbin/mkfs.cramfs
-rwxr-xr-x 3 root root 47288 2007-01-12 /sbin/mkfs.ext2
-rwxr-xr-x 3 root root 47288 2007-01-12 /sbin/mkfs.ext3
-rwxr-xr-x 3 root root 29672 2007-01-12 /sbin/mkfs.msdos
-rwxr-xr-x 3 root root 29672 2007-01-12 /sbin/mkfs.vfat
从上可以看出系统除了ext2,ext3以外所支持的文件系统vfat,msdos,cramfs