LVM for the WIN.

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.

The basics

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)

LVM Basics

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)

  1. Resize one of your partitions to free up 5gigs somewhere
  2. Create a 5 1G partitions to play with.
  3. Create a Physical Volume for each of your partitions
  4. 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)
  5. Create a 3G logical volume, Format it (ext3 is good), Mount it somewhere
  6. Put some files in it
  7. Add the rest of your 1G Physical Volumes to the Volume Group
  8. Create another 1G Logical Volume
  9. 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.

Later.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s