Mon - Feb 02, 2009 : 09:48 pm
amazed
LVM2 Auto-Reconnect
I run a server in my home. It's nothing more than a hobby-type server that runs gentoo Linux, a couple of web-sites, my myth-tv installation for my home-theater, and all the family files. I also have about 150 compressed movies on there, all of which can certainly take up a lot of hard drive space.
I started this project back in 2004, and my little server just keeps chugging along. It's gone through 2 motherboards, 2 CPUs, a root hard drive failure (which was 99% recovered thanks to the beauty of ReiserFS's fsck implementation), and about 4 sets of hard drives.
The reason for so many hard drives is quite simple. I keep buying movies. As the need for additional hard drive space goes upward, I simply buy another hard drive and (using the magic of LVM2), simply move all content from one hard drive, remove the hard drive, insert the bigger one, assign it the space, and voila! my movies directory magically has more space!
Anyway... Because this server's gentoo installation has undergone some serious abuse over the course of 4 years, the installation was seriously getting foobed. This isn't a server which just sits and runs. Every month or so, I get the itch to try something new and funky on it, and then sometimes remove the new package, sometimes not. I've switched between instable and stable for practically every package on there at least 5 times.
The wear and tear on this poor server was getting evident. It only recognized one of the two CPU cores (and yes, I checked and re-checked the kernel), mythtv was forgetting to record stuff and crashing intermittently, and more and more stuff just didn't work quite right.
I think the original kernel installed on the box 4 years ago was around 2.6.8. Anyway... I digress.
To make this already-too-long story a bit shorter, suffice it to say that it was well past time to do a complete re-install of gentoo.
So, yesterday, I undertook the challenge and built my new server Linux installation, on my workstation, and after verifying everything, I powered the old beast down, removed the root hard drive, and put the new one in.
Now, my box has had from 4 to 6 hard drives in it through the years and at the time, there were 5. Four of these hard drives were driven by LVM2 and ReiserFS. Their destiny in life is to provide me a place to store about a terabyte of media. The fifth was the root.
So, I completely assumed that removing the root hard drive would kill all the data needed to restore the LVM partitions containing my media. No problem. I backed it all up beforehand.
So, with the new hard drive in, I powered it up, fixed a few things I forgot, got it to boot, and all was good.
I powered it down to do some hardware maintenence, and just happened to be watching the shut-down scripts, and I was about to head back to the server, when I saw the system unmounting the LVM2 partitions which I thought had been deleted.
I had to do a double-take.
So, I powered it up, went to /dev, and sure enough... All the nodes for my media were there waiting to be mounted to their directories.
I couldn't believe it! Ever since the idea of a Linux-driven media server came to mind, I've depended on LVM2 to help keep things in check. I've loved it. It's done exactly what it is supposed to, and hasn't caused me any grief at all. This was the icing on the cake.
So, I quickly mounted my "movies" node to a directory, and sure enough, a full listing of all my movies was glowing before my smiling face. Although I was ready to restore it all, and had completely intended on it disappearing, all my original media on my server's LVM2 partitions were already good to go.
Thanks to all the intelligent developers working on LVM2, making my life a little bit better. Keep it up.
Computers / Gentoo / Linux