lvextend - where's my data?
RH 2.4.20-8 kernel, LVM 1.0.3
I have a file system that is I needed to extend. My steps: 1. umount /home 2. e2fsck -f /dev/ramairVG/lvhome2 3. lvextend -L+20G /dev/ramairVG/lvhome2 4. resize2fs /dev/ramairVG/lvhome2 5. e2fsck -f /dev/ramairVG/lvhome2 ERRORS!!!! The I tried to mount /home and nothing is there? Where's my data? Code:
[root@RAMAIR /]# e2fsck -f /dev/ramairVG/lvhome2 |
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 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 |
Quote:
Quote:
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. |
haertig, thank you.
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 I can still mount the original corrupt lvhome and see some data. My file system type is ext3, could that be the problem? Thank you again for your help and time. |
All times are GMT -5. The time now is 06:19 PM. |