• Please review our updated Terms and Rules here
  • Exhibitor application for VCF West 2022 is now open! If you are interested in exhibiting, please fill out the form here.
  • Here are the results of the VCF East 2022 Post Event Survey: Survey Results

How-to: mount a Xenix (SysV) file system under Linux

albert.wik

New Member
Joined
Jul 2, 2020
Messages
4
Location
Nordic
Hi all,

From what I could find, there is no description on the Internet about how to mount a Xenix (System V) file system, so I thought I should document it, before I forget it.

First, on Linux, let's switch to the root user:
Code:
$ su
Password: 
#

The Xenix file system is contained in an image file called "286.img". It seems reasonable to try to mount it as follows, by using the Linux loop device facility:
Code:
# ls -l 286.img 
-rw-r--r-- 1 aw aw 541065216 Jul 10 08:53 286.img
# losetup /dev/loop0 286.img
# mount -t sysv -r /dev/loop0 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

That failed. Now let's see if the loop device (backed by the file "286.img") has any partitions. It turns out there's a primary partition number 4:
Code:
# fdisk -l /dev/loop0
Disk /dev/loop0: 516 MiB, 541065216 bytes, 1056768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe264e264

Device       Boot Start     End Sectors   Size Id Type
/dev/loop0p4 *       63 1056383 1056321 515.8M  2 XENIX root
# ls -l /dev/loop0*
brw-rw---- 1 root disk   7, 0 Jul 10 08:32 /dev/loop0
brw-rw---- 1 root disk 259, 0 Jul 10 08:32 /dev/loop0p4

That looks promising! Let's try mounting it:

Code:
# mount -t sysv -r /dev/loop0p4 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop0p4, missing codepage or helper program, or other error.

Failure again. So let's get "clever"! Booting into Xenix with QEMU:
Code:
# cat qemu.cmd 
qemu-system-i386 -M isapc 286.img -k sv
# . ./qemu.cmd

In Xenix:
Code:
# mount
/dev/root on / read-write on Fri Jul 11 08:39:01 2020
# dd if=/dev/root | hd | head -2
0000	[B][I]c7 74 3a 26[/I][/B] 8a 05 0a c0  74 33 36 89 3e 0e 06 38   .t:&....t36.>..8
0010	c8 75 1c 47 51 56 50 ac  e8 1e f4 ae 75 0e e2 f7   .u.GQVP.....u...
# shutdown 0

Take note of the characters in bold-italic above. As you'll see, you will need them further on.

Back to Linux:
Code:
# hexdump -C 286.img | grep c7.74.3a.26
000fc000  c7 74 3a 26 8a 05 0a c0  74 33 36 89 3e 0e 06 38  |.t:&....t36.>..8|
^C

So, apparently, the Xenix root file system starts at offset 0xfc000 into the image file.

Armed with that fact, let's try setting up the loop device again:
Code:
# losetup -d /dev/loop0
# losetup /dev/loop0 286.img -o 0xfc000

Let's try mounting it:

Code:
# mount -t sysv -r /dev/loop0 /mnt
# ls -l /mnt 
total 28
...
-rw-r--r--  1 sys  sys  287702 Jun 12  1989 xenix

Finally success!

Regards,
Albert.
 

albert.wik

New Member
Joined
Jul 2, 2020
Messages
4
Location
Nordic
Thanks. If you're playing around with Xenix yourself, I hope to hear about it.

One thing I'd like to add: be extremely careful about mounting the filesystem writable if you are are, at the same time, running Xenix under an emulator using the same disk image. I learned this the hard way: I got severe corruption affecting many files, and had to restore them from the original image. Then again, unless you are making substantial changes of your own, it is easy enough to just revert to the original.

-aw
 
Top