【LINUX】磁碟格式化 建立檔案系統

楊奇龍發表於2010-12-03

格式化磁碟,將磁碟分割槽以後就要將磁碟格式化,否則是無法使用的。
[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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-680898/,如需轉載,請註明出處,否則將追究法律責任。

相關文章