LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 01-08-2015, 11:12 AM   #1
Checksumfail
LQ Newbie
 
Registered: Jan 2011
Posts: 12

Rep: Reputation: 0
Manually editing LVM metadata


A botched lvreduce command has caused *all* LVM commands to indefinitely hang, including vgcfgrestore.

I've searched everywhere and I can't find the location of the *active* lvm metadata, I know the backup and archive files are in /etc/lvm but I need the current version so I can replace it.

Thanks.
 
Old 01-08-2015, 12:00 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,328

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
It is stored within the various headers within the LVM physical volume itself with some redundancy making it not amenable to manual editing. You should be able to edit one of the files in /etc/lvm/archive or /etc/lvm/backup to describe the way the configuration should be, and then use vgcfgrestore from that file. The only issue would be if the physical volume header were damaged, and that could be corrected by running pvcreate with the "-ff", "--uuid", and "--restorefile" options.

The ultimate weapon would be to use pvremove with the "-ff" option to wipe the PV header, then pvcreate with the "--uuid" and "--restorefile" options, followed by vgcfgrestore. I can't imagine a situation where that pvremove would be necessary. The above "pvcreate -ff ..." should always suffice.
 
Old 01-08-2015, 12:07 PM   #3
Checksumfail
LQ Newbie
 
Registered: Jan 2011
Posts: 12

Original Poster
Rep: Reputation: 0
I have a file in the /etc/lvm/archive folder that is exactly the right configuration (Just before I did the lvreduce) but I can't run vgcfgrestore because it just hangs (I've left it for over an hour).

I think the PV metadata is fine, the problem occured because I accidentally increased the LV to 16.1TB which is too large, I did lvreduce and it hung, after that no LVM commands are working, I can't do pvscan, pvremove or pvcreate, I even tried reinstalling lvm2 through apt-get and that hung too.
 
Old 01-08-2015, 02:06 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,328

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
When you ran lvresize and/or lvreduce, did you include the "-r" (--resizefs) option? If so, and especially on the lvreduce, the implied fsck can take a very long time (many hours for a 16TB ext3 filesystem) and will keep the volume busy while it is running. Does top show any suspicious running processes? I don't know what sort of locks the various LVM commands might be using to keep from stepping on each other.
 
Old 01-08-2015, 05:29 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,374

Rep: Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036Reputation: 3036
Quote:
Originally Posted by Checksumfail View Post
I think the PV metadata is fine, the problem occured because I accidentally increased the LV to 16.1TB which is too large, I did lvreduce and it hung, after that no LVM commands are working, I can't do pvscan, pvremove or pvcreate, I even tried reinstalling lvm2 through apt-get and that hung too.
I don't want to divert this discussion, but when this is all over, you should file a bug - this should never happen. You should never be able to make a lv "too large" - parsing should catch that.

I take it you are doing this recovery from the affected system - any success running lvm commands from a liveCD ?.
 
Old 01-09-2015, 11:58 AM   #6
Checksumfail
LQ Newbie
 
Registered: Jan 2011
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by rknichols View Post
When you ran lvresize and/or lvreduce, did you include the "-r" (--resizefs) option? If so, and especially on the lvreduce, the implied fsck can take a very long time (many hours for a 16TB ext3 filesystem) and will keep the volume busy while it is running. Does top show any suspicious running processes? I don't know what sort of locks the various LVM commands might be using to keep from stepping on each other.
I didn't use --resizefs, I tried running that separately after lvresize and it refused due the 16tb limit, which is why I ran the lvreduce. The lvreduce command hung for at least 20 minutes before I Ctrl-C'd it, I thought It'd be easier to just revert the metadata. I tried turning off the locking in lvm.conf but the commands still won't run.

Quote:
Originally Posted by syg00 View Post
I don't want to divert this discussion, but when this is all over, you should file a bug - this should never happen. You should never be able to make a lv "too large" - parsing should catch that.

I take it you are doing this recovery from the affected system - any success running lvm commands from a liveCD ?.
I'll make sure I do that, I'll wait and see if I find a fix first though so I can add that too.

Running the commands from a liveCD is a great idea! I didn't think of that, I've tried Ubuntu on USB and DVD and Mint on USB and they all get stuck at boot up at the logo? I can switch to the other TTY's but they're just a flashing underscore, not a prompt. I've booted liveCD's on this machine before and it's never done this.
 
  


Reply


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
Editing XMP metadata in AVI files voom Linux - Software 3 09-12-2010 07:16 AM
Music file metadata editing software skazhy Programming 2 01-08-2010 07:34 AM
fedora 9 upgraded to 2.6.30 - lvm occasionally fails to read metadata joel_k Linux - Software 0 11-06-2009 01:23 AM
Inconsistent metadata in lvm ekkek Linux - Newbie 2 03-27-2009 09:03 PM
LVM - editing metadata mickj Linux - Software 6 12-16-2008 10:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:40 AM.

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