6. Sharing a Disk With DEC Unix

Unfortunately, DEC Unix doesn't know anything about Linux, so sharing a single disk between the two OSes is not entirely trivial. However, it is not a difficult task if you heed the tips in this section. The section assumes you are using aboot version 0.5 or newer.

6.1. Partitioning the disk

First and foremost: never use any of the Linux partitioning programs (minlabel or fdisk) on a disk that is also used by DEC Unix. The Linux minlabel program uses the same partition table format as DEC Unix disklabel, but there are some incompatibilities in the data that minlabel fills in, so DEC Unix will simply refuse to accept a partition table generated by minlabel. To setup a Linux ext2 partition under DEC Unix, you'll have to change the disktab entry for your disk. For the purpose of this discussion, let's assume that you have an rz26 disk (a common 1GB drive) on which you want to install Linux. The disktab entry under DEC Unix v3.2 looks like this (see file /etc/disktab):

rz26|RZ26|DEC RZ26 Winchester:\
        :ty=winchester:dt=SCSI:ns#57:nt#14:nc#2570:\
        :oa#0:pa#131072:ba#8192:fa#1024:\
        :ob#131072:pb#262144:bb#8192:fb#1024:\
        :oc#0:pc#2050860:bc#8192:fc#1024:\
        :od#393216:pd#552548:bd#8192:fd#1024:\
        :oe#945764:pe#552548:be#8192:fe#1024:\
        :of#1498312:pf#552548:bf#8192:ff#1024:\
        :og#393216:pg#819200:bg#8192:fg#1024:\
        :oh#1212416:ph#838444:bh#8192:fh#1024:

The interesting fields here are o?, and p?, where ? is a letter in the range a-h (first through 8-th partition). The o value gives the starting offset of the partition (in sectors) and the p value gives the size of the partition (also in sectors). See disktab(4) for more info. Note that DEC Unix likes to define overlapping partitions. For the entry above, the partition layout looks like this (you can verify this by adding up the various o and p values):

  a            b         d           e           f
|---|-------|-----------|-----------|-----------|

                        c
|-----------------------------------------------|

                     g                 h
            |-----------------|-----------------|

DEC Unix insists that partition a starts at offset 0 and that partition c spans the entire disk. Other than that, you can setup the partition table any way you like.

Let's suppose you have DEC Unix using partition g and want to install Linux on partition h with partition b being a (largish) swap partition. To get this layout without destroying the existing DEC Unix partition, you need to set the partition types explicitly. You can do this by adding a t field for each partition. In our case, we add the following line to the above disktab entry.

       :ta=unused:tb=swap:tg=4.2BSD:th=resrvd8:

Now why do we mark partition h as "reservd8" instead of "ext2"? Well, DEC Unix doesn't know about Linux. It so happens that partition type "ext2" corresponds to a numeric value of 8, and DEC Unix uses the string "reservd8" for that value. Thus, in DEC Unix speak, "reservd8" means "ext2". OK, this was the hard part. Now we just need to install the updated disktab entry on the disk. Let's assume the disk has SCSI id 5. In this case, we'd do:

# disklabel -rw /dev/rrz5c rz26

You can verify that everything is all right by reading back the disklabel with disklabel -r /dev/rrz5c. At this point, you may want to reboot DEC Unix and make sure the existing DEC Unix partition is still alive and well. If that is the case, you can shut down the machine and start with the Linux installation. Be sure to skip the disk partitioning step during the install. Since we already installed a good partition table, you should be able to proceed and select the 8th partition as the Linux root partition and the 2nd partition as the swap partition. If the disk is, say, the second SCSI disk in the machine, then the device name for these partitions would be /dev/sdb8 and /dev/sdb2, respectively (note that Linux uses letters to name the drives and numbers to name the partitions, which is exactly reversed from what DEC Unix does; the Linux scheme makes more sense, of course ;-).

6.2. Installing aboot

First big caveat: with the SRM firmware, you can boot one and only one operating system per disk. For this reason, it is generally best to have at least two SCSI disks in a machine that you want to dual-boot between Linux and DEC Unix. Of course, you could also boot Linux from a floppy if speed doesn't matter or over the network, if you have a bootp-capable server. But in this section we assume you want to boot Linux from a disk that contains one or more DEC Unix partitions.

Second big caveat: installing aboot on a disk shared with DEC Unix renders the first and third partition unusable (since those must have a starting offset of 0). For this reason, we recommend that you change the size of partition a to something that is just big enough to hold aboot (1MB should be plenty).

Once these two caveats are taken care of, installing aboot is almost as easy as usual: since partition a and c will overlap with aboot, we need to tell swriteboot that this is indeed OK. We can do this under Linux with a command line of the following form (again, assuming we're trying to install aboot on the second SCSI disk):

# swriteboot -f1 -f3 /dev/sdb bootlx

The -f1 means that we want to force writing bootlx even though it overlaps with partition 1. The corresponding applies for partition 3.

This is it. You should now be able to shutdown the system and boot Linux from the harddisk. In our example, the SRM command line to do this would be:

>>> boot dka5 -fi 8/vmlinux.gz -fl root=/dev/sdb8