Subject:
                  LVM and PQMagic - READ THIS!
          Date:
                  Fri, 15 Sep 2000 16:28:29 +0200
         From:
                  Eirik Overby <ltning@mo.himolde.no>
 Newsgroups:
                  ecs.support.misc




Hi folx!
After my message to the list about LVM, Fdisk etc. earlier, where I
stated that using PQMagic AND LVM on the same computer works perfectly
fine, I was asked by Kim to write a more thorough document on this. The
following text is the first draft. I'd like some input..... (I also sent
this mail to the egroups list)

-Eirik


----------------------------------------------------------

--- Logical Volume Manager (LVM, IBM)
--- Partition Magic (PQMagic, PowerQuest)
--- FDISK (OS/2, MS-DOS, PC-DOS, OpenDOS, Linux)


Recently there has been a lot of discussions in different fora,
especially the eComStation mailing list (previously at egroups, now a
newsgroup at news.ecomstation.nl) about the concequences of using LVM,
PQMagic and FDISK on the same hard drives and partitions.
The conclusions of most of these discussions have been that using
utilities like PQMagic or FDISK (in particular the OS/2 version) on
harddrives on which LVM has been used would be dangerous and possibly
fatal for the content of, in particular, HPFS and JFS partitions and
volumes.

In this document I want to tell you why this conclusion is wrong, and
how you can successfully combine using LVM, PQMagic, and any  flavour of
FDISK you might desire.


--- Some LVM theory

LVM is a very powerful disk/partition managing tool. It lets you do many
things that good old FDISK never could do, and that gives OS/2 users a
smell of the UNIX-world-of-no-driveletters.
For example, LVM lets you mount any existing partition on your drive to
any (free) driveletter. It lets you create volumes consisting of several
partitions, for example to link serveral hard drives to seem as one
large drive. It lets you shuffle around driveletter as you wish. It lets
you name partitions, drives and volumes for easy recognition.
The key issue in this discussion is the fact that any existing partition
on your drives can be assigned as a volume and thus given a driveletter.
Many people seem to think that if a partition on your drive doesn't show
up in LVM on the first run, their data is lost forever, or at least not
accessible from OS/2.
This is wrong.
People who use PQMagic or some other tool to partition their drives
after OS/2 (with LVM) has been installed, often experience that some or
all of the volumes they had defined in LVM disappear when doing this,
and thus they think their OS/2 partitions (be it JFS or HPFS) are lost
forever.
Also wrong. Even volumes consisting of several partitions on several
drives aren't usually lost even though they don't show up in OS/2 and
LVM.

So .. What REALLY happens when volumes seem to disappear?
The answer is simple: The "standard" layout of a partition table doesn't
allow for very much "extra" information to be stored about each
partition, so LVM has to use some kind of "hack" to keep track of its
partitions and volumes.
What happens when you use FDISK, PQMagic or any other disk partitioning
program, is that you might "confuse" LVM; it might lose track of the
partitions that form its volumes. This can be a serious problem
of course, but it's not fatal if you know how to handle it. Once you do,
you should be able to utilize any function you might find in any disk
partitioning program (as long as you don't delete your partitions that
is (oh btw, even then you might be able to get out of it - I'll get to
that later) ), without risking your data.

As an example, I just moved all my partitions from an old 9gig drive to
a 18gig drive, including OS/2's boot partitions, one JFS partition, and
half of a LVM volume that spanned two drives. After running LVM and
reinstating all the volumes I had, everything is working perfectly. And
it's not even difficult, you just have to know what you're doing at all
steps in the process.


--- Basic rule of thumb:

If a volume disappears from LVM after using PQMagic or FDISK, all you
have to do is to recreate the volume using the same partitions that
previously formed the volume, in the same order.


--- Important things to remember:

How the volumes were created in the first place.
Remember wether you chose to "Create a volume that does not need to be
bootable" or to "Create a volume that can be made bootable". In case of
having selected "Create a volume that does not need to be bootable",
it's even more important to remember if it used to be a compatiblity
volume or a LVM volume. (As a helper here, any bootable partitions and
any FAT/NTFS/Ext2 etc. partitions will usually be compatiblity volumes,
or they wouldn't be accessible from other operating systems).
When recreating a volume consisting of several partitions, make sure you
add the partitions in the same order as you did the first time. And make
sure you don't forget any "parts" of the puzzle, this will render the
partition unuseable and your data lost.


--- Troubleshooting:

--If LVM complains that the partition table on a drive is corrupt,
simply go to physical view and change the name of a drive. This will
probably be the only operation it lets you do. Then exit LVM, and start
it again. In 90% of the cases, this will have fixed the problem. If not,
go on and try to change the names of the partitions on the drive, if
possible. (Still in physical mode).

--You will not be able to create a bootable partition on anything but
the first harddrive unless you have Boot Manager installed. If, however,
Boot Manager is installed and you still can't create bootable partitions
on other drives than the first (or make logical partitions bootable),
removing and re-installing Partition Magic will probably help (and
perhaps also the above mentioned problem can be solved in this way).


--- Notes about Boot Manager:

When I talk about Boot Manager, I mean IBM Boot Manager, not any other
boot manager application (PQBoot, SystemCommander etc.). The reason that
the IBM Boot Manager should ALWAYS be installed, wether you plan to use
it or not, is that LVM needs to 'know' that it has a 100% sure way of
being able to boot off a given partition. This can be done in two ways:
Either it's a primary partition on the first hard drive, in that case
all OS/2 has to do is to set its own partition active and it will boot.
Or, it can rely on a boot manager to handle it, but since it only knows
its own boot manager, that one has to be installed. There is no way for
LVM to know that SystemCommander or PQBoot or whatever is installed.


--- More troubleshooting:

--Problem:
When trying to access a volume after "restoring" it with LVM, it fails
or shows an empty partition.

--Possible causes:
-The partition table has become corrupted and OS/2 cannot determine what
filesystem is on the volume.
-You used the wrong partition when recreating the volume, and/or a
filesystem driver for the filesystem on the partition has not been
loaded.

--What to do:
-In case OS/2 cannot determine the filesystem type, there are still
several ways to fix this. If it is a HPFS partition, the GTDISK utility
from Gammatech Utilities lets you "Fixup a HPFS partition". What this
does is basically to re-set the partition type information in the
partition table, so that OS/2 recognizes it as HPFS. I cannot remember
at the moment, but I think the same utility can do this also for FAT
partitions (NOT FAT32!!!).  Alternatively, you can use DiskEdit from
Norton Utilities for DOS (at least up to version 8.0) to manually edit
the partition table and set the partition type for the given partition.
A third way is to use a Linux program called CFDISK to set the partition
type. (Download a bootdisk and rootdisk from for example the Slackware
distribution, this should help you. As bootdisk choose bare.i or scsi.s
(IDE or SCSI system), rootdisk color.gz)

-If you choose the wrong partition, DO NOT DELETE THE VOLUME! Deleting a
volume also deletes the partition(s) it uses! So what you might have to
do is to select to hide the volume from OS/2 (in LVM), and create a new
volume using the correct partition. You can then later assign another
driveletter to the hidden volume if you choose to install a filesystem
driver for it.

-If you are 100% sure you mounted the right partition, and that it does
indeed show signs of having a filesystem on it that OS/2 can read, run
CHKDSK on the volume. This might get rid of the last possible problems.
You should run CHKDSK /F on all partitions anyway, to make sure no
inconsistencies exist.

--Problem:
You deleted the wrong partition with PQMagic or FDISK, or you deleted a
volume after realizing you had used the wrong partition.

--Possible causes:
You simply lost track of your partitions, or didn't read this document
through before starting ;-)

--What to do:
A deleted partition isn't necessarily the end of things. All the data is
still there, it's just that the operating system doesn't know the start
and end of it, so to speak. All you have to do is to recreate the
partition, EXACTLY as big as it was and in EXACTLY the same place on the
disk. If the partition occupied the whole disk or was between two other
partitions, this shouldn't be a problem as long as you use the same
program to recreate it as you did to delete it (rebooting in the
meantime doesn't do any harm, but doesn't help either).
Now the important thing, especially if you use PQMagic, is that you DO
NOT CREATE A FILESYSTEM ON THE NEW PARTITION! The thing is, if you
create a partition with PQMagic and tell it to use a particular
filesystem on it, that is basically the same as formatting the
partition. It overwrites the areas of the disk where the filesystem was
with a new, empty filesystem. If this happens, there is NO WAY to
recover your data (unless you go to a professional company, which will
cost you $$$$$).  So: Select "Unformatted" when PQMagic asks what
filesystem to put on the new partition!
After creating the partition again, use LVM to create a volume using it,
and it should be fine. In case you don't see any files on the partition,
run CHKDSK; this will look for filesystem structures and restore the
files on your disk.



Input and comments on this document (which is still under construction)
to be sent to:
Eirik Overby
eMail: ltning@anduin.net
IRC (efnet, webbnet): Ltning

