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

Release: 2020-02-29 08:28:47
Original
15489 people have browsed it

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    # 必须先卸载该分区
Copy after login

Recommendation: Linux self-study video

Format to FAT partition

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

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

$ sudo apt-get install ntfsprogs
Copy after login

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速度有点慢。
Copy after login

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分区
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template