Wednesday, November 21, 2007

Mounting LVM Disk using Ubuntu livecd

Mounting is an easy process to do, provided the filesystem type you are using is supported. What happen when you have an LVM formatted disk, and you need to mount it because the disk cannot be booted and a hell lot of valuable data kept inside?? Do not worry, because the solution is here.......

1. Get a live cd, for example, Ubuntu. For this article, I use Ubuntu 6.06 (I cannot find any latest version of ubuntu at my place)

2. Boot using the live cd. Search for these tools: lvm2. If the cd do not have it, install it.
# apt-get install lvm2

3. To make sure the harddisk is recognised, you can use fdisk
# fdisk -lu

4. Once installed, run pvscan to scan all disks for physical volume. this to make sure your LVM harddisk is detected by Ubuntu
# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [74.41 GB / 32.00 MB free]
Total: 1 [74.41 GB] / in use: 1 [74.41 GB] / in no VG: 0 [0 ]


5. After that run vgscan to scan disks for volume groups.
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2


6. Activate all volume groups available.
# vgchange -a y
2 logical volume(s) in volume group "VolGroup00" now active

7. Run lvscan to scan all disks for logical volume. You can see partitions inside the hard disk now active.
# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [72.44 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit

8. Mount the partition to any directory you want, usually to /mnt
# mount /dev/VolGroup00/LogVol00 /mnt

9. You can access the partition in the /mnt directory and can backup your data

52 comments:

Anonymous said...

This is exactly the solution I was searching for, and it worked a treat. Thanks. Please leave this page up for others!

Anonymous said...

Hi thanks for this post. For some reason I add to load a driver manually after having installed the lvm2 package:

$ modprobe dm-mod

Otherwise you get the following:

$ lvscan
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?

Anonymous said...

Thanks a lot, for the post and anonymous for the comment about modprobe dm-mod!

At first, I got a couple of lines like:

ubuntu@ubuntu:~$ sudo vgchange -a y
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.

and lvscan gave problems as well:
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.20 (2007-06-15)(compat) and kernel driver
inactive '/dev/tmp/tmp' [2.00 GB] inherit


After sudo modprobe dm-mod, it worked like a charm.

Anonymous said...

Thanks a lot, for the post and anonymous for the comment about modprobe dm-mod!

At first, I got a couple of lines like:

ubuntu@ubuntu:~$ sudo vgchange -a y
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.

and lvscan gave problems as well:
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.20 (2007-06-15)(compat) and kernel driver
inactive '/dev/tmp/tmp' [2.00 GB] inherit


After sudo modprobe dm-mod, it worked like a charm.

Anonymous said...

Great post indeed, and thank you 100 times for the 2nd post! This helped med alot.

blackorga said...

Thanks a lot you guys for all the comments. Learned a lot from the comments

rFinn said...

This post has been immensely helpful. I can now see my LVM filesystem in Thunar File Manager and can access the files... with one small caveat. The one directory that I really need access to has an X on the folder and tells me permission denied. Anyone have any ideas?

Anonymous said...

rfinn, if you log in as root or just use the "sudo" command, it ignores the permissions and lets you look at the file (and also to change its permissions, if you so desire).

Anonymous said...

What a lifesaver! Thanks for the information. Adding modprobe dm-mod (per one of the comments) between steps 1 and 2 did the trick for me. Thanks to your post, I retrieved all data I thought I was never going to be able to from an lvm disk.

Richmond Aldien (Ricky) said...

Many thanks for the posting....
It helps me a lot to restore and move my company's old files to new server...
really works...
thanks

Anonymous said...

thanks for modprobe dm-mod ....

walter said...

Thanks a lot! It was very useful for me

Anonymous said...

Sweet!

This worked like a charm and allowed me to access a ton of information I had stored on a LVM partition.


Thanks a million.

Anonymous said...

anon delived
modprobe dm-mod
is what i needed

Anonymous said...

nice post

Anonymous said...

"After sudo modprobe dm-mod, it worked like a charm."


Bacon SAVED!!!! thanks

Anonymous said...

Thank you for this, within 5min I got what I wanted.

JT said...

Lifesaver. Where do I donate!?

Anonymous said...

So many thanks for this tip! It worked just fine. Please leave it for others too.

Gangadhar Dubey said...

thanks a lot , I was looking for this .

You can do all things using GUI tool too. "logical volume manager" package from ubuntu.

Unknown said...

Thank you, thank you.

Anonymous said...

Excellent! Exactly what I needed.

fz said...

very helpful post, thank you.

Anonymous said...

two thumbs up! thanks!

Hubert said...

it's 8 hours i look for it !
thank you verrrrrrrrrry much ;)

Wualfred Arreola Jarquín said...

Hello, Thanks by your Post, I follow all successfully, but, in the las step say:

# /bin/mount /dev/VolGroup00/LogVol00 /disco2/
mount: debe especificar el tipo de sistema de ficheros

can you helpme please? regards wualfred

Wualfred Arreola Jarquín said...

Hello, Thanks by your Post, I follow all successfully, but, in the las step say:

# /bin/mount /dev/VolGroup00/LogVol00 /disco2/
mount: debe especificar el tipo de sistema de ficheros

can you helpme please? regards wualfred

Anonymous said...

thx ! exactly what I need. Good job.

Anonymous said...

Thanks very much for this great tutorial. I followed the instructions exactly as posted and it worked like a charm. Keep up the good work.

by Mike A.

Anonymous said...

Thank you so much for posting this, it was very helpful. I did have some issues with permissions when I was trying to get the data off the old LVM partitioned disks. I was able to fix it with chmod and chown commands run under sudo, and remember to use the -R switch so that the new permissions will be applied to all sub folders and files recursively.

THANKS AGAIN!!!

Anonymous said...

Thank you very much !!!

Anonymous said...

Beautiful. Thank you very much. nothing like screwing up the boot sequence on an lvm locked drive.

Mauricio Murillo said...

Thank you!!!!

Anonymous said...

Thank you so much

Anonymous said...

Many thanks, please keep the post.

top seo forums said...

Great concept chosen in this post, which seems to be really helpful to everyone to improve their knowledge.

Register website domain said...

Thanks for sharing the nice thought with the readers..

sysadim guy said...

This was really usefull for me. Thanks very much!

reverse lookup said...

Just wanted to convey my appreciation for what I learned from this article. I look forward to learning more on this website.

Marcelo Santino said...

Thanks man, this works fine!

Unknown said...

Thanks. I was pulling my hair out trying to figure this out. Surprised there's not more guides out there on this.

Anonymous said...

TKS, YOU SAVE MY LIFE!

Jan Mark Salarda said...

Hey guys, i want to ask for help in mounting logical volume. I followed the instructions above and from others sites. But my problem is on mussing volume groups. when I run pvscan,pvs, pvdisplay, the VG field is empty. When I run lvscan and vgscan, No volume groups found message would be return. Hope you will help me. I have been researching this for two days now. Thanks.

blackorga said...

Hi Jan Mark Salarda,

if your pv is not available, u need to create it first using pvcreate command, followed by vgcreate command and then lvcreate to create logical volume. You then need to format it out to whatever file system you desire, before you can mount it to any directory that you wish.

Hope that helps :)cf c

Jan Mark Salarda said...

Thanks for reply.
My physical volumes are available.
Pvs command will return two PV. But VG field is empty on the two PV result. I'm thinking of creating a new VG then adding the existing PV.
But my concern is if my deleted will be deleted if I'm going to do it. Will my data be deleted? Thanks

Sangi said...

This saves a huge time of mine for reinstallation..thanks a lot!! simply superb!

Anonymous said...

Thanks a lot!!!!

Really helped me!!!

Anonymous said...

The ubuntu 13.04 to 13.10 boned up my LVM array. This saved my stuffs!

Cochrane Ranchehouse said...

Happy to see your blog as it is just what I’ve looking for and excited to read all the posts. I am looking forward to another great article from you.

IMKenny said...

Your guide is still useful in 2014! An update to grub 2.0 left my system unbootable. So I booted with a Live CD, but I couldn't mount my root partition, which is in LVM. Then I found your page, installed lvm2 as you described, and ran all the lvm commands pvscan, vgscan, etc, and it all worked perfectly - I can mount and browse the partition now. Next task: repair the GRUB damage.

Janos from Hungary said...

Thanks for this excellent solution.

Monika Gupta said...

Thanks for all your efforts that you have put in this.Very interesting information.I would like to do all the information

Computer Repairing Services In Delhi