Home > FLOSS > Linux LVM for Home PCs

Linux LVM for Home PCs

I’ve been using GNU/Linux as my main OS at home and work for close to six years now and I’m still regularly surprised by all the cool stuff it can do. One of the distinctive characteristics of Linux’s decentralized developer community is that great features can be easy to overlook, getting better over time with little fanfare. Discovering these quiet gems is a treat and serves as a reminder of just how much awesome free software is out there.

IBM 2415 tape drives. My old server's storage was not too far removed from this. Photo by Dick107, Wikimedia Commons.

A case in point that recently caught my attention is Linux’s Logical Volume Manager (LVM). Now, I’ve been aware of LVM’s existence as an alternative to “plain old” hard disk partitions for some time, but not being a sysadmin, I’d always assumed it was only relevant for large servers with beefy RAIDs or SANs standing behind them. I didn’t pay it much attention. That changed earlier this summer when I decided it was time to replace my creaky home file server with something built-in the 21st century. I went looking for an inexpensive box that could handle all of the following:

  • Store and playback my video and music libraries through home theater gear or over the LAN
  • Backup other PCs over the network
  • Off-site backups and storage trading
  • General file sharing for my wife and me

I chose System76’s Meerat Ion Nettop upgraded to a 2 TB hard disk. I installed Kubuntu 11.04 (desktop, not server), along with XBMC for media, BackupPC for automated LAN backups, and Wuala for off-site backups. Within a weekend, I was in business with a big, beautiful KDE Plasma desktop lighting up my living room.

There were clouds on the horizon, however. It turns out 2 TB of storage is not quite the endless sea it seems once you factor in the demands of a respectable video/music collection, consolidated backups of other PCs on the LAN, and traded local storage space to keep off-site backups economical. To make matters worse, although I had the foresight to create a separate partition for all this data so I could easily reinstall the OS at will, I ended up making the OS partition much larger than it needed to be, resulting in a lot of wasted space. And finally, since I wanted an up-to-date desktop and applications, I opted for the latest release of Kubuntu over the more conservative LTS version, but I worried that major upgrades to the distro could jeopardize the stability of my server.

Enter the Logical Volume Manager. LVM has a lot of interesting features, but the most important ones for my home server use case are pretty clear and compelling.

Resizable “Partitions”

LVM works by enabling you to create a pool of storage called a Volume Group that can span conventional partitions and hard disks, and then dynamically allocate and reallocate portions of that pool to any number of Logical Volumes. Logical Volumes are similar to partitions in that they contain a file system and can be mounted in the OS, but they are abstracted from the hardware in such a way that they can be moved and resized at will. This solves my problem of having allocated too much space to the OS quite nicely. Using logical volumes instead of partitions, I can easily shift free space from the OS to the data file system or start them both out small and grow them as needed.

There are tools out there like GNU Parted, which solve this problem without LVM. But tragedies too painful to recount from my Windows days have left me with a general aversion to anything that messes with the hard drive’s partition table. Even the makers of GParted Live, a bootable GUI for Parted, acknowledge that resizing partitions is a risky business, as evidenced by the scary warning label on their home page. I feel more comfortable with support baked into the OS.

Bottomless Storage

Another benefit of logical volumes is that they can grow beyond the capacity of a physical device. If I need to grow my data volume by two more terabytes, I need only buy another hard drive, add it to the volume group, and resize my volume to overflow into it. This feature is similar to RAID, but it is more flexible because hard disks of differing capacities can be added to a volume group. Conventional RAID requires all disks to be the same size unless you’re willing to sacrifice capacity on the larger drives. It is possible to run LVM on top of RAID for more resiliency when a drive fails, but I don’t require constant uptime from my home server, so expanding capacity over a chain of non-redundant hard disks suits me just fine.


Shrinking and stretching volumes is great, but what really sold me on LVM was its support for snapshots. A snapshot, as the name implies, is an instant backup of a logical volume at a point in time, which you can quickly restore or discard with no fuss. The LVM HOWTO touts it as an effective way to freeze the file system on an active server so that it can be backed up through conventional means without disrupting service. For my home server, though, I see it as a way to try out a major OS upgrade or configuration change without risk. If something goes south, turning back the clock to a time when things were running smoothly is simple and quick. The amount of extra disk space required depends solely on how much change occurs after the snapshot is taken.

I’ve been using similar functionality on virtual machines for years and wished for something similar I could use on the host OS. I looked with silent envy at similar features in OS X,  Windows, and Solaris, not realizing that Linux had an answer the whole time. Gone are the days of rummaging for a spare hard drive, booting up a CD to run partimage or CloneZilla, and kissing the next several hours goodbye as it meticulously cloned every byte of my main hard drive.


Now that my eyes have been opened to the things LVM can do for a small system, I see uses for it everywhere. At work, I’m going to try using snapshots to revert changes to my development database instead of rebuilding it from scratch (a lengthy process I’m forced to repeat several times a day). Similarly, I’ve avoided upgrading certain packages on my work PC because of a hodgepodge of openSUSE repositories I’ve added over the last year. Now I can forge ahead without fear of losing a day to video driver idiosyncrasies. On my home laptop, I can test-drive a new release of KDE before committing to it.

LVM is a good example of Linux’s many understated features and it’s not just for the enterprise. You probably won’t see it mentioned in your favorite distro’s next release announcement, but it’s worth getting to know it if you spend a lot of time working hard or hardly working on a Linux system.

  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: