I am formatting a couple of 60G Logical Volumes (vg01-logs and vg01-monitoring) in one of our servers. These partitions will hold a large number of small files, so I want them with more than the default number of inodes.

root@mercury20:/root : lvs /dev/mapper/vg01-logs /dev/mapper/vg01-monitoring
  LV         VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  logs       vg01 -wi-ao---- 60.00g
  monitoring vg01 -wi-ao---- 60.00g

The vg01-logs is to be mounted on /logs. I formatted it in ext4 with -i 1024 (bytes-per-inode) option to create maximum number of inodes and as expected the partition had 62914560 inodes after formatting.

mkfs.ext4 -i 1024 /dev/vg01/logs

Post formatting and mounting:

root@mercury20:/root : tune2fs -l /dev/mapper/vg01-logs | egrep 'Inode count|Inode size'
Inode count:              62914560
Inode size:               256

root@mercury20:/root : df -h /logs
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/vg01-logs   45G   61M   42G   1% /logs

Now, after mounting the partition, df -h outputs the size of this 60G Logical Volume partition as 45G. ie. 15G is gone. Since inodes are of size 256 bytes, and 15G being 62914560*256 bytes, is that space (15G) is reserved for inode creation and therefore missing from df output?

The other Logical Volume vg01-monitoring, which is to be mounted on /monitoring, was formatted in XFS using mkfs.xfs with default options. The partition was created with the same number of inodes (62914560) as the ext4 partition, but here, post formatting and mounting, df -h shows the size of the drive as the original 60G. No missing 15G. xfs_info shows the size of the inode in this XFS partition as 256 bytes which is the same as in ext4.

root@mercury20:/root : mkfs.xfs -f /dev/mapper/vg01-monitoring

root@mercury20:/root : df -h /monitoring
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg01-monitoring   60G   33M   60G   1% /monitoring

root@mercury20:/root : xfs_info /dev/mapper/vg01-monitoring
meta-data=/dev/mapper/vg01-monitoring isize=256    agcount=4, agsize=3932160 blks

Here are my questions:

1) In the first case, that of the ext4 partition, is my assumption that df -h shows the space available as only 45G since 15G out of the 60G is reserved for inodes correct?

2) If my above assumption is correct, then why do XFS partition show 60G instead of 45G? Does it mean XFS will show the size consumed by inodes as 'Used' only when the inodes are created? Which at the end means, the effective space for user data on both the drives would be 45G though the XFS shows 60G available?

The OS is SUSE Linux Enterprise Server 12 (x86_64).

root@mercury20:/root : cat /etc/os-release

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.