Most file systems retain a portion of the space for emergency purposes (such as when the hard disk space is full). This ensures that some key applications (such as databases) have room when the hard disk is full, instead, crash will immediately give the monitoring system and administrator some time to notice. However, sometimes the reserved hard disk space is a waste. How can we release the space reserved by this sub-system? In the Linux ext2/ext3/ext4 file system, 5% hard disk space is usually reserved by default. If the hard disk is 4 TB, 200 GB space is wasted, we can use tune2fs to change the default setting of 5%, for example, reserve only 1% of the space. Can it be set to 0%? Yes, but it is not recommended. View the current hard disk space at www.2cto.com: # df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/vg_cloud22-lv_root 32G 1.1G 30G 4%/tmpfs 24G 0 24G 0%/dev/shm/dev/sda1 485 M 68 M 392 M 15%/boot/dev/mapper/vg_cloud22-lv_home 3.2G 70 M 2.9G 3%/home/dev/sdd1 1008G 161G 797G 17%/var/cloud Adjustment /dev/sdd1, reserve only 1% of the Space: # tune2fs-m 1/dev/sdd1tune2fs 1.41.12 (17-May-2010) Setting reserved blocks percentage to 1% (2684381 blocks)
After adjustment, check the released hard disk space and find that there is an extra space of 838-797 = 41 GB: www.2cto.com # df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/vg_cloud22-lv_root 32G 1.1G 30G 4%/tmpfs 24G 0 24G 0%/dev/shm/dev/ sda1 485 M 68 M 392 M 15%/boot/dev/mapper/vg_cloud22-lv_home 3.2G 70 M 2.9G 3%/home/dev/sdd1 1008G 161G 838G 17%/var/cloud