1833582 Members
4431 Online
110061 Solutions
New Discussion

Re: lvextend mishap

 
SOLVED
Go to solution
Ralph Grothe
Honored Contributor

lvextend mishap

Hello Forumers,

accidentally I extended the wrong LV when I issued the command
# lvextend -l 750 /dev/vgz01/lvol2

Actually, ment was rather lvol20 in that same VG.

The PE size of the VG was set to 8MB, so that I know have some 6GB of wasted disk space.

Unfortunately, as always in such circumstances, I haven't previously saved the dump of vgdisplay -v vgz01.
Thus I cannot tell how many LEs lvol2 used to have before.

A bdf of lvol2 reveals the following:
# bdf /dev/vgz01/lvol2
Filesystem kbytes used avail %used Mounted on
/dev/vgz01/lvol2 516096 184502 331594 36% /usr/sap/Z01/DVEBMGS01

Now if I devide those 516096B by 1024 and again by 8 I get some 63 LEs.
Still the warning of possible data loss somewhat scares me to isssue
# lvreduce -l 63 /dev/vgz01/lvol2

Is there a way to make sure how big the LV was before?
Maybe from the data an fstyp -v on the LV displays?

So far I haven't extended the filesystem itself (i.e. no extendfs or fsadm in the case of onlineJFS).

TIA
Ralph
Madness, thy name is system administration
6 REPLIES 6
Patrick Wallek
Honored Contributor
Solution

Re: lvextend mishap

What if you do a vgdisplay of vgz01, look at the number of LE for that LVOL and then subtract 750? That should give you a good number, I think.
Curtis Larson
Trusted Contributor

Re: lvextend mishap

looks like your previous lvol size was 504 Meg or 63 extents. do a lvdisplay of your logical volume to see how many extents are currently in the lvol. (should be 750) So, you should be able to do a lvreduce -l 63 /dev/vg/lvol.

of course, you probably should back up your data first, including your vg config info.
Curtis Larson
Trusted Contributor

Re: lvextend mishap

you might find some information on what the lvextend did in the syslog.log file. But other then that I'm not sure. I don't think lv pe info in contained in the vgcfgbackup info, but you could try vgcfgrestore -n vgname -l. your file system size is 504 so even if it was bigger previously you were just wasting space. and if it was smaller then 504 then your going to be in dodo anyway. so, 63 extents is your optimal size.
Curtis Larson
Trusted Contributor

Re: lvextend mishap

here is a thought, do a lvdisplay -v lvol and see where the PE number jumps. it should start at x and then increment by one for each extent in the lvol. When the lvol is extended there should be a jump in this number. This will depend on how many times the lvol has been extended, but if it hasn't before the first pe is x then they should increment to x+62 ( for 63 extents total) then take a jump to a new number.

check into to that.
Ralph Grothe
Honored Contributor

Re: lvextend mishap

Sorry for the late response.

But I haven't been able to login to the forum in order to assign points or reply for days lately!

My assumptions about the original size were correct and I was able to do the lvreduce withaout any data loss at all.
Madness, thy name is system administration
Henry Weldon
Advisor

Re: lvextend mishap

Perform a "lvdisplay -v /dev/vg##/lvname and watch the PE1 column. This is the actual location of the PE on the target disk. If this LV was not the last one created on this disk, you should see a gap in the physical extent numbers used.
Be Prepared