
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.sabayonlinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Mount_LVM&amp;feed=atom&amp;action=history</id>
		<title>HOWTO: Mount LVM - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Mount_LVM&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Mount_LVM&amp;action=history"/>
		<updated>2013-05-24T20:40:38Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.4</generator>

	<entry>
		<id>http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Mount_LVM&amp;diff=18049&amp;oldid=prev</id>
		<title>Hatalar205 at 19:47, 27 October 2012</title>
		<link rel="alternate" type="text/html" href="http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Mount_LVM&amp;diff=18049&amp;oldid=prev"/>
				<updated>2012-10-27T19:47:58Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{i18n| [[HOWTO: Mount LVM|en]] [[Tr:HOWTO: Mount LVM|tr]] }}&lt;br /&gt;
&lt;br /&gt;
=Mounting LVMs=&lt;br /&gt;
&lt;br /&gt;
==Manually==&lt;br /&gt;
Mounting an LVM may seem a bit intimidating, it's not. In reality, despite the length of this entry, you will only be running a handful of commands, and most of those just to get the needed information. Do not despair, this will be as painless as possible. All of these commands will be run as root from a terminal. Please also remember that your volume names may differ from the guide, please make sure to adjust accordingly.&lt;br /&gt;
&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt; # pvs &amp;lt;/pre&amp;gt;}}&lt;br /&gt;
This should give you an output similar to&lt;br /&gt;
&amp;lt;pre&amp;gt;sabayonx86 sabayonuser # pvs&lt;br /&gt;
  PV         VG         Fmt  Attr PSize PFree &lt;br /&gt;
  /dev/sda2  VolGroup00 lvm2 a-   7.88G 32.00M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If we look closely we can see that /dev/sda2 holds a lvm that is 7.88 gig in size. In this case, that's the one we want, as it is the only one.&lt;br /&gt;
&lt;br /&gt;
So now we want to see what is actually in that lvm&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt; # lvdisplay /dev/VolGroup00 &amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&amp;lt;pre&amp;gt;sabayonx86 sabayonuser # lvdisplay /dev/VolGroup00&lt;br /&gt;
  --- Logical volume ---&lt;br /&gt;
  LV Name                /dev/VolGroup00/LogVol00&lt;br /&gt;
  VG Name                VolGroup00&lt;br /&gt;
  LV UUID                SWp2V0-1xPU-0tOP-UnPs-snxF-THUl-pZMKb2&lt;br /&gt;
  LV Write Access        read/write&lt;br /&gt;
  LV Status              available&lt;br /&gt;
  # open                 0&lt;br /&gt;
  LV Size                6.88 GB&lt;br /&gt;
  Current LE             220&lt;br /&gt;
  Segments               1&lt;br /&gt;
  Allocation             inherit&lt;br /&gt;
  Read ahead sectors     auto&lt;br /&gt;
  - currently set to     256&lt;br /&gt;
  Block device           251:0&lt;br /&gt;
   &lt;br /&gt;
  --- Logical volume ---&lt;br /&gt;
  LV Name                /dev/VolGroup00/LogVol01&lt;br /&gt;
  VG Name                VolGroup00&lt;br /&gt;
  LV UUID                MGBeJP-ohrX-KLju-5V78-iJOi-pP3w-huaOmC&lt;br /&gt;
  LV Write Access        read/write&lt;br /&gt;
  LV Status              available&lt;br /&gt;
  # open                 0&lt;br /&gt;
  LV Size                992.00 MB&lt;br /&gt;
  Current LE             31&lt;br /&gt;
  Segments               1&lt;br /&gt;
  Allocation             inherit&lt;br /&gt;
  Read ahead sectors     auto&lt;br /&gt;
  - currently set to     256&lt;br /&gt;
  Block device           251:1&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
We are looking for two things out of that list: '''LV name''' and '''LV Size'''. We have one that is '''6.88 GB''' and one that is '''992 MB'''. We can safely assume that the smaller of the two is /swap so the larger must be our real filesystem. That one is named '''/dev/VolGroup00/LogVol00'''.&lt;br /&gt;
&lt;br /&gt;
So now we have all the information that we need. We need only to make a mount point and actually mount the volume.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;# cd /mnt&lt;br /&gt;
# mkdir lvm&lt;br /&gt;
# vgscan --mknodes&lt;br /&gt;
# lvchange -a y /dev/VolGroup00/LogVol00&lt;br /&gt;
# mount /dev/VolGroup00/LogVol00 /mnt/lvm&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
If all went well then we can now get inside and look around, make changes, chroot in, or whatever caused us to want to mount the LVM in the first place.&lt;br /&gt;
&lt;br /&gt;
==Automatically using a script==&lt;br /&gt;
&lt;br /&gt;
The following is a script that will do all of that for you, in a slightly different way. You need only copy and paste the text in the box below to a text file that you make on your system. Once you copy and paste, save the file and go root, alternately you may download the script file [http://forum.sabayonlinux.org/viewtopic.php?f=86&amp;amp;t=17272&amp;amp;p=99187#p99187 this thread] from the forums. If you download from the forums, don't forget to rename the file lvm-mount.sh . Either way you do it, after the file is saved you need to go root and run the following commands:&lt;br /&gt;
&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# chmod a+x lvm-mount.sh&lt;br /&gt;
# sh lvm-mount.sh &lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
The script will then run and let you know where is mounted your LVM(s) for you. It will also print instructions on your screen as to how to chroot in to the LVM if that was what you were needing to do.&lt;br /&gt;
&lt;br /&gt;
lvm-mount.sh&lt;br /&gt;
{{File| lvm-mount.sh | &amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
#! /bin/bash&lt;br /&gt;
## This script is released under the GPL version 2&lt;br /&gt;
## copyright (2009) James Cook&lt;br /&gt;
## Thanks goes to Klaus Knopper who reminded me of something&lt;br /&gt;
## very simple that I had forgotten at the time, thanks bud.&lt;br /&gt;
## the author may be contacted at:&lt;br /&gt;
## azerthoth (at) gmail.com&lt;br /&gt;
&lt;br /&gt;
## Check for user is root&lt;br /&gt;
## Thanks to micia for the suggestion&lt;br /&gt;
if [ $UID -ne 0 ]; then&lt;br /&gt;
   echo &amp;quot;You need to be root to run this script!&amp;quot;&lt;br /&gt;
   exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
## get them all into /dev/mapper&lt;br /&gt;
modprobe dm-mod 2&amp;gt; /dev/null || :&lt;br /&gt;
vgscan --ignorelockingfailure --mknodes || :&lt;br /&gt;
vgchange -aly --ignorelockingfailure || return 2&lt;br /&gt;
clear&lt;br /&gt;
mkdir /LVM&lt;br /&gt;
cd /dev/mapper&lt;br /&gt;
&lt;br /&gt;
## Create directories and mount&lt;br /&gt;
for FILE in *; do&lt;br /&gt;
test -b &amp;quot;$FILE&amp;quot; &amp;amp;&amp;amp; mkdir /LVM/$FILE &amp;amp;&amp;amp; mount /dev/mapper/$FILE /LVM/$FILE 2&amp;gt;/dev/null&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
## List good partitions&lt;br /&gt;
echo &amp;quot;Cleaning up LVMs that were swap partitions or with unsupported&amp;quot;&lt;br /&gt;
echo &amp;quot;File Systems from the list. This will not effect those partitions&amp;quot;&lt;br /&gt;
echo &amp;quot;There is just no need to list or parse them&amp;quot;&lt;br /&gt;
rmdir /LVM/Vol* 2&amp;gt;/dev/null&amp;quot;&lt;br /&gt;
echo &amp;quot; &amp;quot;&lt;br /&gt;
echo &amp;quot;The following LVM(s) were mounted for you and are ready to use&amp;quot;&lt;br /&gt;
echo &amp;quot; &amp;quot;&lt;br /&gt;
ls /LVM&lt;br /&gt;
echo &amp;quot; &amp;quot;&lt;br /&gt;
echo &amp;quot;You can find them in /LVM&amp;quot;&lt;br /&gt;
echo &amp;quot; &amp;quot;&lt;br /&gt;
&lt;br /&gt;
## chroot instructions&lt;br /&gt;
echo &amp;quot;If you are rescuing/fixing a previous installation please issue&amp;quot;&lt;br /&gt;
echo &amp;quot;the following commands&amp;quot;&lt;br /&gt;
echo &amp;quot;cp -L /etc/resolv.conf /LVM/&amp;lt;your_lvm_name&amp;gt;/etc/resolv.conf&amp;quot;&lt;br /&gt;
echo &amp;quot;mount -t proc none /LVM/&amp;lt;your_lvm_name&amp;gt;/proc&amp;quot;&lt;br /&gt;
echo &amp;quot;mount -o bind /dev /LVM/&amp;lt;your_lvm_name&amp;gt;/dev&amp;quot;&lt;br /&gt;
echo &amp;quot;chroot /LVM/&amp;lt;your_lvm_name&amp;gt; /bin/bash&amp;quot;&lt;br /&gt;
echo &amp;quot;env-update&amp;quot;&lt;br /&gt;
echo &amp;quot;source /etc/profile&amp;quot;&lt;br /&gt;
## this process may also be interactively automated in the future&lt;br /&gt;
## more coffee and ambition is needed&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
See that wasn't so hard now was it.&lt;br /&gt;
&lt;br /&gt;
~Az&lt;br /&gt;
&lt;br /&gt;
[[Category:Filesystems|Mount LVM]]&lt;/div&gt;</summary>
		<author><name>Hatalar205</name></author>	</entry>

	</feed>