- What is the best way to convert LVM VolumeGroup/Volume identifiers (e.g.
system/var) to device names (e.g.
/dev/system/var) and vice versa?
- Is it safe to just use
/dev/VolumeGroup/Volumeor are there any caveats (as in the
/dev/mapper/VolumeGroup-Volumeform, where dashes are treated specially)?
- What are the essential differences in using
/dev/VolumeGroup/Volume? Pro/Con for each form?
I want to automatically create LVM snapshots for backup purposes.
The configuration should only include the source path in the filesystem (for this example
/etc/mtab yields the device, which is mounted on that path:
# grep /var /etc/mtab /dev/mapper/system-var /var ext4 rw 0 0
Now I can use
lvs to find out VolumeGroup and Volume:
# lvs --noheadings /dev/mapper/system-var var system -wi-ao 18,62g
Create the snapshot:
# lvcreate -s -n var-snapshot -p r -l10%ORIGIN system/var
Now I need the device name to mount the snapshot.