unixcommando
Posts: 16
Joined: Sun Dec 04, 2016 6:08 pm

Multi PV LVM Mirror

Sat Feb 18, 2017 11:36 pm

Greetings,

One of my Pi's I use as a Plex server which has turned out fantastic. Since I have over 800 films stored on about 2T of storage I found it impractical to try and use a traditional backup scheme, so I mirrored 2 4T disks. This works really well, I feel confident I have storage integrity should one of my drives fail. This still doesn't give me backup though and I'd like to have a device I can attach, silver to my mirror and detach for long term storage.

Creating and breaking a 2 PV mirror with LVM2 is very easy, but it leaves me vulnerable while the mirror legs are resilvering. So, I've been experimenting with one of my other Pis on creating an breaking a 3 leg mirror. Creating the 3 leg mirror is a piece of cake and removing a leg is also very easy, where everything comes apart is when I try to assign the removed leg to a new VG. In my mirror I have 3 PV, /dev/sda1, /dev/sdb1, and /dev/sdc1. I want to remove /dev/sdc1 from the mirror, the following shows the sequence I've tried:

$ lvconvert --splitmirrors 1 -n split1 mirror_vg/mirror_lv /dev/sdc1

$ lvchange -an mirror_vg/split1

$ vgsplit mirror_vg mirror2_vg /dev/sdc1
Logical volume mirror_vg/mirror_lv must be inactive.

As you can see from my sequence I do make mirror_vg/split1 inactive before I attempt to change the VG, yet it complains that the original LV must be inactive. I don't get this error with a 2 PV mirror, using this exact same sequence with a 2 PV mirror my device detaches from the mirror, I can spit it off to another VG and mount it on a new mountpoint and everything looks perfect. Even in this case I can perform an lvremove of mirror_vg/split1 and a vgreduce for /dev/sdc1 and remove the PV from the VG, what I haven't succeeded at is breaking a 3 leg mirror and putting the third leg in it's own VG.

There are of course other ways I can achieve what I want to do, but right now this is a battle of wills, I'm not going to give this up until I can figure out how to break a 3 leg mirror and separate the 3rd leg from the VG. When I used to support Sun Solaris machines I could perform this task easily with SVM and did often when I needed to sneakernet large quantities of data. I'd like the same with LVM.

Cheers
-Bob

Return to “Advanced users”