LVM, huh? Always seems like kind of an unnecessary complication.
Except, really it's kind of awesome.
I've done some hardware refreshing here at HA Towers lately. I replaced the virtual machine host box I built a couple of years back; it was running OK, but I keep wanting to play with new things and its hard 16GB RAM limit was starting to get too small. So I built a new VM host box, using a Core i7-4790 on an Asus H97M-E motherboard with 32GB of RAM. (I also upgraded the box I'm using to host my openQA instance - it's also now running an i7-4790, but only has 16GB of RAM, the most its motherboard can take).
The old vmhost had a 128GB RAID-1 array made up of two Samsung 840 Pro SSDs, but I was also starting to run out of space on that. So, the new one has a 240GB RAID-1 array of Intel 730 SSDs (I'd have gone for 850 Pros, but Samsung sure bumped the price).
So now I had two 128GB SSDs lying around the place. Turns out I also had another one lying around (as a spare for the old vmhost RAID array). Also, I was running out of space on my desktop, which had a single 128GB SSD (a Crucial C300, which is probably getting on a bit in years as well).
Hum! Seems like I could put all those drives to use...
So I shoved the three drives I now had spare into my desktop (took some creative SATA power cable juggling...) and built a RAID-5 array out of them. Now I have 256GB of somewhat fault-tolerant storage! But all my data's still sitting on the single 128GB SSD that's getting on a bit...
Fortunately, it was also all in LVM volumes. And hey, turns out LVM is pretty awesome. You can add a new drive - or, in this case, RAID set - to the volume group as a new PV, on the fly. You can then transfer your existing LVs from the existing PV (in my case, the old 128GB SSD) to the new PV (the RAID-5 array) - on the fly, and atomically (i.e. if it all goes tits-up half-way through, you're not screwed). You can then resize the LVs, on the fly. And thanks to
resize2fs, you can grow the ext4 filesystems that sit on the LVs...on the fly.
So I was able to migrate my entire running system from a single SSD to a newly-created RAID-5 array and resize it to take advantage of the extra space - without rebooting the system, or even unmounting a single partition.
That's pretty neat!
Now the old SSD can hang around as a spare.
(So far as
/boot goes, I created a partition for it on one of the new disks ahead of time and dd'ed the existing partition onto the new one, which preserves the UUID).