0

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

laimison
  • 579
  • 2
  • 9
  • 17
  • 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. – drookie Oct 09 '22 at 20:53
  • 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. – laimison Oct 09 '22 at 21:07
  • 1
    Lol. I'll leave this up to you: experience is arrogant. :) – drookie Oct 09 '22 at 21:14
  • 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 :) – laimison Oct 09 '22 at 21:25
  • Don't try to convince me; you'll need to convince your data that it's still recoverable. – drookie Oct 09 '22 at 21:33
  • 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. – drookie Oct 09 '22 at 21:36
  • 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. – laimison Oct 09 '22 at 21:57
  • 1
    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. – A.B Oct 09 '22 at 23:03
  • @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 – laimison Oct 10 '22 at 16:18
  • 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. – A.B Oct 10 '22 at 17:03

0 Answers0