Home >Operation and Maintenance >Linux Operation and Maintenance >What is the command to format a hard disk in Linux?

What is the command to format a hard disk in Linux?

尚
Original
2020-02-29 08:28:4715495browse

What is the command to format a hard disk in Linux?

Formatting command, take formatting the /dev/sda1 partition as an example:

$ sudo umount /dev/sda1    # 必须先卸载该分区

Recommendation: Linux self-study video

Format to FAT partition

$ sudo mkfs.vfat -F 32 /dev/sda1       # -F 参数必须大写,参数有 12,16 和 32,分别对应 FAT12,FAT16,FAT32。

To format to NTFS partition, you must first install ntfsprogs, take Ubuntu/Debian as an example:

$ sudo apt-get install ntfsprogs

Then execute the format format command, take formatting the /dev/sda1 partition as an example:

$ sudo umount /dev/sda1       # 必须先卸载该分区
$ sudo mkfs.ntfs /dev/sda1        # 格式化为ntfs速度有点慢。

Format to ext4/3/2, take formatting the /dev/sda1 partition as an example:

$ sudo umount /dev/sda1       # 必须先卸载该分区
$ sudo mkfs.ext4 /dev/sda1    # 格式化为ext4分区
$ sudo mkfs.ext3 /dev/sda1    # 格式化为ext3分区
$ sudo mkfs.ext2 /dev/sda1    # 格式化为ext2分区

PHP中文网, a large number of Introduction to Programming tutorials, welcome to learn!

The above is the detailed content of What is the command to format a hard disk in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn