Linux formatted hard disk commonly used commands Xiao Kee __linux

Source: Internet
Author: User
Today, a new egg on the order of a 1TB hard drive to install Ubuntu, of course, the first to do homework, check the attention.

Basic skills, formatting commands, to format/DEV/SDA1 partitions as an example:
$ sudo umount/dev/sda1 # You must uninstall the partition first

# formatted as a FAT partition
$ sudo mkfs.vfat-f 32/dev/sda1 #-F argument must be capitalized, with parameters of 12, 16 and 32, respectively corresponding to Fat12,fat16,fat32.

# formatted as an NTFS partition, install Ntfsprogs First, take Ubuntu/debian as an example:
$ sudo apt-get install Ntfsprogs

#然后执行格式化命令, to format/dev/sda1 partitions as an example:
$ sudo umount/dev/sda1 # You must uninstall the partition first
$ sudo mkfs.ntfs/dev/sda1 # formatted as NTFS is a bit slow.

# Formatted as EXT4/3/2 to format the/DEV/SDA1 partition as an example:
$ sudo umount/dev/sda1 # You must uninstall the partition first
$ sudo mkfs.ext4/dev/sda1 # formatted as EXT4 partition
$ sudo mkfs.ext3/dev/sda1 # formatted as EXT3 partition
$ sudo mkfs.ext2/dev/sda1 # formatted as EXT2 partition

Because the EXT series of partitions have a give Super user reserved space, must occupy a certain percentage, the default 5%, so that the format of small partitions do not feel, 5% also not much, but if it is hundreds of g,1t partition will have problems, in this case,5% But not a small number AH.

"Workaround"

First, for the partition to be formatted, take ext3 as an example:
$ sudo umount/dev/sda1 # You must first uninstall the partition, where you want to format the/DEV/SDA1 partition.
$ sudo mkfs.ext3-m 0.05/dev/sda1 # Note-M after the parameter, set is already percentile, here set to 0.05, is 0.05%, namely extremely 5.

OK, so take the 1T partition as an example, 1T=1024GB=1048576MB (all are multiplied by the 1024 relationship), 1048576MB*0.0005=524.288MB.

That is to say, after setting the-m parameter, the retention area is about 524MB. Of course you can set it according to your preferences.

Second, the partition has been formatted, and do not want to wipe out the data in the partition, you can use the Tune2fs-m method:
# This command does not need to uninstall the partition first.
$ sudo tune2fs-m 0.05/dev/sda2 # This example is a super user reservation for converting/DEV/SDA2 partitions, which is also set to 0.05, in the reminder once, is 0.05%, which is extremely 5.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.