LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-13-2008, 03:59 PM   #1
mickj
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Rep: Reputation: 0
LVM - editing metadata


Using SUSE 10.1

Have storage connected to server that has snapshot capabilities.
In addition, it permits alterations (writes) to the the snapshot that do not affect the volume it was snapshoted from.

I want to mount the snapshot, but as LVM was used to create a VG on the main volume, the snapshot carries the same VG ID, LV ID and PV ID. I want to edit the metadata on the snapshot volume and modify the ID('s) so LVM doesn't think that the snapshot is a duplicate (as reported by vgscan).
I have used dd to read in the first 256 blocks and then used vi to edit some of characters of the ID fields (this info is in clear ASCII but I used the %!xxd option to display in hex/ascii format). I then wrote the modified file back to the storage (/dev/sda) using dd.

Reading notes on the metadata format, I confirmed it is writtten twice to the disk(storage) at 1200x and 1600x.

Question - is it "wrapped" with a CRC or other check characters??

So far, it is not clear that the contents of the modified file are read back from storage after having been written there with dd.

thanks
Mike
 
Old 11-14-2008, 06:13 AM   #2
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
There is "lvrename", "vgrename". Why do you want to change the physical volume name?
 
Old 11-14-2008, 12:13 PM   #3
mickj
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Original Poster
Rep: Reputation: 0
I need to rename the PV so that the scan performed by vgscan or LVM at startup does not think the snapshot and master volume are the same PV.
If this check passes, then it should be possible to mount the snapshot via LVM as a different volume.

I have also found that the label written in the second sector carries the binary form of the PV ID.
 
Old 11-17-2008, 07:25 AM   #4
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
I see. As a workaround you could create the second PV by hand and copy the rest over.

I presume you were not talking about the LVM snapshot facility? What signature of the PV does that create by the way?

Have you hex-edited the PV information or what did you do?
 
Old 11-18-2008, 11:07 AM   #5
mickj
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Original Poster
Rep: Reputation: 0
>As a workaround you could create the second PV by hand and copy the rest over

That would be, I think, labor intensive for the host and storage. Since the storage can create and manage thinly provisioned snapshots, would like to capitalize on that as much as possible.

>I presume you were not talking about the LVM snapshot facility?
No - haven't used that facility.

>What signature of the PV does that create by the way? - unsure of the question - I am guessing that the lvm creates a suitable PV metadata structure for its snapshot.

>Have you hex-edited the PV information or what did you do?
Yes - used dd to copy in the first 256 sectors from the device (/dev/sda) and then edited with vi and placing the screen in hex display mode - (:%!xxd). Unfortunately, after making the edits to the PV uuid in the label area (binary) and the PV uuid in the metadata area (2 copies, ASCII), the LUN was not recognized by pvscan utility.


I have been using the available tools - filter, pvchange, vgrename, but so far appears that when the new LUN is filtered out (to avoid conflict with the master volume), the tools will not operate on that LUN.

suggestions??
 
Old 11-19-2008, 01:22 AM   #6
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
http://www.ibiblio.org/pub/Linux/doc...#snapshotintro

Would that help?
 
Old 12-16-2008, 09:37 AM   #7
SpLaSh212
Member
 
Registered: Mar 2006
Posts: 42

Rep: Reputation: 15
Hey man,
I've needed to mount 2 cloned vg's on the same machine, one of them is the running vg (Production) and the other one is a cloned (or snapshot) version on the production VG.
Here is what you need to do to accomplish this task
1. MAKE SURE that no one is running LVM command while you'r doing this steps !
2. Create a temporary lvm dir (lets name it lvmtemp)
Code:
mkdir /lvmtemp
now copy the lvm.conf file from /etc/lvm to /lvmtemp
Code:
cp /etc/lvm/lvm.conf /lvmtemp
Export the variable LVM_SYSTEM_DIR to point to the temporary dir
Code:
export LVM_SYSTEM_DIR=/lvmtemp/
* This step is needed if you somehow reboot your system while editing your lvm.conf file and your system won't boot up

3.Change filter in your temporary /lvmtemp/lvm.conf file to only see the cloned LUN and your boot LUN
Code:
filter = [ "a|/dev/mapper/CLONE|","a|/dev/mapper/BOOT|","r/.*/" ]
4. Run pvscan command (you should see only the cloned LUN and the boot LUN)

5.Change the UUID's of the cloned PV & VG and rename to avoid duplicates and avoid clashes with the application LUN
Code:
pvchange --uuid /dev/mapper/CLONE --config 'global{activation=0}'  

vgchange --uuid vgAPP --config 'global{activation=0}'  

vgrename vgAPP vgAPP-clone --config 'global{activation=0}'
* The key here is the switch --config 'global{activation=0}' this deactivates device-mapper interaction and thus the commands only change the LVM metadata and not the devices on the system (otherwise the system will think you are changing the VG used for the production application)

6.Remove temporary LVM system directory and lvm.conf
Quote:
unset LVM_SYSTEM_DIR
rm -rf /lvmtemp
7. Run pvscan , vgscan & lvscan and see both physical volumes, volume groups and logical volumes now appear without any error messages about duplicate PV/VG UUID's

8.Activate the clone's VG
Code:
vgchange -ay vgAPP-clone
9. Recreate the LVM /dev/ nodes:

There is a minor bug in the vgchange command, even though we specified --config 'global{activation=0}' there was still minor interaction in /dev/vgAPP, renaming it to /dev/vgAPP-clone.

Without affecting any production application/volume group you can recreate these device node entries in /dev/:

Code:
vgmknodes
10.You should now be able to mount your /dev/vgAPP-clone volume groups, file systems and recover data as required
 
  


Reply



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
LVM and multiple iSCSI disks performance of LVM xxx_anuj_xxx Linux - Server 4 05-01-2008 12:26 PM
What has happened to the metadata ? synapse Slackware 1 08-01-2007 05:50 AM
LXer: Back Up (And Restore) LVM Partitions With LVM Snapshots LXer Syndicated Linux News 0 04-17-2007 11:16 AM
LVM Error: incorrect metadata area header checksum neillans Linux - General 1 02-28-2006 02:06 PM
metadata information Prasun1 Linux - General 7 06-27-2005 11:32 PM

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

All times are GMT -5. The time now is 10:08 PM.

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
Open Source Consulting | Domain Registration