Difference between revisions of "Linux Logical Volume Manager (LVM)"

From Forensics Wiki
Jump to: navigation, search
Line 2: Line 2:
  
 
The [[Linux]] Logical Volume Manager, is commonly abreviated to LVM. Although LVM can used for other [http://en.wikipedia.org/wiki/Logical_Volume_Management Logical Volume Management] variants as well.
 
The [[Linux]] Logical Volume Manager, is commonly abreviated to LVM. Although LVM can used for other [http://en.wikipedia.org/wiki/Logical_Volume_Management Logical Volume Management] variants as well.
 +
 +
== Mounting an LVM from an image ==
 +
If you have an image mount the LVM read-only on a loopback device (e.g. /dev/loop1) by:
 +
<pre>
 +
sudo losetup -r -o $OFFSET /dev/loop1 image.raw
 +
</pre>
 +
 +
Note that the offset is in bytes.
 +
 +
If you need to write to the image, e.g. for recovery, use [[xmount]] to write to a [[shadow file]] (or cachefile in xmount terminology).
 +
<pre>
 +
sudo xmount --in dd --cache sda.shadow sda.raw image/
 +
</pre>
 +
 +
You can then safely mount the LVM in read-write mode (just omit the -r in the previous losetup command).
 +
 +
To remove this mapping afterwards run:
 +
<pre>
 +
sudo losetup -d /dev/loop1
 +
</pre>
 +
 +
To scan for new physical volumes:
 +
<pre>
 +
lvm pvscan
 +
</pre>
 +
 +
You cannot unmount an active volume group. To detach (or deactivate) the volume group:
 +
<pre>
 +
vgchange -a n $VOLUMEGROUP
 +
</pre>
 +
 +
Where $VOLUMEGROUP is the corresponding name of the volume group
  
 
== External Links ==
 
== External Links ==
 
* [http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29 Wikipedia article on Logical Volume Manager]
 
* [http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29 Wikipedia article on Logical Volume Manager]
 +
* [http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm RedHat - LVM cheatsheet]

Revision as of 02:59, 31 July 2012

Information icon.png

Please help to improve this article by expanding it.
Further information might be found on the discussion page.

The Linux Logical Volume Manager, is commonly abreviated to LVM. Although LVM can used for other Logical Volume Management variants as well.

Mounting an LVM from an image

If you have an image mount the LVM read-only on a loopback device (e.g. /dev/loop1) by:

sudo losetup -r -o $OFFSET /dev/loop1 image.raw

Note that the offset is in bytes.

If you need to write to the image, e.g. for recovery, use xmount to write to a shadow file (or cachefile in xmount terminology).

sudo xmount --in dd --cache sda.shadow sda.raw image/

You can then safely mount the LVM in read-write mode (just omit the -r in the previous losetup command).

To remove this mapping afterwards run:

sudo losetup -d /dev/loop1

To scan for new physical volumes:

lvm pvscan

You cannot unmount an active volume group. To detach (or deactivate) the volume group:

vgchange -a n $VOLUMEGROUP

Where $VOLUMEGROUP is the corresponding name of the volume group

External Links