Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

mkfs 命令:在分區上創建文件系統

內容來源於人民郵電出版社《Linux 命令應用大詞典》。該書講述 729 個命令、1935 個例子,是學習 Linux 系統的參考書與案頭書,遇到不懂的命令或選項一查即可。

mkfs 命令

mkfs 用於在分區上創建各種類型的文件系統。它本身並不乾活,而是去調用對應的專用工具,例如 mkfs.ext4、mkfs.vfat 等,具體建哪種文件系統由參數指定。

mkfs [選項] [設備]

選項含義:

  • -t <文件系統類型>:指定文件系統類型。
  • -v:顯示詳細信息。
  • -l <文件>:從文件中讀取壞塊列表。
  • -c:創建文件系統之前檢查設備的壞塊。

示例一:為 /dev/sda5 創建 ext4 文件系統。

[root@rhel~]# mkfs -t ext4 /dev/sda5
mke2fs 1.41.12 (17-May-2010)
文件系統標簽=
操作系統:Linux
塊大小=4096(log=2)
6561792 inodes, 26215641 blocks
1310782 blocks (5.00%) reserved for the super user
第一個數據塊=0
Maximum filesystem blocks=4294967296
801 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
 4096000, 7962624, 11239424, 20480000, 23887872
正在寫入 inode 表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

示例二:格式化 /dev/sda5 並創建 ext3。

[root@rhel ~]# mkfs -t ext3 /dev/sda5

示例三:創建 vfat 文件系統。

[root@rhel ~]# mkfs -t vfat /dev/sda5

示例四:創建 msdos 文件系統。

[root@rhel ~]# mkfs -t msdos /dev/sda5

提醒一句:mkfs 會清空分區上的全部數據且不可恢復,執行前請務必確認設備名,尤其在有多塊磁盤的機器上。

本文出自「airfish2000」博客,請務必保留此出處 https://airfish2000.blog.51cto.com/10829608/1871744

Copyright © Linux教程網 All Rights Reserved