Using Logical Volume Management
Logical Volume Management (LVM) is an abstraction layer over the hard drives, which allows the Linux kernel to access the filesystems normally, yet each filesystem may be comprised of multiple hard drives. The main benefit you may see with LVM is when you run out of space in a filesystem (/home, for example), you can either resize the filesystems on the fly, or add another hard drive and spread /home across the two drives. If you are running short on two filesystems, the new drive can be used to augment both filesystems.
Notice how I have avoided the use of the word “partition”? Partitions do not exist under LVM. Under most Linux systems, a partition is used to create a filesystem (formatted with ext2, ext3, or reiserfs), then the filesystem is mounted to a mount point. LVM can use your partitions, and combine them together in one large storage pool (called a volume group). From that volume group (VG), you create logical volumes (LV), which is like a partition, from which you create the filesystems. Page 3 of the LVM Whitepaper (PDF) describes this concept in detail.
Last December, I set up my Linux workstation. Since I didn't really know how I would use the machine over the next few months, I decided to install LVM - I was trained in IBM AIX LVM, so I knew what it could do. I also chose to create my filesystems using ReiserFS, which turned out to be a huge benefit. Four months later, I filled the /home filesystem. Traditionally, I would have been forced to move stuff around, and make a bunch of symlinks to use the space on another file system, or repartition, reformat and reload my data. In this case, /home was 100% full, but my /share and /tmp filesystems had several gigabytes of unused space on them. The LVM HOWTO descibes a classic scenario like this one that illustrates exactly why LVM is an excellent tool.
Obviously, the solution was to resize the LV's. However, I had an old unused 4GB hard drive (more on this later) that I wanted to add to the mix. I installed the new hard drive, set its partition type to LVM (the whitepaper says this is not necessary for LVM, but old habits die hard, and I did this before reading the whitepaper), and added it to the VG. When that was done, I resized the LV's to use the 4GB drive and to take some space from /share and /tmp, and I gave it to /home.
This all sounds so simple, but of course, it was not. My first snag was in trying to resize the reiserfs on /home. Since I am using SuSE 7.3, I used YaST2. It showed me that my filesystem was resized, yet df showed me the truth - my filesystem was still the same size. Undaunted, I tried several more times. I fired up YaST1, and it resized the ReiserFS with no problems.
The second snag is the old 4GB drive itself. My other drives were 7200 RPM Fast IDE drives. The 4GB drive was a 5400 RPM [slow] IDE drive. Because LVM blended it in so well to the VG, I now suffered a data throughput performance hit. Before I used the 4GB drive, I could move data from filesystem to filesystem with a sustained data transfer rate of about 8 - 10MB/sec. With the old drive in place, my sustained data transfer rate was 1 - 1.5MB/sec. It looks like you are limited to the speed of the slowest drive on the filesystem, which makes sense.
Since LVM is a kernel device driver, it works with all Linux distributions, however, only some distributions support LVM during installation. As of this writing, only Mandrake (see figure 1) and SuSE (see figure 2) support implementing LVM during Linux installation.
SuSE's YaST administration tool provides a GUI-based logical volume management interface. As mentioned earlier, I noticed YaST2 does not resize ReiserFS VG's properly. YaST1 works correctly.
This brings me back to the benefit of using ReiserFS that I mentioned earlier - the ability to resize the filesystem on the fly. The ext3 filesystem has the ability to be resized, however, that filesystem must be unmounted during resizing, and ReiserFS can be resized while it is mounted and in use.
Regardless of which Linux distribution you use, you may always use the command line to manage your LVM installation. The LVM whitepaper provides an excellent discussion on using these tools.
George Toft has been heavily involved in Linux system administration for five years. He enjoys helping newbies and is currently teaching Introduction to Unix/Linux at a local community college. He also maintains a web site devoted to Linux and Linux Security at www.georgetoft.com/linux.
- Ubuntu MATE, Not Just a Whim
- Canonical Ltd.'s Ubuntu Core
- Build Your Own Raspberry Pi Camera
- Nasdaq Selects Drupal 8
- Non-Linux FOSS: Screenshotting for Fun and Profit!
- Secure Desktops with Qubes: Compartmentalization
- The Peculiar Case of Email in the Cloud
- Netlist, Inc.'s HybriDIMM Storage Class Memory
- Back from the Dead: Simple Bash for complex DdoS
- Tech Tip: Really Simple HTTP Server with Python
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide