Does LVM increase the risk of data loss?
The worst and most likely case is that you will lose everything. If you have a single logical volume spanning both drives, and you lose one drive with no mirroring, you've essentially wiped out half the file system.
From this point, it gets mildly better depending on what file system you are running on your volume. Assuming that you are not using striping, which will kill any chance you have, you may be able to get some of your data back by running recovery software on the second drive. I don't have personal experience with that case, but it should be theoretically possible to get some or most of the files that were exclusively on the still functional drive if you are using one of the more 'robust' file systems (i.e. ext3
or ext4
).
Your mileage will vary depending on what filesystem you are using on top of LVM and how your files are arranged on the disks though. If they are fragmented across both disks then you will still lose those files too.
Since your concern is data loss using LVM, it's useful to discuss loss of one of your two disks using the (3) LV configurations available to choose from:
LV Types:
Linear: The DEFAULT option when creating an LV without supplying any switches to create the other two types of LV's below. In a Linear LV, if a Physical Volume (PV) drops out of the Volume Group (VG), you only lose the LV(s) on that PV. However, if an LV spans MULTIPLE PVs and any PV (disk) it uses drops out, the entire LV will be lost. This is logical: the filesystem is spanned across the 2 PVs, so it would be catastrophically damaged with the loss of either disk. Any LV's residing on or NOT spanned across the missing PV member will survive.
Striping: Specify the " -i " switch when creating an LV. Although this provides better write performance, ALL data is written round-robin across the striped PVs. If any PV in the stripe is lost, so too are ALL LVs residing on ALL the PVs.
Mirroring: Specify the " -m " switch when creating your LV. This is analogous to RAID1: Increased fault tolerance to protect against data loss, but uses twice the space.
Finally, when managing data- LVM, RAID or no abstraction at all- you're only as good as your PROVEN backups.
Check How Physical Extents Mapped
To see how your data is mapped in relation to PVs it lives on:
pvdisplay -m
Check if LV's are striped (multiple PVs)
If you have multiple PVs and need to determine if the LV is striped across them:
lvs -o+lv_layout,stripes
Simplified Illustrative Example:
As you can see in the illustration, since LV "var" requires extents from all three PVs, were any of the PVs lost, the filesystem on LV "var" would be catastrophically damaged.
Useful References:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/logical_volume_manager_administration/lv_overview#linear_volumes
http://manpages.ubuntu.com/manpages/xenial/man8/lvcreate.8.html