Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do I mount an existing LVM volume without loosing the data?
I have a disk (partitioned with lvm) that I need to get data from; original system is gone.
I have connected the drive to a new box (/dev/hdc)
I'm trying to figure out how to mount the volumes without loosing the data.
using Redhat 8; I have been through the lvm man pages; all options seem to include reinitializing the disk to get the volumes mounted.
fdisk shows:
----------------------------------------------------------------------
Disk /dev/hdc: 255 heads, 63 sectors, 19929 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 1305 10482381 8e Linux LVM
/dev/hdc2 1306 1436 1052257+ 8e Linux LVM
/dev/hdc4 1437 19929 148545022+ 5 Extended
/dev/hdc5 1437 2059 5004216 8e Linux LVM
/dev/hdc6 2060 2682 5004216 8e Linux LVM
I was able to get one vol grp remounted as well as the log vol associated.
[root@wdrlnxws2 root]# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- ACTIVE PV "/dev/hdc1" of VG "vg02" [9.99 GB / 0 free]
pvscan -- inactive PV "/dev/hdc2" is associated to unknown VG "vg00" (run vgscan)
pvscan -- inactive PV "/dev/hdc5" is associated to unknown VG "vg01" (run vgscan)
pvscan -- ACTIVE PV "/dev/hdc6" of VG "vg02" [4.77 GB / 2.77 GB free]
pvscan -- total: 4 [20.55 GB] / in use: 4 [20.55 GB] / in no VG: 0 [0]
the other two vol groups give me errors on export and import (see below)
any ideas for safe mounting or am i hosed with vg00 and vg01?
NOTE: i did not export these vol groups before i shut down the old system.
[root@wdrlnxws2 root]# vgexport vg00
vgexport -- ERROR "vg_read_with_pv_and_lv(): current PV" reading data of volume group "vg00"
[root@wdrlnxws2 root]# vgexport vg01
vgexport -- ERROR "vg_read_with_pv_and_lv(): current PV" reading data of volume group "vg01"
[root@wdrlnxws2 root]# vgimport vg00 /dev/hdc2
vgimport -- ERROR: physical volume "/dev/hdc2" doesn't belong to an exported volume group
[root@wdrlnxws2 root]# vgimport vg01 /dev/hdc5
vgimport -- ERROR: physical volume "/dev/hdc5" doesn't belong to an exported volume group
i'm sorry; i forgot to put that in my earlier response.
root@wdrlnxws2 etc]# vgscan
vgscan -- reading all physical volumes (this may take a while...)
vgscan -- found active volume group "vg02"
vgscan -- ERROR "vg_read_with_pv_and_lv(): current PV" can't get data of volume group "vg00" from physical volume(s)
vgscan -- ERROR "vg_read_with_pv_and_lv(): current PV" can't get data of volume group "vg01" from physical volume(s)
vgscan -- "/etc/lvmtab" and "/etc/lvmtab.d" successfully created
vgscan -- WARNING: This program does not do a VGDA backup of your volume groups
I had your exact problem about two years ago, when a system had died and I moved the drives to a new machine. I can't remember exactly what I did to get everything to work, but I did not loose any data.
Have you tried running the vgimport with the -f flag? Force the import even if the pv was not flaged as exported.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.