0

I have a new HDD attached to my machine (CentOS 7.6), 1TB in size.

  • I used fdisk to create a new primary partition there of size 500GB, type "8e" (Linux LVM).

  • I then marked it as an LVM physical volume: pvcreate /dev/<partitionID>

  • After that I created a volume group and added the partition to it: vgcreate vg1 /dev/<partitionID>

  • On top of that I created a logical volume that used up all the available space of the volume-group: lvcreate -n lv1 -l 100%FREE vg1

  • I then converted this logical volume to LUKS format: cryptsetup luksFormat /dev/vg1/lv1

  • Finally on top of that I added an ext4 filesystem: mkfs.ext4 /dev/vg1/lv1


It worked pretty well and, using the passphrase set up during LUKS format and with some /etc/fstab and /etc/crypttab magic, I was able to permanently mount it in /mnt/my_new_data.

All is fine, except an interesting problem. The command df -hT shows me something like this:

Filesystem            Type      Size  Used Avail Use% Mounted on
//..................
//..................
/dev/mapper/vg1-lv1   ext4      493G   73M  467G   1% /mnt/my_new_data

How come it says 493GB instead of 500GB? Also (most importantly): why is there only 467GB available? I didn't add any files yet in that directory. Since when is 467GB + 73MB = 493GB ?

Keep in mind that:

  • pvs reports 500GB as size for the physical volume
  • vgs reports 500GB as size for the volume group
  • lvs reports 500GB as szie for the logical volume
  • lsblk reports 500GB as size for that partition

Every tool says my disk should be 500GB in size. Except apparently I only have 467GB available.

What am I missing?

Could the LUKS encryption have anything to do with it?


EDIT: I may have found something. During creation of ext4 filesystem, there is something like this:

//......
Block size=4096 (log=2)
//......
32768000 inodes, 131070976 blocks
6553548 blocks (5.00%) reserved for the super user
//......

Well, 6553548 x 4KB per block size ~= about 25GB. This might explain a big part of what happened, though the math still doesn't really add it.

Which now begs the question what is that "reserved for the super user" part? Why is this needed?

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.