Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Getting started with RHEL4's built-in LVM tools

You can impress your Unix admin friends while making your life easier using RHEL4's built-in Logical Volume Management tools.

Many Unix administrators I know (you know who you are), always used to smirk when I talked about Linux. They could always point to the fact that regardless of whatever I could say, they had journaling file systems, which they could manage using various Logical Volume Management (LVM) tools, and I couldn't touch that.

Well, not any more! Not only does Red Hat offer ext3 as their default file system, but they offer great management tools to boot. As we know, ext2 had a great lifespan, but it was not an enterprise-ready file system that could handle large disk partitions, fast recovery from systems crashes, or large amounts of files. Journaling file systems give you the ability to recover almost instantly from a crash, as you do not need to run fsck after a restart. Similar to how databases recover from crashes, a journaling file system tracks changes to file system metadata and pretty much guarantees that either all or no updates have completed. Of course, these file systems also need elaborate tools to help better configure and manage them accordingly.

When I first installed RHEL V.4, I made the mistake of using the ext2 file system, as my windows partitioning software did not seem to give me the option of ext3. Later on, I would find that it really did, I just missed it. Being that I really wanted to evaluate LVM2 on ext3, I'd have to make amends. So, I put my install CD back in and was going to reinstall Red Hat from scratch, when the install noted that I had a prior version of Red Hat. It gave me the option to migrate instead, which is what I chose to do. It also came up with the message that said "This release supports the ext3 journaled f/s. Migration to the new version with data loss?"

Because I had already created another partition on the system, I picked "yes," and it worked beautifully. The migration to ext3 from my existing ext2 partition also worked perfectly. After the upgrade was finished, I booted up, and verified that all the data was still in place -- and it was. The file system successfully migrated to ext3 from ext2.

After I logged in, I tried using the command-line tools available with LVM2. When LVM is started without arguments, it presents a readline prompt interface, where commands can then be entered in interactively. I really liked this environment, as well as the command line history that it offered, but I kept getting errors related to the fact that the physical volumes were not yet set up accordingly.

Quite frankly, I wasn't certain what I needed to do in order to start my work with LVM2, other than perhaps an entire reinstall of the operating system, along with another Disk Druid partitioning. As a last resort, I ran a "find" on the system for any mention of LVM (<< find ./ -name '*lvm* -print >>), in a desperate attempt to help me locate something -- anything. Boy, was I pleasantly surprised! I found something called "system-config-lvm (version 0.9.18)."

I have to say that it is an absolutely wonderful interface, which I can't wait to show my Unix brethren. It even knocks the socks off anything AIX has to offer with respect to volume group, physical volume, or logical volume configuration, from a systems interface/graphical perspective. Using only system-config-lvm, one has a graphical representation of your volume groups, as well as your physical and logical volumes.

Red Hat screenshot 1

The first thing you must do is initialize a partition. One must be careful, as this will erase your data. When that is done, it becomes classified as an unallocated physical volume. At that point, you can create a volume group, add to an existing volume group, or to remove a volume from LVM.

I chose to create a new volume group (VG), called "apvg," with a physical extent size of 16 mg. Apvg would be created on hda6 (the 6th partition on that device) and the logical view showed that it was unused. I proceeded to create a logical volume and within this same screen, you could choose to also create a filesystem and mount-point, which is what I did. I was very impressed.

One thing I found puzzling was when tried to extend the logical volume (there was a button bar on the screen as an option), a message came up that stated that the capability was not yet implemented in this version. Why even put something up there that doesn't work, I don't know.

Anyhow, I also ran some of the command line utilities, such as lvdisplay and vgdisplay.

[root@redken ~]# lvdisplay
 --- Logical volume ---
 LV Name        /dev/apvg/oracle1lv
 VG Name        apvg
 LV UUID        mXTryN-U6oY-5mlT-BC48-mBnT-uE6g-fdAT95
 LV Write Access    read/write
 LV Status       available
 # open         1
 LV Size        512.00 MB
 Current LE       32
 Segments        1
 Allocation       inherit
 Read ahead sectors   0
 Block device      253:1

[root@redken ~]# vgdisplay
 --- Volume group ---
 VG Name        apvg
 System ID
 Format        lvm2
 Metadata Areas    1
 Metadata Sequence No 2
 VG Access       read/write
 VG Status       resizable
 MAX LV        256
 Cur LV        1
 Open LV        1
 Max PV        256
 Cur PV        1
 Act PV        1
 VG Size        1.02 GB
 PE Size        16.00 MB
 Total PE       65
 Alloc PE / Size    32 / 512.00 MB
 Free PE / Size    33 / 528.00 MB
 VG UUID        yFQWG1-yQlR-Qsyu-qBGf-2INf-fL07-XL5Mx1

Both of these utilities gave me specific useful information about the logical volumes and volume groups. I even created a logical volume from the command line, just to see if this worked. It worked fine, thought it gave me some cdrom errors (I'm not certain why it would even go there...).

#lvcreate -L 100 apvg
 /dev/cdrom: open failed: Read-only file system
 Rounding up size to full physical extent 112.00 MB
 Logical volume "lvol0" created

If one creates a logical volume in this fashion, one must also create the underlying file systems, mount points and also manually mount the file system. You can manage your volume groups and physical volumes from the command line as well. I will say that while it is always important to understand what is going on behind the covers, I would stay with system-config-lvm. It is an absolutely wonderfully utility that should stop the smirk from any Unix administrator in less time then it takes to create a file system.

With respect to LVM2 and ext3, my only complaint thus far is that Red Hat needs to do a better job letting people know about the information and utilities that it has to offer to get the job done. Here is one link I found that offers some information on LVM2. Other than that, I was very impressed.

LVM2 is one of the significant architectural improvements in RHEL v.4 and I was very impressed with the both the configurability and manageability of the product. I really look forward to installing Oracle on my Oracle partitions and doing some benchmarks on how it performs on RHEL V.4 with ext3 and LVM2.

For more information:

Dig Deeper on Linux servers

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.