Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-20-2005, 10:03 AM   #1
Registered: Mar 2005
Posts: 126

Rep: Reputation: 15
LVM - what am I doing wrong?

I'm trying to merge two hard drives using the LVM tool. Both hard drives are 160 GB, but the first of them has an 8GB root partition (and swap). The harddrives are called /dev/hdb3 and /dev/hdd (the whole drive is to be used). I also want to encrypt them using cryptsetup. In the end, I have the following setup
/dev/hdb3 --> /dev/mapper/cryptA via /sbin/cryptsetup (default settings)
/dev/hdd --> /dev/mapper/cryptB via /sbin/cryptsetup (default settings)
I created the physical volumes using
pvcreate /dev/mapper/cryptA
pvcreate /dev/mapper/cryptB
which needed a change in lvm.conf to allow devmapper devices
Then I created a volume group called "bigdisk" using
vgcreate bigdisk /dev/mapper/cryptA
(yes, only the first drive -- the second drive had some data I needed to copy over first)
Then I created the logical volume
lvcreate -n local bigdisk

Then I successfully formatted the volume in ext3 and mounted it in /local. Everything worked OK, then I wanted to add the second drive, extending the volume size to a total of 293.4 GB. This is where I ran into trouble. I successfully added both physical volumes to the volume group (see below for an output of vgdisplay and pvdisplay). But I am unable to do extend the logical volume to fully use the second drive. After a little trial and error I found that I could expand it slightly so that it began using it, but only a fraction of it. As can be seen below, I seem to be able to allocate more or less exactly 50% of the total size of the volume group.

I probably did something wrong in the process of setting this up, but what exactly? I followed the instructions in the manpages but they are not very helpful in this case.
To resize, I use the following command:
lvm>lvextend -l +37644 -i 1 bigdisk/local
And get the following error:
Extending logical volume local to 293.40 GB
Insufficient allocatable extents (37466) for logical volume local: 75110 required

Yes, 75110 is the number of extents I want. And there are that many, as shown below. Why can't lvextend find them ?

--- Physical volume ---
PV Name /dev/dm-3 (NB: same as /dev/mapper/cryptA)
VG Name bigdisk
PV Size 144.35 GB / not usable 0
Allocatable yes (but full)
PE Size (KByte) 4096
Total PE 36954
Free PE 0
Allocated PE 36954
PV UUID j2c3bk-bZ4p-R2Jb-g24d-1FYO-v2Fe-9fOeGj

--- Physical volume ---
PV Name /dev/dm-4 (NB: same goes here, cryptB)
VG Name bigdisk
PV Size 149.05 GB / not usable 0
Allocatable yes
PE Size (KByte) 4096
Total PE 38156
Free PE 37554
Allocated PE 602
PV UUID R72kE1-4Orb-Etx3-252n-B3Ra-5j5C-Yow94A

lvm> vgdisplay
--- Volume group ---
VG Name bigdisk
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 14
VG Access read/write
VG Status resizable
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 293.40 GB
PE Size 4.00 MB
Total PE 75110
Alloc PE / Size 37556 / 146.70 GB
Free PE / Size 37554 / 146.70 GB
VG UUID x4szzU-0upn-T7Gc-qe3M-IpW6-iTIw-MuQjmZ

--- Logical volume ---
LV Name /dev/bigdisk/local
VG Name bigdisk
LV UUID Xpt9uT-M9Ih-3uwT-iA6W-VlAI-1KgE-F3s9W2
LV Write Access read/write
LV Status available
# open 0
LV Size 146.70 GB
Current LE 37556
Segments 2
Allocation contiguous
Read ahead sectors 0
Block device 253:5

Last edited by rpz; 03-20-2005 at 10:05 AM.
Old 03-20-2005, 11:14 AM   #2
Registered: Mar 2005
Posts: 126

Original Poster
Rep: Reputation: 15
Solved it! The solution:
lvm>lvchange -C n bigdisk/local

I'm not sure exactly what this is, but I guess contiguous mode forces the partition to remain on one disk only..?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lvm ItsNotMe Linux - General 1 04-22-2005 08:17 AM
Lvm uselpa Slackware 1 03-03-2005 06:44 AM
my time is wrong and calender is also wrong Paxmaster Linux - General 6 12-16-2004 01:46 AM
Help on LVM! sti2envy Linux - Newbie 1 10-04-2004 07:44 AM
LVM Problem - vgimport - wrong number of physical volumes to import volume group Anything1 Linux - Software 0 09-06-2003 08:18 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration