What is the the maximum logical volume size?
I am tring to figure out what the maximum logical volume size is. The vgcreate man page says:
To limit kernel memory usage, there is a limit of 65536 physical extents (PE) per logical volume, so the PE size determines the maximum logical volume size. The default PE size of 4MB limits a single logical volume to 256GB. There is also (as of Linux 2.4) a kernel limitation of 2TB per block device.
Which implies that the limit is 2 TB on my 2.4 system. However in tools/lib/lvm.h for version 0.9.1_beta7, it states:
/*
* LVM_PE_T_MAX corresponds to:
*
* 8KB PE size can map a ~512 MB logical volume at the cost of 1MB memory, *
* 128MB PE size can map a 8TB logical volume at the same cost of memory. *
* Default PE size of 4 MB gives a maximum logical volume size of 256 GB. *
* Maximum PE size of 16GB gives a maximum logical volume size of 1024 TB. *
* AFAIK, the actual kernels limit this to 1 TB.
*
* Should be a sufficient spectrum ;*)
*/
Which tells me it is 1 TB.
In the same file:
#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > ( l ong long) 1024*1024/SECTOR_SIZE*1024*1024 ? \
( long long) 1024*1024/SECTOR_SIZE*1024*1024 : \
( long long) LVM_PE_T_MAX * (a)->pe_size)
Which says we can have at most 1024*1024/SECTOR_SIZE*1024*1024 or 2GBs of sectors or blocks?.
vg_show.c used in vgdisplay then converts this value with the call:
( LVM_LV_SIZE_MAX(vg) / 2, SHORT);
vgdisplay then shows this as 1 TB (assuming you have a large enough extent size). So I am not sure whether there is an incorrect calculation in the define, an incorrect calculation in vg_show.c, or if the man page is incorrect and the kernel limit is actually 1 TB. If the man page is wrong, why only 1 TB. 1 >> 32 * (512 sector size) should give 2 TB's.
Andrew Patterson
Quoted 1 line · Andrew PAtterson
I am tring to figure out what the maximum logical volume size is.
It may be 1 TB or it may be 2TB. Depends on whether all of the code in use use uses unsigned longs for block numbers, or if some use signed longs. 2TB is the outer limit for now (unless you start playing games inside LVM, to have 4kB hard sector size, and remap to the disk 512 byte sector size).
Does it really matter? This is PER LV, so if you really need to have an LV that large, give it a try and let us know what works. I've seen a report of someone with a 1 TB device (some kind of HW RAID, not LVM) under Linux, so I know that works, but I haven't seen larger yet.
I wouldn't want to be keeping all of my eggs in such a large basket. I'd much rather have several smaller filesystems, especially since you STILL need to fsck on occasion (don't let reiserfs journaling fool you, you can still have SW/HW problems that will corrupt the filesystem).
Cheers, Andreas
Signature · 3 lines
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert