[SOLVED] question about LVM with a DD image from full disk?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
You can only mount filesystems, not (block) devices. Attempting to mount the "LVM Member" is akin to trying to mount /dev/sda (when /dev/sda has partitions).
I imagine vgscan should find your vg(s) - then you'd have to activate it/them with vgchange then mount them. Remember to reverse it all when finished.
Another reason to add to my long list of not advocating image backups.
Since your image will contain an LVM structure identical to the one you copied it from, you cannot have both the original and the copy connected to the system at the same time. They have the same VG and LV names, and the same PV, VG, and LV UUIDs. When accessing an LV, the system will randomly select one or the other. With the system already up and running, connecting the other disk won't cause confusion; you just won't be able to access it. Should you be so unfortunate as to boot with both copies connected, you would need to run "pvs" to see which physical volumes were actually in use.
Instead of using offset with loop device you can with recent util-inux create multiple block devices for each partition and then mount fs or use for other purposes.
As stated you can not mount a volume group image the same way as you mount a regular partition image. Check out the links before. Your setting up the loop device to the LVM partition then mounting the volume group.
no the LCM structure is not identical as it is not from the live system, it is from an external HDD, has nothing to do with it.
OK, good.
Your original post showed no output from the "kpartx -av /exports/backup/BOAT/BOAT.img" command. With that "-v" option, I would expect to see output like
Code:
add map loop0p1 (253:3): 0 6848224 linear /dev/loop0 32
add map loop0p2 (253:4): 0 1048832 linear /dev/loop0 6848256
and those "loop?p?" block devices are what pvscan should be examining and finding the LVM structure. Did no loop devices show up in /dev/mapper after that kpartx command? That sounds like the key to the problem.
Your original post showed no output from the "kpartx -av /exports/backup/BOAT/BOAT.img" command. With that "-v" option, I would expect to see output like
Code:
add map loop0p1 (253:3): 0 6848224 linear /dev/loop0 32
add map loop0p2 (253:4): 0 1048832 linear /dev/loop0 6848256
and those "loop?p?" block devices are what pvscan should be examining and finding the LVM structure. Did no loop devices show up in /dev/mapper after that kpartx command? That sounds like the key to the problem.
running the kpartx -av did the trick. that allowed pvscan to detect the LVM i was missing earlier. now i should be able to access, ill report back with progress:
[root@jackknife ~]# mount /dev/mapper/loop1p5 /mnt/home/
mount: unknown filesystem type 'LVM2_member'
[root@jackknife ~]# kpartx -av /exports/backup/BOAT/BOAT.img
add map loop1p1 (253:3): 0 497664 linear /dev/loop1 2048
add map loop1p2 (253:4): 0 2 linear /dev/loop1 501758
add map loop1p5 (253:5): 0 233938944 linear /dev/loop1 501760
[root@jackknife ~]# pvscan
PV /dev/mapper/loop1p5 VG ubuntu-vg lvm2 [111.55 GiB / 0 free]
PV /dev/sda5 VG centos_jackknife lvm2 [332.00 MiB / 0 free]
PV /dev/sdb3 VG centos_jackknife lvm2 [332.00 MiB / 0 free]
PV /dev/sdc3 VG centos_jackknife lvm2 [332.00 MiB / 0 free]
PV /dev/sdd3 VG centos_jackknife lvm2 [332.00 MiB / 0 free]
PV /dev/sde3 VG centos_jackknife lvm2 [332.00 MiB / 0 free]
PV /dev/sdf3 VG centos_jackknife lvm2 [332.00 MiB / 0 free]
Total: 7 [113.49 GiB] / in use: 7 [113.49 GiB] / in no VG: 0 [0 ]
[root@jackknife ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "ubuntu-vg" using metadata type lvm2
Found volume group "centos_jackknife" using metadata type lvm2
[root@jackknife ~]# mount -t ext3 /dev/mapper/loop1p5 /mnt/home/
mount: /dev/mapper/loop1p5 is already mounted or /mnt/home busy
[root@jackknife ~]# d /mnt/home/
total 0
drwxr-xr-x. 2 root root 6 Dec 17 07:55 ./
drwxr-xr-x. 5 root root 37 Apr 19 16:15 ../
[root@jackknife ~]# cd /dev/mapper/loop1p5
-bash: cd: /dev/mapper/loop1p5: Not a directory
[root@jackknife ~]# d /dev/mapper/loop1p5
lrwxrwxrwx. 1 root root 7 May 24 12:14 /dev/mapper/loop1p5 -> ../dm-5
[root@jackknife ~]# d /dm-t
/bin/ls: cannot access /dm-t: No such file or directory
how can i access the LVM partition from the .img file if i do not mount the .img?
FYI, my system is CentOS v7, yes it an Ubuntu system I'm attempting to gain access to. I know the Ubuntu does some strange stuff with their LVM's is that the problem?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.