Skip to contentSkip to conversation

Max logical volume size 1TB or 2TB?

linux-lvm Andrew Patterson 4 participants 4 messages May 10, 2001

lore
Share & tools
lore
#0 lore raw

Well, I finally collected enough storage to test whether you can create a logical volume of greater than 1 TB. It didn't really dawn on me exactly how big a TB is until after collecting 75 18-36 GB drives together to get to something this size.

Anyway,

I patched LVM 0.9.1_beta7 lvm.h source a little to get past the system defined limits.

These are the changes I made:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

goes to:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

Note that I have multiplied by 2.

After installing and running a new kernel, I get the following error when running pvcreate on any of the disks:
<333> lvm_check_dev -- LEAVING with ret: 1
<22> pv_check_consistency -- LEAVING with ret: -222
<1> pv_write -- LEAVING with ret: -99
<1> lvm_error -- CALLED with: -99
<1> lvm_error -- LEAVING with: "parameter error"
pvcreate -- ERROR "parameter error" creating physical volume "/dev/sdc"

I then looked at tools/lib/pv_check_consistency.c and found:

   else if ( pv->pv_size > LVM_MAX_SIZE)
         ret = -LVM_EPV_CHECK_CONSISTENCY_PV_SIZE;

where

#define define LVM_EPV_CHECK_CONSISTENCY_PV_SIZE 222

Since all of my PV's are well under 2 TB, I believe that the LVM_MAX_SIZE macro is overflowing.

Incidently, I tried the same thing but left the LVM_MAX_SIZE macro unchanged. In this test, everything worked fine, except that I could not create a logical volume bigger than 1 TB. So it looks like Heinz's internal documentation is correct.

Again, Is there any reason that this number should not be 2 TB given that 2^32 * 512 = 2 TB? Other than not consistently using unsigned long longs?

Andrew

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Andrew Patterson Voice: (970) 898-3261
Hewlett-Packard Email: [email protected]

#1 lore raw
Quoted 10 lines · Andrew Patterson

I patched LVM 0.9.1_beta7 lvm.h source a little to get past the system defined limits.

These are the changes I made:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

I presume the originals should not have the *2 on them?

Quoted 7 lines

goes to:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

You probably want to go to something like (i.e. slightly less than 2GB):

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*2047 ? ( long long) 1024*1024/SECTOR_SIZE*1024*2047 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 2047)

The reason is that since we are talking about 512-byte sectors here, your original values are exactly 2^32, so this is probably overflowing a 32-bit value somewhere. Since the Linux block layer limits you to 2TB anyways, it is not a real issue for the LVM limit to be slightly less than 2TB. How much less depends on how many more disks you have... Probably any value <= 2^32-1 should be OK.

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
#2 lore raw

Hmm, I could help out on this one also, since I've access to larger 72G disks which require filling less space. :)

I'll give this a go soon hopefully and see if we can't sort this one out. I'd definately be interested in getting all we can out of it. :)

Quoted 53 lines · Andreas Dilger

Date: Thu, 10 May 2001 00:33:37 -0600 (MDT)
From: Andreas Dilger <[email protected]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: [linux-lvm] Max logical volume size 1TB or 2TB?

Quoted 10 lines · Andrew Patterson

I patched LVM 0.9.1_beta7 lvm.h source a little to get past the system defined limits.

These are the changes I made:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

I presume the originals should not have the *2 on them?

Quoted 7 lines

goes to:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

You probably want to go to something like (i.e. slightly less than 2GB):

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*2047 ? ( long long) 1024*1024/SECTOR_SIZE*1024*2047 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 2047)

The reason is that since we are talking about 512-byte sectors here, your original values are exactly 2^32, so this is probably overflowing a 32-bit value somewhere. Since the Linux block layer limits you to 2TB anyways, it is not a real issue for the LVM limit to be slightly less than 2TB. How much less depends on how many more disks you have... Probably any value <= 2^32-1 should be OK.

Cheers, Andreas
--
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
_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm

#3 lore raw
In reply to Andreas Dilger

Wasn't able do diff out Andrews factor of 2 in his mail.

Anyway: Andreas is right, because the pv_size member is type
defined unsigned int.

Regards,
Heinz -- The LVM Guy --

Quoted 30 lines · Andreas Dilger
Quoted 10 lines · Andrew Patterson

I patched LVM 0.9.1_beta7 lvm.h source a little to get past the system defined limits.

These are the changes I made:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

I presume the originals should not have the *2 on them?

Quoted 7 lines

goes to:

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*1024*2 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024*2 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024*2)

You probably want to go to something like (i.e. slightly less than 2GB):

#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > (
long long) 1024*1024/SECTOR_SIZE*1024*2047 ? ( long long) 1024*1024/SECTOR_SIZE*1024*2047 : ( long long) LVM_PE_T_MAX * (a)->pe_size)

#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 2047)

Quoted 16 lines

The reason is that since we are talking about 512-byte sectors here, your original values are exactly 2^32, so this is probably overflowing a 32-bit value somewhere. Since the Linux block layer limits you to 2TB anyways, it is not a real issue for the LVM limit to be slightly less than 2TB. How much less depends on how many more disks you have... Probably any value <= 2^32-1 should be OK.

Cheers, Andreas

Signature · 7 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
_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Sistina Software Inc.
Senior Consultant/Developer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-