分区之后,并不能直接使用,需要格式化成特定的文件系统。

格式化(format)是指对磁盘或磁盘中的分区(partition)进行初始化的一种操作,这种操作通常会导致现有的磁盘或分区中所有的文件被清除。

1. mkfs

该命令用来在特定的分区创建linux文件系统,常见的文件系统有ext2,ext3,vfat等,执行mkfs命令其实是在调用:mkfs.ext3 | mkfs.reiserfs |mkfs.ext2 | mkdosfs | mkfs.msdos | mkfs.vfat ......

NAME

mkfs - build a Linux filesystem

SYNOPSIS

mkfs [options] [-t type] [fs-options] device [size]

DESCRIPTION

This  mkfs  frontend  is  deprecated  in  favour of filesystem specific

mkfs.<type> utils.

mkfs is used to build a Linux filesystem on a device,  usually  a  hard

disk  partition.   The  device argument is either the device name (e.g.

/dev/hda1, /dev/sdb2),  or  a  regular  file  that  shall  contain  the

filesystem.   The  size argument is the number of blocks to be used for

the filesystem.

In actuality, mkfs is simply a front-end  for  the  various  filesystem

builders  (mkfs.fstype) available under Linux.  The filesystem-specific

builder is searched for via your PATH environment setting only.  Please

see the filesystem-specific builder manual pages for further details.

baoli@ubuntu:~$ mkfs -h

Usage:

mkfs [options] [-t <type>] [fs-options] <device> [<size>]

Make a Linux filesystem.

Options:

-t, --type=<type>  filesystem type; when unspecified, ext2 is used

fs-options     parameters for the real filesystem builder

<device>       path to the device to be used

<size>         number of blocks to be used on the device

-V, --verbose      explain what is being done;

specifying -V more than once will cause a dry-run

-h, --help         display this help

-V, --version      display version

将sda1分区格式化为ext4格式:

mfks -t ext4  /dev/sda61

2. mke2fs

在磁盘分区上创建ext2、ext3、ext4文件系统,默认情况下会创建ext2。

mke2fs命令是专门用于管理ext系列文件系统的一个专门的工具。其还有像mkfs.ext2,mkfs.ext3,mkfs.ext4等衍生的命令,它们的用法mke2fs类似。

NAME

mke2fs - create an ext2/ext3/ext4 filesystem

SYNOPSIS

mke2fs  [ -c | -l filename ] [ -b block-size ] [ -C cluster-size ] [ -d

root-directory ] [ -D ] [ -g blocks-per-group ] [ -G number-of-groups ]

[  -i bytes-per-inode ] [ -I inode-size ] [ -j ] [ -J journal-options ]

[ -N number-of-inodes ] [ -n ] [ -m reserved-blocks-percentage ]  [  -o

creator-os ] [ -O [^]feature[,...]  ] [ -q ] [ -r fs-revision-level ] [

-E extended-options ] [ -v ] [ -F ] [ -L  volume-label  ]  [  -M  last-

mounted-directory ] [ -S ] [ -t fs-type ] [ -T usage-type ] [ -U UUID ]

[ -V ] [ -e errors-behavior ] [ -z undo_file ] device [ fs-size ]

mke2fs -O journal_dev [ -b block-size ] [ -L volume-label ] [ -n ] [ -q

] [ -v ] external-journal [ fs-size ]

DESCRIPTION

mke2fs  is used to create an ext2, ext3, or ext4 filesystem, usually in

a disk partition (or file) named by device.

The file system size is specified by fs-size.  If fs-size does not have

a  suffix,  it  is interpreted as power-of-two kilobytes, unless the -b

blocksize option is specified, in which case fs-size is interpreted  as

the  number  of  blocksize blocks.   If the fs-size is suffixed by 'k',

'm', 'g', 't' (either upper-case or lower-case), then it is interpreted

in  power-of-two  kilobytes,  megabytes, gigabytes, terabytes, etc.  If

fs-size is omitted, mke2fs will create the file  system  based  on  the

device size.

If mke2fs is run as mkfs.XXX (i.e., mkfs.ext2, mkfs.ext3, or mkfs.ext4)

the option -t XXX is implied; so mkfs.ext3 will create  a  file  system

for  use  with  ext3,  mkfs.ext4 will create a file system for use with

ext4, and so on.

The defaults of the parameters for the newly created filesystem, if not

overridden   by  the  options  listed  below,  are  controlled  by  the

/etc/mke2fs.conf configuration file.   See  the  mke2fs.conf(5)  manual

page for more details.

创建ext2 fs:

mke2fs /dev/sdb1

3. mkxxfs

mkntfs, the same as mkfs.ntfs

mkdosfs

mkinitramfs

mksquashfs

mkisofs

mkswap

mklost+found

mktemp

4. mkfs.xxx

mkfs.cramfs  mkfs.ext3    mkfs.fat     mkfs.msdos   mkfs.vfat

mkfs.bfs     mkfs.ext2    mkfs.ext4    mkfs.minix   mkfs.ntfs

4.1 mkfs.ext4

$ mkfs.ext4 -h

mkfs.ext4: invalid option -- 'h'

Usage: mkfs.ext4 [-c|-l filename] [-b block-size] [-C cluster-size]

[-i bytes-per-inode] [-I inode-size] [-J journal-options]

[-G flex-group-size] [-N number-of-inodes] [-d root-directory]

[-m reserved-blocks-percentage] [-o creator-os]

[-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]

[-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]

[-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file]

[-jnqvDFSV] device [blocks-count]

4.2 mkfs.vfat mkfs.fat

这个命令是格式化U盘的,vfat是文件系统类型,linux叫vfat, windows下叫FAT32 、 这样格完后,windows linux 默认都都能认识了。

vFAT与FAT向后兼容,但允许文件具有更长的名称, mkfs.vfat并且mkfs.fat是相同的工具。

NAME

mkfs.fat - create an MS-DOS filesystem under Linux

SYNOPSIS

mkfs.fat [OPTIONS] DEVICE [BLOCK-COUNT]

DESCRIPTION

mkfs.fat is used to create an MS-DOS filesystem under Linux on a device

(usually a disk partition).  DEVICE is the special  file  corresponding

to the device (e.g. /dev/sdXX).  BLOCK-COUNT is the number of blocks on

the device.  If omitted, mkfs.fat automatically determines the filesys‐

tem size.

$ mkfs.vfat --help

mkfs.fat 4.1 (2017-01-24)

Usage: mkfs.fat [-a][-A][-c][-C][-v][-I][-l bad-block-file][-b backup-boot-sector]

[-m boot-msg-file][-n volume-name][-i volume-id]

[-s sectors-per-cluster][-S logical-sector-size][-f number-of-FATs]

[-h hidden-sectors][-F fat-size][-r root-dir-entries][-R reserved-sectors]

[-M FAT-media-byte][-D drive_number]

[--invariant]

[--help]

/dev/name [blocks]

linux分区格式化命令相关推荐

  1. 250g硬盘linux分区,linux分区格式化命令使用方法

    linux分区格式化命令使用方法 首先使用root权限登陆进入linux操作界面 使用fdisk -l 参数查看设备名跟设备状态 类似如下 : [root@ecofe2 /]# fdisk -l Di ...

  2. linux格式化逻辑分区命令,Linux分区格式化的命令

    当硬盘分区完成后,需要对分区进行格式化. 使用mkfs工具对硬盘分区进行格式化,支持MBR和GPT两种分区表. 命令1:格式化sdb1分区为ext3格式 mkfs.ext3 /dev/sdb1 mke ...

  3. 格式化 命令 linux,Linux分区格式化的命令

    当硬盘分区完成后,需要对分区进行格式化. 使用mkfs工具对硬盘分区进行格式化,支持MBR和GPT两种分区表. 命令1:格式化sdb1分区为ext3格式 mkfs.ext3 /dev/sdb1 mke ...

  4. linux的格式化命令是什么,linux格式化命令如何使用

    若在-t 参数中指定ext2,我们再来介绍 mkfs.ext3 mkfs.reiserfs mkfs.ext2 mkdosfs mkfs.msdos mkfs.vfat ,例如, whichever ...

  5. linux的格式化命令是什么,linux格式化硬盘命令是什么?

    格式化命令,以格式化 /dev/sda1 分区为例:$ sudo umount /dev/sda1 # 必须先卸载该分区 格式化为 FAT 分区$ sudo mkfs.vfat -F 32 /dev/ ...

  6. Linux分区 fdisk命令

    原文地址:http://ethan163.iteye.com/blog/1109803 首先明确一点,linux根分区容量是不允许改变的,一旦改变,挂载根分区就找不到磁盘首尾位置,导致启动失败,所以为 ...

  7. linux时间格式化命令

    在Shell环境里,我们获取时间的命令是date,针对不同的业务场景,我们需要时间进行格式化处理. Linux系统常用的时间域 %Y年(例如:2020,2021等) %m月(01-12) %d一个月的 ...

  8. linux分区格式化慢,浅谈linux性能调优之三:分区格式化之前的考虑

    在Linux中进行格式化必须考虑Block与inode,Block还好理解,它是磁盘可以记录的最小单位,是由数个扇区组成,所以大小通常为n*512Bytes,例如4K. 那么inode是什么呢 ? B ...

  9. linux 分区 格式化 挂载 新硬盘

    2019独角兽企业重金招聘Python工程师标准>>> 1.给硬盘分区 fdisk /dev/sda Command (m for help): n Command action e ...

最新文章

  1. shell中的数值判断
  2. Java 工具集 Hutool 4.0.8 发布
  3. Ubuntu16.04下Hadoop 2.7.3的安装与配置
  4. 重置mysql密码的命令
  5. codeforce 589B枚举
  6. 并查集(加权规则、折叠规则)
  7. webview js 与 java 调用参数问题。
  8. jboss fuse 教程_在JBoss Fuse / Fabric8 / Karaf中使用Byteman
  9. Vue中使用axios的响应拦截器处理请求失败的情况(处理token过期问题)以及 登录成功跳转回原来页面问题
  10. python进程暂停_如何在Python中暂停多进程?
  11. OpenShift 4 - Knative教程(2) 基于Revision/Tag/Traffic实现蓝绿部署和恢复发布
  12. web.xml详细配置
  13. 几行代码起家到实时音视频一线,6 岁声网计划赴美上市!
  14. 精通python工资高吗-2020年10月程序员工资再创新高
  15. Resteasy配置及其使用
  16. 斐波那契字符串_KMP
  17. Navicat连接Mysql报错:Client does not support authentication protocol requested by server;
  18. while循环语法结构
  19. Datakit.CrossManager.2023(2D/3D数据格式转换器)
  20. 找规律填数字(c++基础)

热门文章

  1. Linux手动设置网卡IP
  2. containerd配置下载镜像
  3. 计算机 应用期刊模板下载
  4. 苹果展开新显示器带动高阶需求:Mini LED背光技术
  5. sql查询 (连表查询)
  6. 如何往hive直接插入自定义数据values
  7. 网络协议——七层、五层、四层协议概念
  8. element-ui 使用自定义复选框
  9. 【基础知识】SPI通信协议
  10. idea 将分支代码合并到另一分支上