Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've three partitions on /dev/sda: sda1, sda2 sda3. There is FREE space between sda2 and sda3 and sda3 ends on the last sector. sda2 and sda3 have the same number of sectors allocated and so are the exact same size.
/dev/sda2 is already part of the VG VolGroup. However, what puzzles me is that if I do "lvm vgextend /dev/sda3" and check with "lvm pvdisplay", the PV Size for /dev/sda3 is listed as 754.07GiB whereas the PV for /dev/sda2 is listed as 187GiB. I expected /dev/sda3 to be listed as 187GiB. Did the system include the FREE space as well in the vgextend? I'm not able to derive 754.07GiB.
If it included the free space as well, if I did:
"lvm pvmove /dev/sda2 /dev/sda3"
will it move the PV (VG's and LV's) to the start of the FREE region or to the start of /dev/sda3? I expect to the start of the partition /dev/sda3 though I have a doubt based on the actual size repoted for VolGroup on /dev/sda3
sda2 and sda3 have the same number of sectors allocated and so are the exact same size.
You didn't mention, but have they always been the same size? Was /dev/sda3 resized at any point or has it always been 187GiB?
If your answers are 'yes', 'no' and 'its always been 187GiB', I'd say something is amiss.
Quote:
I expected /dev/sda3 to be listed as 187GiB.
I would expect the same. If that's the size of the partition, I would expect the physical volume to be that size (rounded down slightly if required to be a multiple of the PE size).
Quote:
Did the system include the FREE space as well in the vgextend?
I hope not. I've never seen that happen. LVM2 (I hope you are LVM2, and not LVM1) is pretty bullet proof, but like any piece of code, it has had bugs...
Quote:
Originally Posted by Devyn
Anyone? Is more details needed?
Yes. It would help if you posted the output of 'fdisk -l /dev/sda'.
And please post the output of 'pvdisplay', 'vgdisplay' and 'lvdisplay', too. ('pvdisplay --maps' would be even better than just 'pvdisplay'.)
Last edited by tommylovell; 09-07-2011 at 11:48 PM.
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 187.00 GiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 47871
Free PE 0
Allocated PE 47871
PV UUID AR2cbu-Zlxw-8nR0-423o-20pa-3g3l-Te3gcI
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 41
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 187.00 GiB
PE Size 4.00 MiB
Total PE 47871
Alloc PE / Size 47871 / 187.00 GiB
Free PE / Size 0 / 0
VG UUID l6D50I-m8tf-2iPJ-ef1R-O9kf-kH2v-7SslkB
--- Logical volume ---
LV Name /dev/VolGroup/lv_root
VG Name VolGroup
LV UUID b3XsIw-JC3l-cIEU-njSP-1NbY-kPaO-gvMJda
LV Write Access read/write
LV Status available
# open 1
LV Size 32.00 GiB
Current LE 8192
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup/lv_swap
VG Name VolGroup
LV UUID KBdB2L-j1ZS-8iA6-Uilh-43G1-NKxX-eE06FW
LV Write Access read/write
LV Status available
# open 0
LV Size 4.00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/VolGroup/LogVol02
VG Name VolGroup
LV UUID beOzB5-znIO-SD44-bkgr-aT9F-gb6N-9Ayyia
LV Write Access read/write
LV Status available
# open 0
LV Size 151.00 GiB
Current LE 38655
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 187.00 GiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 47871
Free PE 0
Allocated PE 47871
PV UUID AR2cbu-Zlxw-8nR0-423o-20pa-3g3l-Te3gcI
--- Physical Segments ---
Physical extent 0 to 8191:
Logical volume /dev/VolGroup/lv_root
Logical extents 0 to 8191
Physical extent 8192 to 9215:
Logical volume /dev/VolGroup/lv_swap
Logical extents 0 to 1023
Physical extent 9216 to 47870:
Logical volume /dev/VolGroup/LogVol02
Logical extents 0 to 38654
Model: ATA WDC WD15EADS-32R (scsi)
Disk /dev/sda: 2930277168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 63s 409662s 409600s primary ext4 boot
2 409663s 392570943s 392161281s primary lvm
392570944s 2538115886s 2145544943s Free Space
3 2538115887s 2930277167s 392161281s primary lvm
Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008528d
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 24437 196080640+ 8e Linux LVM
/dev/sda3 157991 182402 196080640+ 8e Linux LVM
VolGroup used to take up the entire physical drive /dev/sda. I resized all the LV's, VG's and ext4 (resize2fs) filesystems on them to 187G in total from 1.5TB in total. To test, ran fsck I booted up to the new setup and everything booted fine from /dev/sda1 and /dev/sda2. I've added /dev/sda3 after that so I can copy everything from /dev/sda2 over to it. Even though the partitions are identical in sector size, when I run lvm pvcreate /dev/sda3 then lvm vgextend /dev/sda3, instead of a size of 187G *2, I get 754G with change, which I don't feel is right.
The reason why I want data and LV's/VG's to move from sda2 to sda3 is to free up space for a new OS install on sda1 and sda2 and still retain the old data in sda3 to mount later on when the new OS setup is complete. I'm running LVM2 from the recovery console of the Scientific Linux distro (which is same as the RHEL 6.1 distro other then some additions by the scientific community.).
when I run lvm pvcreate /dev/sda3 then lvm vgextend /dev/sda3, instead of a size of 187G *2, I get 754G with change, which I don't feel is right.
I would agree with you.
The sizes that LVM reports come from the metadata that is written near the beginning of each volume that you've pvcreated. (By default, the metadata is written to every volume in that volume group.)
I would start from scratch with that new PV on /dev/sda3 (although it sounds like you did just that). Do a 'pvremove /dev/sda3', then 'pvcreate /dev/sda3' and 'vgextend VolGroup /dev/sda3' again. I'd be curious what a 'pvs' and 'vgs' would say after that. If a 'pvdisplay /dev/sda3' shows "Total PE" is more than 47871, then there must be a bug and I wouldn't use it or trust it.
Looking at your displays, I'm a little puzzled by where the 745G comes from. The free space is around 1T, not 754G...
# cat /root/extended.txt
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 187.00 GiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 47871
Free PE 0
Allocated PE 47871
PV UUID AR2cbu-Zlxw-8nR0-423o-20pa-3g3l-Te3gcI
--- Physical volume ---
PV Name /dev/sda3
VG Name VolGroup
PV Size 754.07 GiB / not usable 2.37 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 193042
Free PE 193042
Allocated PE 0
PV UUID x0O0xW-TAXH-Vrz2-g299-pJm6-Mj5g-srkOBH
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 42
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 941.07 GiB
PE Size 4.00 MiB
Total PE 240913
Alloc PE / Size 47871 / 187.00 GiB
Free PE / Size 193042 / 754.07 GiB
VG UUID l6D50I-m8tf-2iPJ-ef1R-O9kf-kH2v-7SslkB
--- Logical volume ---
LV Name /dev/VolGroup/lv_root
VG Name VolGroup
LV UUID b3XsIw-JC3l-cIEU-njSP-1NbY-kPaO-gvMJda
LV Write Access read/write
LV Status available
# open 0
LV Size 32.00 GiB
Current LE 8192
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup/lv_swap
VG Name VolGroup
LV UUID KBdB2L-j1ZS-8iA6-Uilh-43G1-NKxX-eE06FW
LV Write Access read/write
LV Status available
# open 0
LV Size 4.00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/VolGroup/LogVol02
VG Name VolGroup
LV UUID beOzB5-znIO-SD44-bkgr-aT9F-gb6N-9Ayyia
LV Write Access read/write
LV Status available
# open 0
LV Size 151.00 GiB
Current LE 38655
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup lvm2 a- 187.00g 0
/dev/sda3 VolGroup lvm2 a- 754.07g 754.07g
VG #PV #LV #SN Attr VSize VFree
VolGroup 2 3 0 wz--n- 941.07g 754.07g
Aside from the LVM in SL, I've a number of other options here. I've PXE booted SL 6.1 (Which is an RHEL clone) to get to this recovery console from where I'm running the commands. The partitioning was originally done with the LVM from F12 if I recall correctly, but nothing earlier. But the VolGroup that was created by the F12 LVM is already resized successfully per the details I posted above. I've a number of other distro's I can boot through PXE, all configured, including F14. I might try the other distro's with a more recent/stable LVM.
Would definitely welcome any suggestions or recommendations in regards to which distro currently, has the most stable / recent LVM version and I'll boot that over PXE. That is, if the LVM with SL is considered erronous.
Well, this is really perplexing. I have no idea how it could get into the state it is in now.
But, I WOULD NOT USE IT AS IT IS NOW!!!! A 'pvmove' would probably succeed if all of the PE's assigned were phyically on the partition, but you are really tempting fate if you did. You have, as they say, an accident waiting to happen.
What I would suggest would be to remove it from the VG
Once the number of PE's is correct in that PV, then you can reextend your VG.
I would strongly advise you to get a good backup of your data before you proceed if it is of any importance to you.
I can't help with a suggestion on a distro. I've been using RHEL and Fedora for a few years now with no problems migrating from release to release; but I've also used LVM on Ubuntu without incident.
Last edited by tommylovell; 09-09-2011 at 11:46 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.