Linux - SoftwareThis 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.
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.
Well, that doesn't look terribly good. The steps you took are correct, except I always do an e2fsck BETWEEN the lvextend and resize2fs commands. resize2fs actually refuses to work, and says I must do the e2fsck first before it will continue. Looks like it continued for you without complaining however. I use LVM2, but I don't see how this could matter, since resize2fs is not part of LVM.
I'm not sure what I'd do in your case. Can you run lvdisplay and pvdisplay and pick out any clues? Does the output of these commands look like the volume was resized as you expected? You might try searching Google for "lvm mailing list" and see if that generates any useful hits pointing to LVM experts.
Also search on "lvm meta data".
I don't know where this will lead you. Hopefully to an answer!
I was afraid of an answer like this.
A brief background. My original lv was lvhome which I typo'd when I extended. I forgot the "+" in -L+50G, I typed -L50G and may have actually reduced the size of my LV. So, I created a brand new LV; lvhome2 at 50GB. Then I copied all the data off the corrupt LV (lvhome) and lost a lot of data. I still have the corrupt lvhome. So now I decided to increase my new lvhome2 by 50G as per the procedure of my original post. This is crazy.
Here's lvdispaly, pvdisplay, pvscan and fdisk -l, if it helps. I don't see any clues, maybe somebody else does. You will see that I have 2 250GB disks and 2 raid 1 devices. /dev/md0 is for root fs and /dev/md1 is for everything else (/home /var).
Code:
[root@RAMAIR root]# pvdisplay /dev/md1
--- Physical volume ---
PV Name /dev/md1
VG Name ramairVG
PV Size 156.26 GB [327693568 secs] / NOT usable 4.31 MB [LVM: 284 KB]
PV# 1
PV Status available
Allocatable yes
Cur LV 4
PE Size (KByte) 4096
Total PE 40000
Free PE 1582
Allocated PE 38418
PV UUID MRoKhL-lVT3-eNaK-PN5y-xwIO-4JzG-AXEV6a
[root@RAMAIR root]# lvdisplay /dev/ramairVG/lvhome
--- Logical volume ---
LV Name /dev/ramairVG/lvhome
VG Name ramairVG
LV Write Access read/write
LV Status available
LV # 1
# open 0
LV Size 70 GB
Current LE 17920
Allocated LE 17920
Allocation next free
Read ahead sectors 1024
Block device 58:0
[root@RAMAIR root]# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- ACTIVE PV "/dev/md1" of VG "ramairVG" [156.25 GB / 6.18 GB free]
pvscan -- total: 1 [156.26 GB] / in use: 1 [156.26 GB] / in no VG: 0 [0]
[root@RAMAIR root]# fdisk -l
Disk /dev/hda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1275 10241406 fd Linux raid autodetect
/dev/hda2 1276 11474 81923467+ fd Linux raid autodetect
Disk /dev/hdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 1275 10241406 fd Linux raid autodetect
/dev/hdb2 1276 11474 81923467+ fd Linux raid autodetect
Thanks for any input, as I clearly need it!
Edit: The LV above was the original corrupt LV. Here is the one I this post is about.
Code:
[root@RAMAIR root]# lvdisplay /dev/ramairVG/lvhome2
--- Logical volume ---
LV Name /dev/ramairVG/lvhome2
VG Name ramairVG
LV Write Access read/write
LV Status available
LV # 4
# open 1
LV Size 78.59 GB
Current LE 20120
Allocated LE 20120
Allocation next free
Read ahead sectors 1024
Block device 58:3
My original lv was lvhome which I typo'd when I extended. I forgot the "+" in -L+50G, I typed -L50G and may have actually reduced the size of my LV.
How big was your ORIGINAL lvhome? If it was originally LARGER than 50G, I would expect your typo of -L50G to have done nothing, except generate an error message telling you can't "extend" to something smaller than you already are. I believe this is what the LVM2 commands will do, I don't know about LVM1.
Quote:
So, I created a brand new LV; lvhome2 at 50GB. Then I copied all the data off the corrupt LV (lvhome) and lost a lot of data. I still have the corrupt lvhome.
What make you think your original lvhome was corrupt? Did you run e2fsck and get errors? Did resize2fs complain? Was it no longer mountable after you ran your typoed lvextend? Did you just assume it would be corrupted because of your typo?
Your listing shows your original lvhome at 70G. How did you copy this into your smaller 50G lvhome2? It wouldn't fit! And what command would you have used to do the copy? dd certainly wouldn't work on a logical volume (whos contents could be spread physically in various places on the disk). I would expect that at this point lvhome2 would have contained 50G of total garbage. And when you went to extend lvhome2, you would have just made the trash can bigger, but it was still full of garbage. I think thats what your e2fsck errors on lvhome2 are trying to tell you. You've got garbage.
You might still have a chance working with the original lvhome. But I can't tell you what to do. Forget lvhome2 for the moment. Exactly what steps did you do to lvhome, and in what order? How big was it to start with? And specifically, what made you think it was corrupt after you typoed your lvextend? Maybe a recovery plan can be constructed if we can identify what happened.
I will admit right off that I am NOT an LVM recovery expert. I use LVM heavily, but haven't managed to get myself into a pickle like you have yet. So my experience falls into "using working LVM", not "fixing broken LVM". But I'm interested in your predicament, and will try to offer whatever I can come up with, idea-wise.
I'm hoping an LVM recovery expert will jump into this thread. I responded not because I know what you should do, but because nobody else had. I can't imagine you're terribly happy about your current situation, so I thought I'd at least TRY to help a little. Not too much I can offer yet. Maybe after getting a little more background info from you. Maybe.
My lvhome was about 50G before I tried to extend it. I don't remember exactly how may logical extents were allocated to the LV but it was right around 50G from df -h. I wish I remembered exactly but I don't.
After I issued lvextend -L50G /dev/ramairVG/lvhome the command completed without any errors. I then tried to run resize2fs on the LV to use the additional space (which I probably either only added 1 or 2 Gig or, possibly reduced 1/2G - if that's even possible) but the resize2fs command reported that I have to run e2fsck on the LV first, so I never ran resize2fs on the LV lvhome successfully.
I know for sure that after I extended lvhome, lvdisplay showed the LV size as 50G.
I ran e2fsck and answered YES to the errors up until I got to the error that warned on data loss.
At that point, I decided to creat a new LV and copy over whatever data I could recover via the cp command. My new lv (lvhome2) was created at 50G and mounted on /homebkup. My command was:
cp -ax /home /homebkup 2> /tmp/cperr.log
The data lost was identifiable from the cperr.log file. cperr.log reported 385 failures with various errors (I/O error, invalid file type). The 385 represents files and directories so many more the 385 files were lost. Some of the lost directories had hundreds of files. My original /home was 86% full and the new /homebkup is at 46% full and LV size is just about the same.
At this point I have lvhome on /home with corruption and lvhome2 on /homebkup brand new with all recoverable data.
lvhome - I decided to try and extend lvhome +20G and try e2fsck again. I exteneded, then ran e2fsck. Same errors. This time I ran again with the -p option. e2fsck -f -p <lv> failed after a min or two with the following:
Code:
[root@RAMAIR root]# e2fsck -f -p /dev/ramairVG/lvhome
/dev/ramairVG/lvhome: Inode 5407029 (...) is an illegal FIFO.
/dev/ramairVG/lvhome: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
lvhome2 - I created it at only 50G. So, I figured I'd start from scratch and try to extend it, which I did to 78.59G. I then ran resize2fs which completed. Then e2fsck which lead me to my original post because it too is reporting errors and when mounted there is no data.
I can still mount the original corrupt lvhome and see some data.
My file system type is ext3, could that be the problem?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.