Free up space in Linux & Reserved block size in Linux


Problem:

root@ServerA# df -h
Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1              99M   13M   85M  14% /boot
none                  2.9G     0  2.9G   0% /dev/shm
/dev/sda1             148G  146G  1.1G 100% /u01
/dev/sdb1              74G   71G  2.2G  98% /u02
/dev/sdc1              74G   71G  1.6G  98% /u03

The above disk status shows that /dev/sda1 is 100% used but still there is 1.1G free space available.

solution:

This is because of reserved block unix size in linux.

#tune2fs -m 1 /dev/sda1



What is reserved Blocks ?

Reserved blocks are disk blocks reserved by the kernel for processes owned by privileged users to prevent operating system from a crash due to unavailability of storage space for critical processes. 
For example, just imagine the size of root file system is 14 GB and the root file system is 100% full, all the non privileged user processes would not be able to write data to the root file system whereas processes which are owned by  privileged user (root by default) would still be able to write the data to the file system. With the help of reserved blocks, operating system keeps running for hours or sometimes days even though root file system is 100% full.

The default percentage of reserved block is 5 % of the total size of file system and can be increased or decreased based upon the requirement.

Reserved blocks are supported on ext2 and ext3 file system(s)


How to check how many blocks are reserved :

#dumpe2fs -h /dev/VolGroup00/LogVol00  | grep -i block

dumpe2fs 1.39 (29-May-2006)
Block count: 3637248
Reserved block count:  181862
Free blocks: 2709898
First block:  0
Block size:  4096
Reserved GDT blocks:  887
Blocks per group:  32768
Inode blocks per group:   1024
Reserved blocks uid:  0 (user root)
Reserved blocks gid:  0 (group root)
Journal backup:   inode blocks

In above example, Block Count (Total Blocks) = 3637248 and Reserved Block Count = 181862 so the reserved block percentage option is set to 181862/3637248*100 i.e. 5 % (default value).

(or)

# tune2fs -l /dev/sdb1


How to change reserved block percentage value :



The value for Reserved Block Percentage can be set at the time of creating the file system as well as after creating the file system.


1) At the time of creation of file-system:

# mkfs.ext3 -m 1/dev/sda2 (replace sda2 with your partition name)


2) To set the reserved block percentage value after creating file system, use the following command

# tune2fs -m 3 /dev/VolGroup00/LogVol00

Above command would set the reserved block percentage value to 3 % of total block count. Which user can access reserved blocks



Post a Comment

0 Comments