I finally got around to getting LVM (Logical Volume Management) up and running on my server at home. A few people had mentioned that it was quite difficult and I must say that it can be a bit daunting but really shouldn’t be.
I pretty much followed this article (http://www.howtoforge.com/linux_lvm) but I must admit that there were some things that I was confused about from the outset, hence my little introduction and LVM FAQ.
LVM allows you to combine many physical drives or partitions (Physical Volumes – PV) into one “Virtual Drive” (Volume Group – VG). You can then create “Partitions” (Logical Volumes – LV) on that Volume Group. You can add new drives or partitions to you Volume Group whenever you feel like it. Additionally you can resize your Logical Volumes whenever you feel like it too. (Image courtesy of the article… I’ll copy it onto my own server when I get back to a shell)
FAQ: (Feel free to mail me questions and I’ll add them here)
Q. Why would I want LVM?
A. If you have lots of media spread across a few drives LVM can be a godsend.
Q. Do I need to reinstall linux in order to install LVM?
A. No, you can install LVM whenever you want and you can undo your changes whenever you want.
Q. What’s the best way to start?
A. I’d say you should start by playing around a bit. (You’ll need to read the article in order to understand how to do these things)
- Resize one of your partitions to free up 5gigs somewhere
- Create a 5 1G partitions to play with.
- Create a Physical Volume for each of your partitions
- Create a Volume Group and add 3 of you 1G Physical Volumes to it. (3 is just a random number, you can create a Volume Group with 1 Physical Volume)
- Create a 3G logical volume, Format it (ext3 is good), Mount it somewhere
- Put some files in it
- Add the rest of your 1G Physical Volumes to the Volume Group
- Create another 1G Logical Volume
- Resize your original 3G Logical Volume to 4G. (Unmount it first then lvextend() and then run resize2fs for FS’ like ext3.)
Q. Is it dangerous?
A. Yes, if you do stupid things like lvreduce() thinking that it wont wipe the data on the logical volume.
Q. Is it redundant?
A. No… that’s what RAID is for… but you can add RAIDed redundant partitions to your LVM and then your LVM will be redundant.
All in all I’m happy and almost near my life long goal of having a 1 terrabyte folder.