LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Losing 4Gb on Debian LVM? (https://www.linuxquestions.org/questions/linux-newbie-8/losing-4gb-on-debian-lvm-4175584654/)

mozer 07-14-2016 01:43 PM

Losing 4Gb on Debian LVM?
 
Hello all,

I'm creating LVM in the following way,

pvcreate /dev/sdc (a virtual disk of 275G)
Quote:

Physical volume "/dev/sdc" successfully created
vgcreate vg_test /dev/sdc
Quote:

Volume group "vg_test" successfully created
lvcreate -n lv_test -l 100%FREE vg_test
Quote:

Logical volume "lv_test" created
Quote:

root@debian:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sdc vg_test lvm2 a-- 275.00g 0
Quote:

root@debian:~# vgs
VG #PV #LV #SN Attr VSize VFree
vg_test 1 1 0 wz--n- 275.00g 0
Quote:

root@debian:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_test vg_test -wi-a----- 275.00g
Then i proceed to create an ext4 fs

mkfs.ext4 /dev/mapper/vg_test-lv_test (everything OK)

and when i mount it...

/dev/mapper/vg_test-lv_test 271G 63M 257G 1% /mnt

Why do i loose 4 GB in the process? is this normal? 4 GB?

It's a LOT of space...

I tried creating a partition of 275GB with the same results..I'm just confused

Cheers!!

smallpond 07-14-2016 01:57 PM

df shows space available to non-privileged users. The default is to reserve some space for privileged use. For example:

Code:

df |grep home
/dev/mapper/vg_ntt2-lv_home
                    205261560  27068952 167742896  14% /home
sudo tune2fs -l /dev/mapper/vg_ntt2-lv_home |grep 'lock count:'
Block count:              52166656
Reserved block count:    2608332


michaelk 07-14-2016 02:18 PM

To elaborate on the above 5% is reserved for root when ext2/3/4 filesystems are created. That 5% is not included in the output of the df command so the numbers do not add up. 5% is 13GB.

The difference in the logical volume size versus filesystem size is overhead i.e. metadata. 1.5-2% for ext4 if I remember correctly is normal.

syg00 07-14-2016 06:53 PM

And for a data filesystem, the reserved is pointless - set it to zero using tune2fs.
Note if you plan on running the filesystem really full (95% say) all the time and actively adding/deleting files (all the time) maybe you need some reserved. Never needed to in real life.

jpollard 07-14-2016 07:22 PM

You also loose space to support the inode list, block allocation maps, and the journal.

These are necessary to manage files in the filesystem and recover from system crashes/power failures.


All times are GMT -5. The time now is 05:00 PM.