VOICE Home Page: http://www.os2voice.org | February 2005 Newsletter Index < Previous Page | Next Page > Feature Index editor@os2voice.org

## Troubleshooting LVM Problems

By Walter Metcalf © February 2005

This brief article provides some practical help when your eCS-OS/2 system develops problems with the LVM-managed drives. I do not define all the various bits and bytes that actually make up the system--I do not feel qualified to do so--nor would such an article accomplish my purpose here.

### What is LVM?

1. LVM is an acronym for Logical Volume Manager, an advanced disk subsystem originally designed for IBM's UNIX mainframes (AIX). It consists of the following three components:

   1. A set of system modules that replace many of the previous disk and file handling programs.

   2. A few utilities to maintain and set up the partitions and volumes.

   3. A modified set of physical disk drives that are accessed by volume instead of by partition. (I'll say more about volumes later.)

      Note: During the installation of eComStation, WSeB, or Convenience Pack for OS/2 Warp version 4, the installer checks all partitions to make sure they are LVM volumes. If any are found that are not, a special utility (VCU) is run to convert them to (hidden) compatibility volumes. No data is lost in doing this, but FDISK will no longer be able to run on those partitions.¹ (I am occasionally using the term LVM drive to refer to a physical drive which has been configured for one of the above operating systems. An LVM drive is not the same as an LVM volume.)

2. It is time to define the term volume more precisely. A volume is the basic unit of an LVM disk system in which all files and directories are stored. There are two kinds of volumes:

   1. Compatible volumes may contain only a single partition and can only be formatted as FAT or HPFS. At the present time, all boot drives must be compatible drives. (Developers are working on removing this restriction.)

   2. LVM volumes can be formatted using any file system -- FAT, HPFS, or JFS.

      1. If an LVM volume is formatted using the Journaled File System (JFS), it may be expanded to include multiple partitions. These partitions may reside on the same drive or they may reside on several physical drives, but they must be formatted as JFS.

      2. LVM volumes contain all the partition information defined by FDISK plus another set of information relating to volumes and hard drives. See the following screen shots as examples.

         (Full size image)

         (Full size image)

      3. Note that Volume H is made up of 4 partitions, and that information is provided about both the volumes and partitions.

3. Some advantages of LVM and JFS volumes.

   1. It's important to note that when running under LVM, drive letters are attached to volumes, not partitions, as under other systems (e.g. Windows™ and OS/2 without Fixpak 16).

   2. LVM volumes support both volume and file lengths as long as 4 terabytes.

   3. LVM volumes may contain partitions which are not themselves accessible by eCS-OS/2, such as FAT volumes created by Windows.

   4. Recovery time for JFS volumes after a system crash is only a fraction of the time required by other filesystems.

   5. Maximum cache size for JFS volumes is much bigger than the 2 MiB allowed for HPFS volumes.

   6. Finally, in an LVM system drive letters are sticky, and are not dependent on the order of the partitions or hard drives. The letter is assigned by the user when the volume is defined, and does not change until it is redefined by the user. (See the screen shots above.)

### Maintaining and Troubleshooting LVM/JFS volumes

1. Maintenance of LVM/JFS volumes

   1. DEFRAGFS

      JFS structures data so that the files and data are even less susceptible to degradation resulting from fragmentation than HPFS drives. However all drives should be "defragged" once in a while. The Defragfs command is provided to perform this task with JFS drives. The format of the defragfs command is:

          DEFRAGFS [/Q] Drive

      `/Q`
        specifies query only. The disk is not changed.
      `Drive`
        is the target drive, including the colon.

        Note: Drive must be Unmounted to use this command.

   2. EXTENDFS

      This command allows you to expand a JFS filesystem by filling the partition in which it resides, instead of expanding the LVM volume. The syntax of this command is given below:

          EXTENDFS /LS:<size_in_megs> drive

      `LS`
        is the new size of the journalling log. This parameter is optional.
      `Drive`
        is the drive on which the operation is to be performed.

2. Troubleshooting LVM/FS volumes

   1. If your problem consist of simply recovering a file that has been accidentally deleted, or not accessing a JFS volume (e.g. CHKDSK hangs), your best bet is to run the program jrescuer or jrescuerJune, available on Hobbes or on ecomstation.ru.

      1. I have successfully used jrescuer once in the past. As with any undelete program, the sooner you run the program after the deletion took place, the more likely you are to be successful. Writes to the drive in question also greatly reduce the chances of successful recovery.

      2. Jrescuer is especially helpful if, due to an error, you are unable to mount the drive.

      3. Both jrescuer and jrescuerJune are shareware. However, If you have paid the registration fee for jrescuer, you can get jrescuerJune at no extra cost.

   2. If the system is not behaving correctly on a particular volume, but there are no error messages, you should run CHKDSK with the "/F" parameter. For JFS, the CHKDSK calls a separate program to check JFS thoroughly and in a manner unique to JFS. For this to work properly, make sure the problem drive is not "mounted" (i.e., not in use).

   3. "The partition table may be corrupt" problem.

      1. I seem to run into this problem quite often. Hopefully my experience can help you if and when you encounter it.

         You know you have this problem when the message, "The partition table on Drive x may be corrupt", is displayed when starting any of the eCS utilities that set the LVM information.² That message may not be technically correct. The term "partition table" in that message seems to refer to both the traditional partition table and the LVM information, which is not stored in the actual partition table. LVM disk systems store the information related to LVM volumes in the "reserved block" of the filesystem.³ If that information is corrupt, it causes the same error message as an actual partition table problem.

      2. The first thing to do is to start LVM.EXE and ignore any error messages. Without making any changes, press <F3> and select "Save to disk and exit." This activates a procedure in LVM that corrects some errors in the LVM information.

      3. If that does not work, you must determine which of the two situations described in paragraph B.3.a in this section (i.e., bad partition table or bad LVM information) is causing the error message. The best way I have found to do so consists of the following steps.

         1. See if your files can be read (do not write!) by regular programs. FileStar and CSSDIR make especially good candidates for doing this because they offer more information than the straight system programs, but normally are read-only utilities.

         2. Start DFSee for that drive, and see if any errors (not warnings) are reported for that drive. (In my opinion no serious eCS-OS/2 user should be without this product. It's also important to keep it current, since new features are being added all the time.)

         3. If no errors are reported by DFSee and the other utilities you have tried can still read the disk drive, it is probable that only the LVM data is corrupt.

      4. You may rectify this problem yourself with DFSee by selecting the "FDISK" and "Add the Default LVM info" item. Then select the physical drive with which you are having trouble. See the screenshots below.

         (Full size image)

         1. Start either LVM or LVMGUI. If you still get the error message, more drastic steps are needed. If DFSee fixed the problem, you see your partitions, but no volumes are defined. Now you need to redefine the volumes. Simply repeatedly run "Create Volume" attaching each new volume to the partition(s) to which they were previously attached. Pay special attention to any expanded volumes you had before.

         2. If DFSee or one of your test utilities reports an error, or if you can't find your partitions, you may truly have a corrupted partition. If you are sufficiently experienced with OS/2 and with DFSee, you may repair the partition table using DFSee using the Edit | Partition Table function that edits the partition table directly. However this is risky and should only be attempted if you are thoroughly familiar with (extended) partition tables. See the screen shots below.

         3. Editing the LVM information:

            (Full size image)

            (Full size image)

         4. Editing the Partition Table:

            (Full size image)

            (Full size image)

      5. If you feel your problem is beyond the simple measures I have covered here or beyond your level of experience with eCS-OS/2 and you have a licensed copy of DFSee, the best thing to do is to email Jan van Wijk, the author of DFSee, describe your situation, and ask for help. He provides excellent technical support. I once "lost" an entire physical hard drive, and Jan restored the entire drive, so that I did not lose a single file!

For those who enjoy such things, I have included an addendum that gives additional details regarding the LVM/JFS file systems. The material in the addendum was taken from the book Inside the OS/2 Warp Server for e-business.

I hope this article helps give you control over your computing.

Notes:

¹There are reports that older OS/2 Warp systems (pre-FixPak 16) can be upgraded to support LVM by simply copying these files into the appropriate locations on the system drive. (For more information on updating Warp systems, check out Zsolt Kádár's web site.) I do not recommend doing so unless you really know what you are doing, and have a good backup of your system. Remember that the FDISK program is rendered non-functional, and that all physical drives in your system will be affected.

²These utilities include LVM, LVMGUI, and the eCS program MiniLVM.

³See the Addendum, and the table "Diagram of JFS Physical Organization".

References: Addendum to this article: addendum.htm JRescuer: http://hobbes.nmsu.edu/pub/os2/util/disk/jrescuer.zip June: http://ecomstation.ru/download/jrescuerJune.zip ecomstation.ru: http://www.ecomstation.ru FileStar: http://www.filestar.com CSSDIR: http://www.curtisSystemsSoftware.com DFSee: http://www.dfsee.com Documentation for DFSee by Jan van Wijk (Complete documentation is available with the product): http://www.dfsee.com/dfsee/howto.htm "Inside OS/2 Warp Server for e-business" by International Business Machines: http://www.redbooks.ibm.com/abstracts/sg245393.html?Open "JFS recovering methodology" by Pavel Shtemenko: http://en.ecomstation.ru/showarticle.php?id=91 "Time for JFS has come, Part 1" by Pavel Shtemenko: http://en.ecomstation.ru/showarticle.php?id=94 "Update your OS/2 installation CD-ROM with fixpaks!" by Zsolt Kádár: http://xenia.sote.hu/%7Ekadzsol/rexx/sajat/updcd.htm

Feature Index
editor@os2voice.org
< Previous Page | Newsletter Index | Next Page >
VOICE Home Page: http://www.os2voice.org