How to mount HPUX 10.20 VxFS logical volumes in a modern linux environment

This is a problem that I’ve wanted to tackle for quite some time. Since I’m using SCSI2SD and also messing around with a few different logic analyzers, I’ve got several HDD images that include both data files and operating system files. When they are sitting on my machine, they are just these huge masses of data, essentially HDD-sized chunks. Of 4GB, 16GB, 32GB and so on. Sometimes, I want to peer into them, or compare contents…..or literally any other manipulation beyond just coping/moving them around.

HPUX 10.20 uses a few different file system types, not unlike modern linux systems. It uses both HFS for /stand, which contains the kernel. And VxFS, the Veritas File System for some other logical volumes.

This is the logical volume layout for an HP 16700A logic analyzer :

LVM_DISK “SEAGATE ST34520N ” /dev/dsk/c0t6d0 8/16/5.6.0 4340 /dev/vg00
LVM_LAYOUT /dev/vg00: ” ” ” ” ” ”
LVM_LAYOUT /dev/vg00/lvol1 /stand 48 hfs
LVM_LAYOUT /dev/vg00/lvol2 swap 1536 ” ”
LVM_LAYOUT /dev/vg00/lvol3 / 800 vxfs
LVM_LAYOUT /dev/vg00/lvol4 /hplogic 1948 vxfs
LVM_LAYOUT /dev/vg00/lvol5 /home 4 vxfs

You have physical volumes (PVs) which are disks, usually SCSI. You’ve got VG’s, which are volume groups, which house the logical volumes (LVs).

You can mount those last three, lvol3, lvol4, and lvol5 easily on a modern Ubuntu box.

You need two things:

  • a copy of linux-vxfs, which a standard user application that looks inside the entire disk image, and separates the logical volumes. It uses dmsetup to set starting and ending blocks of each logical volume. This is distributed as source-only, but compiles using make/gcc easy enough.
  • the native built-in support for freevxfs in Ubuntu. (modprobe freevxfs; lsmod | grep vxfs)

Setup instructions.

  1. Download linux-vxfs, and untar it into a folder.
  2. There’s a slight modification required for the linux-vxfs-160607.tgz version to run on Ubuntu. See the PATCH section below.
  3. “make” and ignore the (2) warnings about n and pxspace being unused
  4. “./hpux_dmsetup create <fulldiskimagegoeshere>.bin
  5. It should list out several volumes and then say “VG VG%d Activated succesfully with %d lvols.”
  6. You should see a series of entries in /dev/mapper, which are symlinks to /dev/dm-0, /dev/dm-1, etc
  7. Next mount the image: “mount -t vxfs /dev/mapper/blahfromsteps5and6 <insert mountpoint here>”

PATCH.

You need to find and edit simply two lines — replace the top line with the bottom line:

75c75,76
< n = snprintf(cmd, 255, “echo -e \””);

> n = snprintf(cmd, 255, “echo \””);
>
81c82
< n += snprintf(cmd + n, sizeof(cmd) – n – 1, “%d %d linear %s %d\n “,

> n += snprintf(cmd + n, sizeof(cmd) – n – 1, “%d %d linear %s %d”,

Note that none of this would be possible without the hard work of Krzysztof Błaszkowski and Christoph Hellwig before him. Great work guys!