Score:0

LVM: one volume group that has HD and SSD disks - can I access SSD based logical volume when HD dies?

au flag

Let's assume I have two physical disks:

/dev/sda1 - hard disk

/dev/sdb1 - SSD disk

I create volume group:

sudo vgcreate hd_and_sd_vg /dev/sda1 /dev/sdb1

Now I create logical volumes:

lvcreate -L 10G -n my_test_volume_on_hd VolumeGroupName /dev/sda1
lvcreate -L 10G -n my_test_volume_on_sd VolumeGroupName /dev/sdb1

I can use command such as pvdisplay -m to confirm that extents are distributed correctly. my_test_volume_on_hd LV sits on hard disk, my_test_volume_on_sd LV sits on SD.

Now /dev/sda hard disk dies.

Can I still access the data on my_test_volume_on_sd?

Thanks

drookie avatar
za flag
Smart approach - to skip PV creation. But in reality you cannot do that. So - yeah, in your imaginary LVM4 implementation you will be able to access your data.
laimison avatar
au flag
Ok, `vgcreate` needs a natural step of `pvcreate`, that is correct and getting back to present, LVM is at version 2. I assume an answer to my main question is still yes.
drookie avatar
za flag
Lol. I'll leave this up to you: experience is arrogant. :)
laimison avatar
au flag
My logic clearly says, the answer is Yes :) But better to spend some time on investigation/or ask than sorry. If you skip something in IT or be optimistic that something will magically work, it will definitely teach you a lesson the hard way :)
drookie avatar
za flag
Don't try to convince me; you'll need to convince your data that it's still recoverable.
drookie avatar
za flag
Being serious - yeah, when you create separate volumes on separate pvs - data will be fine; but yours don't look that separate and your command s are erroneous; the thing is - what they will be when corrected.
laimison avatar
au flag
The practical use case is this: I want to use this VG for backups. I have few servers that are equivalent and backups are pushed to them. So I'm happy to lose all data on one server/one VG. Additionally, when there is some spare space, I would like to create mirrored VG (under two PVs) - I just want to not lose this opportunity to be able to create mirrored LV, if there is a need in the future. I just put HD and SD in my example, but in reallity I have two HDs. In my understanding, `vgcreate ... /dev/sda1 /dev/sdb1` writes LVM information to both disks so losing one doesn't mean LVM is broken.
A.B avatar
cl flag
A.B
You still have the data. And if you also have LVM backups (in system's /etc/lvm) there has to be a way to recover a "working" VG. Perhaps using a sparse file over /dev/loop0 as long as the same PV's UUID is put back (using the backup). @drookie "but yours don't look that separate" . The VG might not be, but the LV's extents are, thanks to having provided the PV at their creation.
laimison avatar
au flag
@A.B do you have any process for this backup? What I've found is this `vgcfgbackup -f /mnt/backup/hd_and_sd_vg.backup /dev/hd_and_sd_vg ` - that seems sufficient to backup, right? There is a caveat in restore process, that specifying incorrect UUID will lead you to data loss. So it's better to restore on a separate system if data is sensitive: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/mdatarecover
A.B avatar
cl flag
A.B
I don't know the details else I would write an answer. I refrain from saying something precise because I don't want to be responsible for data loss. You should do tests about this somewhere else before applying it on the real data.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.