HP-UX LVM Maint. Mode

What exactly happens when you boot HP-UX with the -lm flag?

We tried this the other night, with some wacky results...
We poked around, and found that / was mounted to /dev/rroot (I think... maybe it was just /dev/root). So, (still playing) we activated the volume group (lvchange -ay), and created a directory /oldroot. We mounted /dev/vg00/lvol3 to /oldroot (after running fsck), then changed directory to /oldroot. There, to our disbelief, was a new directory (mixed in with the others) called "/oldroot". That's a wierd thing to see... But THAT oldroot was empty, so it wasn't totally recursive.

We unmounted everything and rebooted... Upon coming back up, the machine rebooted again automatically (a guess is that we forgot to deactive the volume group first, so it fixed out mistake and rebooted), then hung for about 20 minutes upon reaching the cleaning of editor crash files. It bounced back and forth from "busy" to "wait"...

So how did that happen? Is /dev/rroot just the raw device attached to the / filesystem? If so, how could it be mounted? And how could it be mounted twice?

I think my head is about to implode, so I had better stop typing...

Maintenance mode is intended only to enable you to rebuild the LVM data in the LIF area of boot disk after it has been damaged. It ignores the LVM data (which is in the LIF file "LABEL" ). There are two cases. Either the area after the boot area is the root filesystem or it is the /stand filesystem. In either case it must be contiguous and it must be an hfs filesystem so the boot program hpux can find the kernel. In maintenance mode, it is assumed to start after the boot area and consume the rest of the disk. But if it is /stand, a file called /stand/rootconf is read (by the kernel) and this is used to find the start of the root filesystem which is also assumed to extend to the end of the disk. This leaves them overlapping each other as well as any other logical volumes.

The result is that the kernel is running and root is mounted with nothing else. At this point you are supposed to rebuild the LVM info in the boot area. This typically involves using mkboot, vgcfgrestore, and lvlnboot. It is crucial that the disk not be synced at all. Either "reboot -n" or cycle power to exit maintenance mode.

Activating the root volume group is explicitly prohibited...doing so may corrupt it.

The kernel knew that oldroot on /dev/root was a mount point but it didn't know that oldroot on /dev/vg00/lvol3 was a mount point. That why you saw a difference.

Was /oldroot pre-existing? Even a "mkdir /oldroot" is very risky in maintenance mode. HP-UX syncs some metadata right away. That might be enough to garble the static data in your root filesystem's superblock, but I'm not sure.

Wow, I guess we got lucky then, huh?

/oldroot was not pre-existing... It was created to mount lvol3...
We did not remove it, and it was still there on reboot, so the disk did sync at some point. And we rebooted with reboot -qn.

I know it was risky, and perhaps (in hindsight, of course) a little sloppy, but that's what this particular box is for here - a learning tool and a training machine.

(Note to self: ask these questions before doing the action next time... :stuck_out_tongue: )