Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Common threads: Advanced filesystem implementor's guide, Part 13

More about EVMS

Daniel Robbins (drobbins@gentoo.org), Chief architect of Gentoo Linux, IBM
Residing in Albuquerque, New Mexico, Daniel Robbins is the Chief Architect of Gentoo Linux, an advanced ports-based Linux for x86, PowerPC, Sparc, and Sparc64 systems. He has also served as a contributing author for several books, including Samba Unleashed and SuSE Linux Unleashed. Daniel enjoys spending time with his wife, Mary, and his daughter, Hadassah. You can contact Daniel at drobbins@gentoo.org.

Summary:  In the Advanced filesystem implementor's guide, Daniel Robbins shows you how to use the latest filesystem technologies in Linux 2.4. In this conclusion to the AFIG series, Daniel continues his discussion of the Enterprise Volume Management System for Linux, or EVMS. He shows you how to use evmsn to take a new hard drive, partition it, and create LVM volumes on it. Along the way, he fills you in on important EVMS concepts that you'll find essential as you continue your exploration of this powerful technology.

Date:  01 Nov 2002
Level:  Introductory
Also available in:   Japanese

Activity:  4596 views
Comments:  

Welcome to the final installment of the Advanced filesystem implementor's guide! In this article, Daniel picks up where he left off in his EVMS introduction and guides you through the process of using evmsn, EVMS' ncurses-based administration tool. He shows you how to use evmsn to take a new hard drive, partition it, and create LVM volumes on it. Along the way, he fills you in on important EVMS concepts that you'll find essential as you continue your exploration of this powerful technology.

A new disk

The best way to start playing with EVMS is to find a spare hard drive and install it in your system. Then, you can create and delete partitions and volumes to your heart's content without putting any of your data at risk. Below, I've followed this approach by booting a Gentoo Linux Game CD (see Resources later in this article), which actually happens to include EVMS 1.0.1 support. I booted the CD using vmware (check Resources for link) and configured my virtual PC to have a single SCSI disk, sda. When greeted with the login: prompt, I logged in to the live Gentoo Linux CD-based system as root, hitting Enter at the password prompt. Then I typed evmsn to start the ncurses version of the EVMS administration interface. Of course, you can also simply plug a new hard drive into your existing EVMS-enabled system if you so choose. In addition, if you have X available, then you may want to consider using evmsgui, the GTK+-based EVMS administration interface. Although evmsn runs on the console using ncurses, and evmsgui uses a more modern GTK+-based interface, the interfaces of the two programs are very similar. Experience with one should be easily transferable to the other.

Now, let's get started with EVMS. Since I'm using the console, I type evmsn and the following screen appears:


Figure 1. The EVMS administration tool
The EVMS administration tool

On this screen, I can see /dev/evms/sda, the only volume on my system. If you're running EVMS on your own box, you'll almost certainly see at least two additional /dev/evms/???? entries listed. You can move between each device node by using the up and down arrow keys.

You're probably wondering what these /dev/evms/??? device nodes are. At first glance, it probably appears that they are simply copies of the respective device node in /dev; for example, /dev/evms/sda simply refers to the same disk as the more traditional /dev/sda device node. So, what's the point of creating duplicate device nodes in the /dev/evms/ directory? The answer is that one of EVMS' jobs is to create a unified namespace for all the volumes on your system, and it creates this namespace under /dev/evms. So, EVMS detected sda and recognized that it should be part of the EVMS namespace, so it created the appropriate device node in /dev/evms. Now would be a good time to mention that if you aren't using devfs, you may need to run the evms_devnode_fixup program to bring your /dev/evms namespace up-to-date.

Here's another subtle yet important factoid. While EVMS can see all the storage resources on your system, it may not create /dev/evms/ device node entries for all of the resources it finds. For example, my development system has two hard drives in it, /dev/hde and /dev/hdg. However, there are no corresponding /dev/evms/hde and /dev/evms/hdg device nodes. When I look in /dev/evms/, the only device node I see is one that represents the boot partition on my first hard disk -- /dev/evms/hde1. Now, why is there a /dev/evms/hde1 but no /dev/evms/hde? Well, it turns out that EVMS is quite smart and recognizes that hde and hdg aren't set up to be volumes in themselves; instead, EVMS can see that I've partitioned hde and hdg. It can also see that I've used these partitions to create LVM logical volumes. The space on my /dev/evms/hde2 partition is being used for a higher-level storage object, so EVMS doesn't create the "/dev/evms/hde2" device node. Instead, it recognizes the LVM volumes that I've created and creates device nodes for them under /dev/evms/lvm:


Listing 1. Device nodes under /dev/evms/lvm
		
$ ls /dev/evms/lvm/*/* -l
brw-rw-rw-    1 root     root     117,   2 Dec 31  1969 /dev/evms/lvm/mainvg/root
brw-rw-rw-    1 root     root     117,   3 Dec 31  1969 /dev/evms/lvm/raid0vg/swap
brw-rw-rw-    1 root     root     117,   4 Dec 31  1969 /dev/evms/lvm/raid0vg/tmplv

This demonstrates an important principle that EVMS follows: it will only create device nodes for the final (not intermediate) storage objects that it finds on your system. EVMS calls these final storage objects "logical volumes," whether they happen actually to be disks, partitions, or LVM logical volumes. As we'll see later, when we use the evmsn and evmsgui administration tools, we need to explicitly create an EVMS volume from a storage object before we can see a corresponding device node for it in /dev/evms/. Until we transform a storage object into a volume, EVMS will refrain from creating a device node for it, assuming that we do not intend to use it directly but instead plan to use it to create a higher-level storage object. By insisting that we create a volume before a /dev/evms device node is created, EVMS protects us from typing mke2fs /dev/evms/foo and creating a filesystem on a device node that we shouldn't be touching. Because of this behavior, we can have some assurance that every device node under /dev/evms/ holds or is intended to hold either a filesystem or swap space.

While this behavior is very sophisticated, helpful, and reduces clutter, it does take some getting used to. To drive this point home, here's a screenshot of evmsgui running on my development workstation. As you can see, only four of my storage resources have been configured as volumes, and they are all being used for filesystems or swap.


Figure 2. The evmsgui utility
The evmsgui utility

Now, back to my example vmware EVMS configuration. If you look at the first screenshot of this article, you'll notice that /dev/evms/sda is showing up as a volume even though the disk is empty. This is just another example of EVMS being cautious; while it couldn't detect any valid types of storage resources on our disk, it marked the entire disk as a volume so that we would have to delete the volume before we can start using the storage on the disk. This is a very good behavior, since the disk theoretically could contain some important data that EVMS simply can't recognize. By taking this approach, EVMS avoids the risky behavior of advertising the disk as being empty and thus possibly fooling an administrator into overwriting a raw FreeBSD volume, for example. Again, EVMS is sophisticated, but its behavior can be a bit confusing at first glance.

Of course, in my particular situation /dev/emvs/sda is empty, and I need to partition it. To do this, I need to destroy the /dev/evms/sda volume as follows. First, with /dev/evms/sda selected, I hit Enter:


Figure 3. Destroying the volume
Destroying the volume

As you can see, this brings up a sub-menu where I have the option of viewing details about the volume, removing the volume from the storage object, or destroying the volume. There's an important distinction between "destroy volume" and "remove volume from storage object;" if I choose the former, then my volume (as well as any sub-objects underneath it) will be broken down into their base components. However, if I choose to simply remove the volume, then the volume will be destroyed but sub-objects (if any) will remain intact. The difference between "remove" and "destroy" is analogous to peeling a layer off an onion versus throwing the entire thing into a food processor.

However, in this particular case, there is only one layer to my onion, so both options will do the same thing. I decide to choose "Destroy the volume;" after confirming my selection and hitting any key to return to the volumes listing, you now see the result of my action: "No logical volumes found."

This particular view suddenly became very boring, so I'll change it. Hitting "4" will pop up a sub-window allowing me to select a view. Right now, I'm in the "Logical volumes" view; now let's move over to "Available topmost storage objects." After making my selection, we can now see "sda" in our listing again! But unlike before, we're not looking at a volume, but a storage object. If you're following along and hit Enter on this storage object, you'll see that we could create several things from "sda", including an EVMS or compatibility volume.

However, we really don't want to do this -- if we were to create a volume from sda, we'd be back where we started when we first loaded evmsn, with a single volume that encompasses the entire disk. Instead, I want to create partitions and then convert the partitions to volumes. To do this, I hit "4" for (select view) and then select "Logical disks." Here I see "sda," the logical disk. And yes, there is an important distinction between "sda" the storage object and "sda" the logical disk. Addressing "sda" as a storage object, we can turn it into a volume or use it to build a higher-level storage object. But addressing "sda" as a disk allows me to split the disk up into partitions (called "segments" in EVMS-speak), which in turn can be used as storage objects. To do this, I hit Enter, popping up a menu that gives me the option of assigning a segment manager to the disk:


Figure 4. Assigning a segment manager
Assigning a segment manager

Now, if segments are the same things as partitions, you may be wondering what a segment manager is. Think of a segment manager as a "partitioning method" or scheme. Once we choose a segment manager, EVMS will put some metadata on our disk, creating a master boot record and marking the rest of the space on our disk as "freespace," available for new segments. To make this happen, I choose "DefaultSegMgr" from the menu on my screen, hit Enter again, and press space. Select "sda" as the object to receive a segment manager. Then, I hit Enter again, choose a disk type of "Linux" ("OS/2" is also available as an option), and hit Enter to continue. After pressing a key, I now hit "4" (select view) and select "Disk Segments" to see the new segments that I've created:


Figure 5. Creating new segments
Creating new segments

My disk now has a master boot record and I'm ready to create new partitions, called "segments" in EVMS-speak. As I create new segments, my "sda_freespace1" segment will shrink; if I create partitions out of all of the free space on my disk, the sda_freespace1 segment will completely disappear. It's also possible that a tiny remainder sda_freespace1 will continue to exist if the available storage on the hard drive does map cleanly to the partition sizes that I choose.

Now, to create those segments, I hit Enter when hovering over "sda_freespace1" and then select "Create a New Segment." Next, I select the DefaultSegMgr plugin, and accept the use of the sda_freespace1 object by hitting space, then Enter. Next, I'll create a small bootable partition at the beginning of the disk to hold my kernels. To do this, I'll hit space twice and then type "100" to set the partition size to 100 MB, then set "Bootable" to true by hitting space twice over the Bootable option. Finally, I'll hit Enter to create the new partition. By repeating these steps, I then create other partitions for my filesystems and swap. Some notes: if you need to create more than four partitions, remember to toggle the "Primary Partition" option after creating your boot volume. Also remember to set the "Partition Type" to "Linux Swap" when creating your swap partition.

The final step is to hit Enter over "sda1," "sda2," and "sda3." A menu appears showing an option that reads "Create Compatibility Volume from the Segment." When I select this option, my segment will be configured to house a full-fledged logical volume, meaning that it will now have a device node under /dev/evms/. In addition, because I chose to create a compatibility volume, the new volume will be usable even if I happen to reboot my system with a non-EVMS kernel. If I had chosen "Create EVMS Volume," then this wouldn't have been the case. Note that EVMS versions 1.1.0 and later allow you to convert compatibility volumes into EVMS volumes, and vice-versa.


Conclusion

So there you have it, I've partitioned a single system disk using EVMS. While not an earth-shattering accomplishment, such an experience will help to give you the EVMS foundation you need before attempting things like creating storage containers, LVM logical volumes, RAID volumes, snapshots, and other goodies. Of course, I didn't have room to cover these topics in this article, but I hope to be able to touch on some of these EVMS applications intermittently throughout the next year. But first, on to other things; it's time to bring the Advanced filesystem implementor's guide to a close. I hope you've enjoyed the ride :)


Resources

About the author

Residing in Albuquerque, New Mexico, Daniel Robbins is the Chief Architect of Gentoo Linux, an advanced ports-based Linux for x86, PowerPC, Sparc, and Sparc64 systems. He has also served as a contributing author for several books, including Samba Unleashed and SuSE Linux Unleashed. Daniel enjoys spending time with his wife, Mary, and his daughter, Hadassah. You can contact Daniel at drobbins@gentoo.org.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux, Open source
ArticleID=11264
ArticleTitle=Common threads: Advanced filesystem implementor's guide, Part 13
publish-date=11012002
author1-email=drobbins@gentoo.org
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers