LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-16-2018, 05:05 PM   #16
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 285

Rep: Reputation: 83

Quote:
Formatting a PV with pvcreate affects only the 1-megabyte PV header. It does not touch the rest of the partition. All that is needed is to reformat with the correct UUID and restorefile. That will allow vgcfgrestore to restore the VG configuration, making the LV(s) and content available again.
Good to know. However since the OP doesn't seem to have any actual backups perhaps they should backup the whole partition first to an external drive with dd such as
dd if=/dev/sda4 conv=sync,noerror bs=64K | gzip -c > /usb/drive/file

Then if something were to go wrong with the vgcfgrestore operation they could restore the partition from the usb drive backup to its previous state and try again. Without a backup if something went wrong their only copy of the data would be corrupted.

Last edited by tofino_surfer; 08-16-2018 at 06:23 PM.
 
Old 08-16-2018, 08:16 PM   #17
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,047

Rep: Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798
It's always good to have a backup when doing recovery work, but vgcfgrestore also affects only the 1-megabyte LVM header.
 
Old 08-16-2018, 09:24 PM   #18
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 285

Rep: Reputation: 83
Quote:
It's always good to have a backup when doing recovery work, but vgcfgrestore also affects only the 1-megabyte LVM header.
It sounds like if an expert uses all of the right commands only two 1 MiB headers will be affected and not the actual extents. However if someone, not an expert, used the wrong command such as vgcreate instead of vgcfgrestore then the data extents would be affected and possibly reformatted. This is what I meant by something going wrong. If all of the correct commands are used you wouldn't need the backup. I perhaps shouldn't have used the correct command vgcfgrestore in my previous comment and simply stated if something were to go wrong with the attempted restore operation.

Last edited by tofino_surfer; 08-16-2018 at 09:48 PM.
 
Old 08-17-2018, 08:05 AM   #19
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,047

Rep: Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798
vgcreate, like all of the other LVM commands, affects only the LVM header. As long as you don't try to write to any of the LVs, your data will be untouched. All of the information about the entire volume group is contained in that header. There is no LVM information elsewhere in the physical volume. The only danger is if you have a mistake in the partition table such that the partition starts in the wrong place. That will result in an LVM header being written where it shouldn't be.

[EDIT] OK, there are LVM commands like "pvmove" and "lvresize --resizefs" that do affect the data area of the LV. Those aren't the sort of commands you are likely to be running in this situation.[/EDIT]

Last edited by rknichols; 08-19-2018 at 02:54 PM. Reason: Some LVM commands do affect the data area.
 
  


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
initramfs + lvm and raid Enrix80 Gentoo 2 12-02-2017 01:02 PM
pendrive restoration 69Rixter Linux - General 24 03-24-2015 06:51 PM
initramfs generated by genkernel doesn't automatically activate LVM pusrob Gentoo 5 02-26-2015 11:40 AM
initramfs cannot find lvm root partition mgrant Linux - General 1 01-23-2009 08:12 PM
data restoration cyberia_2ooo Linux - General 2 09-24-2004 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:53 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