I am in a conundrum. I need to extract data from a backup image I created previously. I thought I knew enough about LVM to get by... at least until now.
It seems my blunder is that I backed up an LVM snapshot volume rather than the whole volume group or disk partition. Most articles I've read imply that you've backed up the entire disk.
Here is my LVM layout:
xvda 202:0 0 10G 0 disk
└─xvda1 202:1 0 10G 0 part
├─lvm1-root 254:2 0 8.1G 0 lvm /
└─lvm1-swap 254:3 0 956M 0 lvm [SWAP]
Here is my backup command:
lvcreate -L800M -s -n rootsnapshot /dev/lvm1/root
dd if=/dev/lvm1/rootsnapshot conv=sync,noerror bs=128K status=progress of=/path/to/snapshot.dd
I've mounted the DD file as /dev/loop0 on another machine.
Here is what I get:
# fdisk -l
Disk /dev/loop0: 8.1 GiB, 8657043456 bytes, 16908288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
# lvmdiskscan
/dev/loop0 [ 8.06 GiB]
/dev/sda1 [ <7.00 GiB]
/dev/sda5 [ 1022.00 MiB]
0 disks
3 partitions
0 LVM physical volume whole disks
0 LVM physical volumes
# vgscan -v
Reading all physical volumes. This may take a while...
No volume groups found.
Any idea how I might go about mounting this snapshot to retrieve data from it?
Figured it out. It's super simple.
First off, my problem was that my latest DD backup file was entirely full of 0x00 bytes...
Once I grabbed an older backup that contained real data, things went very smoothly.
Works perfectly!