Linux Disk reserve space adjustment, to solve the problem that DF sees the space and the actual disk size is inconsistent

Source: Internet
Author: User

The Linux hard disk partition program automatically retains a certain amount of disk space for root or specified users by default5%, this setting takes up too much unnecessary space on larger partitions or unimportant partitions, and with the MKE2FS-m reserved-percentage option, you can adjust this setting to get more disk space without compromising performance. After creating the file system, the user can use TUNE2FS to modify this setting such as Tune2fs-m 1/DEV/SDA4 can set the reserved space to 1%

Look at the man page of Mkfs.ext3, you can know the reason, among them, there is a sentence:
-M Reserved-blocks-percentage
Specify the percentage of the filesystem blocks reserved for the
Super-user. This avoids fragmentation, and allows root-owned
Daemons, such as SYSLOGD (8), to continue to function correctly
After non-privileged processes is prevented from writing to the
FileSystem. The default percentage is 5%.

Other wordsext file system, including Ext2, Ext3, EXT4, will default to 5% of the disk space, left to the root user to maintain the system or record the system critical log when used (such as the use of disk space is 100% of the case of processing), which is why some disk space is not available to ordinary users.

Such as:

$ df-hl/dev/sda6
Filesystem Size used Avail use% mounted on
/dev/sda6 42G 34G 5.8G 86%/linux/sda6

$tune2fs-m 0/dev/sda6
TUNE2FS 1.41.3 (12-oct-2008)
Setting reserved blocks percentage to 0% (0 blocks)

$ df-hl/dev/sda6
Filesystem Size used Avail use% mounted on
/dev/sda6 42G 34G 7.9G 81%/linux/sda6

Another specific procedure is as follows, with detailed comments already added:

--732463 blocks prior to the retention area.
# tune2fs-l/dev/sda7 | grep "Reserved block Count"
Reserved Block count:732463

-Less than 3 grams of space + free space and total space
# DF
File system 1k-block already used% mount point available
/dev/sda7 57677500 47662588 7085060 88%/Home

--Adjustment:
# Tune2fs-r 25600/DEV/SDA7
TUNE2FS 1.41.9 (22-aug-2009)
Setting reserved blocks count to 25600

--and look at the space.
# DF
File system 1k-block already used% mount point available
/dev/sda7 57677500 47662584 9912516 83%/Home

--Confirm the adjustment success
# sudo tune2fs-l/dev/sda7 | grep "Reserved block Count"
Reserved Block count:25600

More than 3G of space. and is not directly completely remove the reserved block, but also left a hundred trillion to prevent rainy.

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.