1829089 Members
2531 Online
109986 Solutions
New Discussion

LVM question

 
SOLVED
Go to solution
Kenneth_18
Frequent Advisor

LVM question

I wanted to extend my /usr filesystem which is lvol7. when I did an lvdisplay, it showed Current LE 75 and allocated PE 150.

SO what I did is lvextend lvol7 -l 81 /dev/vg00/lvol7.

What happened now is when I do a lvdisplay for lvol7, the current LE is now 81 but the allocated PE has also increased by 12 from 150 to 162.

Why is it that also the allocated PE was increased?

Should I have just extended the filesystem and not the lvol anymore as the allocated PE is more than sufficient? If I just extend the file system, then would the current LE have changed to 81?

Can I still lvreduce lvol7 to its original size without destroying all the original contents of lvol7.

Thanks in advance.
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: LVM question

Please post the output of this command.

lvdisplay /dev/vg00/lvol7

You can reduce it if you haven't done extendfs, mounted it and added data. You might have trouble at that point.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Patrick Wallek
Honored Contributor
Solution

Re: LVM question

I have a feeling that lvol7 is mirrored. What you are seeing is normal for a mirrored LV. There are 75 Logical Extents allocated (the usable size is 75 Extents) but the extents actually used for the LV is 150, since the mirror copy also needs an additional 75 extents on the other disk drive.

When you extended to 81 extents, increased by 6, it also had to increase the mirror copy by 6 extents thus making the total increase 12 extents, or your new total of 162 extents.

If you do an 'lvdisplay /dev/vg00/lvol7' you should see a row that says "Mirror Copies" and that is probably 1.

You have done absolutely nothing wrong. LVM is behaving as it should so you don't have to worry about increasing the mirror copy separate from the primary copy.

Just do your fsadm command now (assuming you have Online JFS) to increase the space that is usable for the filesystem and you will be OK.
Patrick Wallek
Honored Contributor

Re: LVM question

Here is a copy of 'lvdisplay /dev/vg00/lvol7' from one of my machines:


root@hquov01.rwp.com:/->lvdisplay /dev/vg00/lvol7
--- Logical volumes ---
LV Name /dev/vg00/lvol7
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 3072
Current LE 768
Allocated PE 1536
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default


You will notice that the 'Allocated PE' is double the number of 'Current LE'. That is because of the 'Mirror copies' of 1.
Steven E. Protter
Exalted Contributor

Re: LVM question

If Patrick is right, I want the first page or two from:

lvdisplay -v /dev/vg00/lvol7

Mirroing would explain this.

The command would prove it.

When you expand a mirrored lvol and don't specify the mirror location, lvm maintains the mirror.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Tully
Honored Contributor

Re: LVM question

Your logical volume has one definite mirror, that will explain why when you extended, it used twice as many extents. Yes you can decrease the size, as you have not actually used the extra part that was extended. Once you increase the filesystem size (which can only be done with on-lins JFS or in single user mode) that would present a problem.
Anyone for a Mutiny ?
Steven E. Protter
Exalted Contributor

Re: LVM question

I guess I would have figured it out with the lvdisplay output.

I'd like to compliment Michael and Patrick on their diagnostic skills. Top notch. You guys are the best.

Good night.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Kenneth_18
Frequent Advisor

Re: LVM question

Thanks to all who replied.

Yes I have a mirror and it never occurred to me that the allocated PE was for both primary and mirror copy.