24 Nov 2014
1.1 命令:mkfs
作用:创建linux文件系统(格式化分区)
语法:
mkfs [-t] 分区
如无-t,默认为ext2
mkfs.xxx 分区
xxx为格式名称,下图为不同格式的相应命令
用法举例:
# mkfs指定分区格式 mkfs -t ext4 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 328656 inodes, 1313305 blocks 65665 blocks (5.00%) reserved for the super user # 预留5%的容量给root在磁盘满了的情况下使用 First data block=0 Maximum filesystem blocks=1346371584 41 block groups 32768 blocks per group, 32768 fragments per group 8016 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. # 使用mkfs.xxx方式格式化磁盘 # 查看所有mkfs命令,在输入"mkfs."后连续按下两次tab键 mkfs.[tab][tab] mkfs.cramfs mkfs.ext3 mkfs.ext4dev mkfs.ext2 mkfs.ext4 mkfs.xfs # 格式化sdb2为ext4格式 mkfs.ext4 /dev/sdb2 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 66384 inodes, 265072 blocks 13253 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=272629760 9 block groups 32768 blocks per group, 32768 fragments per group 7376 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 31 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. # 格式化sdb3为xfs格式 mkfs.xfs /dev/sdb3 meta-data=/dev/sdb3 isize=256 agcount=4, agsize=66268 blks = sectsz=512 attr=2, projid32bit=0 data = bsize=4096 blocks=265072, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0
1.2 mke2fs
作用:创建ext2、ext3或ext4文件系统
语法:mke2fs [参数] 分区
参数:
用法举例:
mke2fs -t ext3 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux ...... This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. mke2fs -m 5 -t ext4 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) ...... 13253 blocks (5.00%) reserved for the super user ...... This filesystem will be automatically checked every 28 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.PS: # mke2fs有许多设定,必要时请man查询,来根据实际情况调用