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.

Figure 1: Selecting LVM in the Mandrake installer

Figure 1: Selecting LVM in the SuSE installer
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.
email: george@georgetoft.com
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- RSS Feeds
- Trying to Tame the Tablet
- New Products
- What's the tweeting protocol?
- Validate an E-Mail Address with PHP, the Right Way
- Drupal is an Awesome CMS and a Crappy development framework
2 hours 14 min ago - IT industry leaders
4 hours 36 min ago - Reply to comment | Linux Journal
21 hours 24 min ago - Reply to comment | Linux Journal
23 hours 57 min ago - Reply to comment | Linux Journal
1 day 1 hour ago - great post
1 day 1 hour ago - Google Docs
1 day 2 hours ago - Reply to comment | Linux Journal
1 day 7 hours ago - Reply to comment | Linux Journal
1 day 7 hours ago - Web Hosting IQ
1 day 9 hours ago



Comments
Re: Using Logical Volume Management
One of the greatest features of LVM is the possibility to create "Snapshot-Devices", that make it possible to take backups without interrupting Read/Write-Access to the "Original-Devices".
Great stuff !
Re: Using Logical Volume Management
Just don't forget that while you may take an instant snapshot of the filesystem, the data may not be logically consistent... that is, a database application may have written its "debit" update, you do the snapshot, and the the database writes its "credit" update. Always be aware of the application... a quiesced system is the safest!