linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] The size specified by "lvcreate -L" is not accurate
@ 2021-09-02  3:26 Yu, Mingli
  2021-09-02 13:24 ` Gionatan Danti
  0 siblings, 1 reply; 3+ messages in thread
From: Yu, Mingli @ 2021-09-02  3:26 UTC (permalink / raw)
  To: linux-lvm


[-- Attachment #1.1: Type: text/plain, Size: 635 bytes --]

Per https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/doc/RelNotes/v1.46.4.txt, after e2fsprogs upgrades to 1.46.4, the defaults for mke2fs now call for 256 byte inodes for all file systems (with the exception of file systems for the GNU Hurd, which only supports 128 byte inodes) and use "lvcreate -L 50 -n lv_test1 vg_test && mke2fs /dev/vg_test/lv_test1" and then continue to check the partiontion as below.(use lvm2 2.03.11 for the test)
# df -h | grep dev/mapper/vg_test-lv_test1
/dev/mapper/vg_test-lv_test1   48M   14K   46M   1% /mnt/lv-test

Though claim 50M as above, but it turns out to be only 48M.

Thanks,

[-- Attachment #1.2: Type: text/html, Size: 1817 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] The size specified by "lvcreate -L" is not accurate
  2021-09-02  3:26 [linux-lvm] The size specified by "lvcreate -L" is not accurate Yu, Mingli
@ 2021-09-02 13:24 ` Gionatan Danti
  2021-09-02 14:23   ` Zdenek Kabelac
  0 siblings, 1 reply; 3+ messages in thread
From: Gionatan Danti @ 2021-09-02 13:24 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: Yu, Mingli

Il 2021-09-02 05:26 Yu, Mingli ha scritto:
> Per
> https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/doc/RelNotes/v1.46.4.txt
> [1], after e2fsprogs upgrades to 1.46.4, the defaults for mke2fs now
> call for 256 byte inodes for all file systems (with the exception of
> file systems for the GNU Hurd, which only supports 128 byte inodes)
> and use "lvcreate -L 50 -n lv_test1 vg_test && mke2fs
> /dev/vg_test/lv_test1" and then continue to check the partiontion as
> below.(use lvm2 2.03.11 for the test)
>  # df -h | grep dev/mapper/vg_test-lv_test1
> 
>  /dev/mapper/vg_test-lv_test1   48M   14K   46M   1% /mnt/lv-test
> 
>  Though claim 50M as above, but it turns out to be only 48M.

I think that allocation are done in multiple of physical extent size 
which, by default, is at 4 MB.
50 is not a multiple of 4 while 48 is, so "lvcreate" probably rounded 
down the required size.
Using one or more "-v" should bring progressively more details.

Regards.

-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti@assyoma.it - info@assyoma.it
GPG public key ID: FF5F32A8

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] The size specified by "lvcreate -L" is not accurate
  2021-09-02 13:24 ` Gionatan Danti
@ 2021-09-02 14:23   ` Zdenek Kabelac
  0 siblings, 0 replies; 3+ messages in thread
From: Zdenek Kabelac @ 2021-09-02 14:23 UTC (permalink / raw)
  To: LVM general discussion and development, Gionatan Danti; +Cc: Yu, Mingli

Dne 02. 09. 21 v 15:24 Gionatan Danti napsal(a):
> Il 2021-09-02 05:26 Yu, Mingli ha scritto:
>> Per
>> https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/doc/RelNotes/v1.46.4.txt 
>>
>> [1], after e2fsprogs upgrades to 1.46.4, the defaults for mke2fs now
>> call for 256 byte inodes for all file systems (with the exception of
>> file systems for the GNU Hurd, which only supports 128 byte inodes)
>> and use "lvcreate -L 50 -n lv_test1 vg_test && mke2fs
>> /dev/vg_test/lv_test1" and then continue to check the partiontion as
>> below.(use lvm2 2.03.11 for the test)
>>  # df -h | grep dev/mapper/vg_test-lv_test1
>>
>>  /dev/mapper/vg_test-lv_test1   48M   14K   46M   1% /mnt/lv-test
>>
>>  Though claim 50M as above, but it turns out to be only 48M.
> 
> I think that allocation are done in multiple of physical extent size which, by 
> default, is at 4 MB.
> 50 is not a multiple of 4 while 48 is, so "lvcreate" probably rounded down the 
> required size.
> Using one or more "-v" should bring progressively more details.
> 


Hi

As correctly pointed out by Gionatan - lvm2 allocates LVs in 'extent_size' 
allocation units.

So with default 4M - you could have either 48M or 52M.

In your case - you likely get 52M (as that's how lvm2 behaves - you get at 
least specified amount of space rounded up to nearest extent -  see output of 
'lvs' command.

However your formatted extX volume also does have some internal 'filesystem' 
metadata - so  LV of size 52M gives  reduced ext4 space to 48M in your case
as most likely 'ext4' header size 'cuts' away possibly 4M alignment
used by ext4.


Anyway - you if you care about max usage of every single byte on your storage 
- you could further tune/lower lvm2 metadata size + alignment + extent_size 
and also same you could tuning you could try with ext4 settings.

This way you could take back some wasted space on alignments - which normally 
is negligible amount of disk space on modern  high capacity sized drives.

Regards

Zdenek

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-02 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02  3:26 [linux-lvm] The size specified by "lvcreate -L" is not accurate Yu, Mingli
2021-09-02 13:24 ` Gionatan Danti
2021-09-02 14:23   ` Zdenek Kabelac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).