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

From ForensicsWiki
Jump to: navigation, search
Line 36: Line 36:
  
 
Where $VOLUMEGROUP is the corresponding name of the volume group
 
Where $VOLUMEGROUP is the corresponding name of the volume group
 +
 +
== Mounting an LVM from a device ==
 +
 +
To list the Volume Groups (VG) run:
 +
<pre>
 +
pvs
 +
</pre>
 +
 +
To list information about a Volume Group (VG) run:
 +
<pre>
 +
lvdisplay $VOLUMEGROUP
 +
</pre>
 +
 +
The field "LV Name" provides the volume name
 +
 +
To make the volume group known to the system
 +
<pre>
 +
vgexport $VOLUMEGROUP
 +
</pre>
 +
 +
And active the volumes in the volume group
 +
<pre>
 +
vgchange -a y $VOLUMEGROUP
 +
</pre>
 +
 +
The individual volume devices are now available in:
 +
<pre>
 +
/dev/mapper/$VOLUMEGROUP-$VOLUMENAME
 +
</pre>
 +
 +
These now can be inspected with e.g. a tool like the [[Sleuthkit]] or loop-back mounted.
 +
 +
To read-only loop-back mount an individual volume:
 +
<pre>
 +
mount -o ro /dev/mapper/$VOLUMEGROUP-$VOLUMENAME filesystem/
 +
</pre>
  
 
== Also see ==
 
== Also see ==

Revision as of 04:33, 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.

Not all forensic tools have support for Linux Logical Volume Manager (LVM) volumes, but most modern Linux distributions do.

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 the changes 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

Mounting an LVM from a device

To list the Volume Groups (VG) run:

pvs

To list information about a Volume Group (VG) run:

lvdisplay $VOLUMEGROUP

The field "LV Name" provides the volume name

To make the volume group known to the system

vgexport $VOLUMEGROUP

And active the volumes in the volume group

vgchange -a y $VOLUMEGROUP

The individual volume devices are now available in:

/dev/mapper/$VOLUMEGROUP-$VOLUMENAME

These now can be inspected with e.g. a tool like the Sleuthkit or loop-back mounted.

To read-only loop-back mount an individual volume:

mount -o ro /dev/mapper/$VOLUMEGROUP-$VOLUMENAME filesystem/

Also see

External Links