I install onto my Fujitsu MK2312 SMD disk. It is connected to an Emulex SC31 controller, who emulates a RM03 disk. It has 70MB, and many bad sectors. So bad sector handling is essential.

    Bad sectors on the system drive

    There are several reason I can not used bad sector forwarding after DEC STD 144.

    1. I can not format the MK2312K with DEC formatter ZRMLB1, because my Emulex SC31 SMD controller is not compatible enough.
    2. PDP11GUI could write the bad sector file after DEC STD 144, but can not mark bad sectors with header bits, as required for bad sector forwarding in 2.11BSD.
    3. Even if I could mark bad sector on the disk, I can not mark them on the SimH image: I can write a bad sector file at the end of disk, but I can not set bad sector header flags, as the SimH disk image does not simulate sector headers, only data content.

    So I mark bad sector with the “badsect(8)” utility, which simly constructs special disk files containing all bad sectors. I still write a bad sector file onto the image, so bad144(8) can display them inside on 2.11BSD.

    SimH: Installing a mini kernel onto a separate RL02 disk

    Before I can use my M2312K disk, I must mark bad sectors on it. To do this, I need an temporary 2.11BSD installation on another drive. We are under SimH and can use every drive we want, but I choosed an RL02, because I also have a physical one connected.

    Well, lets begin!

    Minimal SimH configuration file

    Source code Info
    set cpu 11/44 4096K fpp nocis
    My PDP-11/44 has full 4 MB
    set tm enabled
    attach tm0 ..\211bsd.tap
    “211bsd.tap” is the image of the 2.11BSD installation tape, you can get it here.
    The Setup file is here, you MUST read it!
    set rl0 rl02
    att rl0 stage.rl02
    The RL02 for the temporary installation is called “stage.rl02”
    set rp0 rm03
    att rp0 211bsd.rm02
    “rp” is the controller for RP and RM03 drives.”211.bsd.rm02” is the file name of the target image, it will be moved to te real MK2312 drive.
    boot tm0
    Boot from the installation tape

     

    (Later we may add statements to emulte a DELUA network card and a DZ11 terminal multiplexer)

    The tape boodloader will prompt:

    44Boot from tm(0,0,0) at 0172522
    :

    It waits for a file to load an run

    The stand-alone disklabel program

    “disklabel” writes partitions and drive data onto an 2.11BSD disk.

    Use it to generate this partitions layout on the RL02 disk:

    44Boot from tm(0,0,0) at 0172522
    : tm(0,1)
    Boot: bootdev=0401 bootcsr=0172522
    disklabel
    Disk? rl(0,0)
    'rl(0,0)' is unlabeled or the label is corrupt.
    Proceed? [y/n] y
    d(isplay) D(efault) m(odify) w(rite) q(uit)?

    ... use disklabel program ....

    :d(isplay) n(umber) s(elect) q(uit)? d                 

    type: old DEC
    disk:
    label: DEFAULT
    flags:
    bytes/sector: 512
    sectors/track: 20
    tracks/cylinder: 2
    sectors/cylinder: 40
    cylinders: 512
    rpm: 3600
    drivedata: 0 0 0 0 0

    8 partitions:
    size   offset    fstype  [fsize bsize]
    a: 16000  0         2.11BSD   1024 1024     # (Cyl. 0 - 399)
    b: 4000   16000     swap                    # (Cyl. 400 - 499)
    c: 20480  0         unused    1024 1024     # (Cyl. 0 - 511)

    Refer to the 2.11bsd_setup.pdf, Appendix B on how to do this.

    The menue of "disklabel" is like a text adventure game: "You are in a maze of twisty little passages, all different". Here is a map (every menu level has an additional “d(isplay)” and a “q(uit)” entry, these are not shown here).

    Level 1 Level 2 Level 3 Level 4
    D(efault)
    m(odify)
    g(eometry)
    s(ector/trk)
    t(rk/cyl)
    c(yl)
    S(ector/cyl)
    m(isc)
    >t(ype)
    n(ame)
    l(abel)
    f(lags)
    c(lear)
    e(cc)
    b(adsect)
    r(emovable)
    r(pm)
    D(rivedata)
    p(artitions)
    n(umber)
    s(elect)
    z(ero)
    t(ype)
    o(ffset)
    s(ize)
    f(rag)
    F(size)
    w(rite)

    Creating UNIX root file system on RL02


    Boot von 2.11BSD tape, call tape file #2.

    44Boot from tm(0,0,1) at 0172522
    : tm(0,2)
    Boot: bootdev=0402 bootcsr=0172522
    Mkfs
    file system: rl(0,0)
    file sys size [8000]:
    bytes per inode [4096]:
    interleaving factor (m; 2 default):
    interleaving modulus (n; 20 default):
    isize = 2000
    m/n = 2 20
    Exit called

    44Boot from tm(0,0,2) at 0172522
    :

    Restoring the root file system on RL02

    Boot von 2.11BSD tape, call tape file #3. Filesystem archive is tape file #5.

    44Boot from tm(0,0,1) at 0172522
    : tm(0,3)
    Boot: bootdev=0403 bootcsr=0172522
    Restor
    Tape? tm(0,5)

    Disk? rl(0,0)
    Last chance before scribbling on disk. End of tape

    44Boot from tm(0,0,3) at 0172522

    :

    Installation on RL02 is ready now. Check the disk size:

    Booting unix from boot tape

    sim> b tm

    44Boot from tm(0,0,0) at 0172522
    : rl(0,0)unix
    Boot: bootdev=03400 bootcsr=0174400

    2.11 BSD UNIX #115: Sat Apr 22 19:07:25 PDT 2000
    This email address is being protected from spambots. You need JavaScript enabled to view it.:/usr/src/sys/GENERIC


    phys mem = 3932160
    avail mem = 3708224
    user mem = 307200

    June 8 21:21:24 init: configure system

    hk 0 csr 177440 vector 210 attached
    ht ? csr 172440 vector 224 skipped:  No CSR.
    ra 0 csr 172150 vector 154 vectorset attached
    rl 0 csr 174400 vector 160 attached
    tm 0 csr 172520 vector 224 attached
    tms 0 csr 174500 vector 260 vectorset attached
    ts ? csr 172520 vector 224 interrupt vector already in use.
    xp 0 csr 176700 vector 254 attached
    erase, kill ^U, intr ^C
    #

    Check the disk size:

    # df
    Filesystem 1K-blocks    Used   Avail Capacity Mounted on
    root             7873    2738     5135    35%   /

    Shutdown

    NEVER remove power from an Unix system without shutting it properly down.

     

    # halt
    syncing disks... done
    halting
    HALT instruction, PC: 000014 (MOV #1,17406)
    sim>

    Write a boot sector to the RL02 disk:

    This enables you to boot from the RL drive, if the tape is unmounted.
    The raw a partitions is “/dev/rrl0a”

    # dd if=/mdec/rluboot of=/dev/rrl0a count=1
    1+0 records in
    1+0 records out
    # sync
    # halt

    Boot from RL02:

    So you boot after the boot sector has been written:

    This email address is being protected from spambots. You need JavaScript enabled to view it.:/usr/src/sys/GENERIC
    Loading selected tools + kernel sources from tape

    The root file system needs some add-ons to configure the RM03. Here I load also everything to build a kernel on the RL drive. We cannot just load the whole /usr tree, the RL02 drive is far too small for this. Tape file #6 is a tar of /usr.

    # cd /dev;rm *mt*; ./MAKEDEV tm0; sync                 
    # cd /usr
    # mt rew ; mt fsf 6 ; tar xvpbf 20 /dev/rmt12 \
    include include/sys \
    bin/touch bin/sort bin/install \
    lib/libkern.a \
    ucb/symcompact ucb/strcompact ucb/symorder ucb/symdump \
    sbin/bad144
    bin/ex ucb/vi share/misc/termcap
    sbin/chown

    # sync
    # df
    Filesystem 1K-blocks    Used   Avail Capacity Mounted on
    root             7873    3013     4860    38%   /

    Building a kernel from RL drive has a great show effect, since for long time the drive will be busy! You must move the image file “stage.rl02” to a physical RL02 for this with PDP11GUI.

    These are the required kernel files from tape file #7:

    # cd /
    # mkdir /usr/src
    # mkdir /usr/src/sys
    # mt rew ; mt fsf 7 ; tar xvpbf 20 /dev/rmt12 \
    sys/conf \
    sys/h \
    sys/pdp \
    sys/sys \
    sys/pdpif \
    sys/pdpuba \
    sys/net \
    sys/netinet \
    sys/netimp \
    sys/netns \
    sys/machine
    # sync
    # df
    Filesystem 1K-blocks    Used   Avail Capacity Mounted on
    root             7873    5625     2248    71%   /
    #

    After kernel build, the RL02 is filled up to 82%. Do always a “make clean” after “make install” !

    Swap device

    In /dev there is a device node “swap”. The script “/dev/MAKEDEV.local” lets it point to /dev/hk1a by default:

    rm -f swap;             ln hk1a swap

    Change this (with “vi”, already imported) to

    rm -f swap;             ln rl0b swap

    as we partitioned the swap partition to be the 2nd one on the RL02 drive.
    Then do

    # cd /dev
    # ./MAKEDEV local
    # halt

    Preparing the RM03/MK2312 disk

    To write bad sector information onto the RM03 drive, you first must partition it with the stand -alone disklabel program. Boot from tape, repeat as above, but the device code is “xp” for RM03 instead of “rl”. So it’s

    Disk? xp(0,0)

    Setup this layout (notice the flags and the ‘h’ partition).
    swap is 4MB, last track=32 sectors are bad sector file, 126 sector before are replacement area -> complete last track with 5*32=160 sectors is unused

    d(isplay) D(efault) m(odify) w(rite) q(uit)? d

    type: SMD
    disk: M2312K
    label: DEFAULT
    flags: ecc badsect
    bytes/sector: 512
    sectors/track: 32
    tracks/cylinder: 5
    sectors/cylinder: 160
    cylinders: 823
    rpm: 3600
    drivedata: 0 0 0 0 0

    8 partitions:
    #        size  offset   fstype   [fsize bsize]
    a: 123328 0  2.11BSD   1024 1024    # (Cyl. 0 - 770*)
    b: 8192 123328 swap                 # (Cyl. 770*- 821*)
    c: 131680 0  unused    1024 1024     # (Cyl. 0 - 822)
    h: 131680 0  unused    1024 1024     # (Cyl. 0 - 822)

    Then create the root file system, as above. Load “tm(0,2)”, and it is

    file system: xp(0,0)

    Then boot Unix from RL disk again.

    At first: check the new file system on the RM03 rive:

    # fsck /dev/rxp0a

    Badsect utility

    The badsect(8) utility generates files which cotains bad sectors, so they will not be used by other files. It is important to mark the bad sectors before any other data is moved onto the disk. For generating a bad sector list, see . “badsect” is not the best approach to handle bad sectors, bad sector forwarding by 2.11BSD would be far more better. You should read “man bad144” and “man badsect”. Just google for it, man pages are not installed on the small RL02 disk. And don’t forget the heart of all:

    Here I read bad sectors from the bad sector file on the rm03 image (written there by PDP11GUI, or read in from  the physical pack)

    # bad144 rm03 xp0
    bad block information at 0x4048000 in /dev/rxp0h:
    cartridge serial number: 0(10)
    sn=580, cn=3, tn=3, sn=4
    sn=708, cn=4, tn=2, sn=4
    sn=1220, cn=7, tn=3, sn=4
    sn=1444, cn=9, tn=0, sn=4
    sn=1796, cn=11, tn=1, sn=4
    sn=2052, cn=12, tn=4, sn=4
    sn=2084, cn=13, tn=0, sn=4
    sn=2180, cn=13, tn=3, sn=4
    sn=2404, cn=15, tn=0, sn=4
    sn=4819, cn=30, tn=0, sn=19
    sn=17138, cn=107, tn=0, sn=18
    sn=17362, cn=108, tn=2, sn=18
    sn=17425, cn=108, tn=4, sn=17
    sn=29297, cn=183, tn=0, sn=17
    sn=30802, cn=192, tn=2, sn=18

    The sector numbers are counted against the offset of the file system xp0a ... but this has an offset of 0.

    Let’s mount the new RM03 disk

    # mount /dev/xp0a /mnt
    # mount
    root on /
    /dev/xp0a on /mnt
    #

    Now let’s mark those bad sectors in a directoy /BAD::

    # cd mnt
    # ls
    lost+found
    # mkdir BAD
    # cd BAD
    # pwd
    /mnt/BAD
    # badsect 580 708 1220 1444 1459 1796 2052 2084 2180 2404 3917 4819 17138 17362 17425 29297 30802
    # ls
    1220   1459  17362  1796  2084   2404  30802  4819  708
    1444   17138 17425  2052  2180   29297 3917   580

    Now all bad sectors are in files AND still in the free list. So fsck is absolutely needed! Clear everything up, but do not touch the /BAD/* files.

    # sync
    cd /
    # umount /dev/xp0a
    # fsck /dev/rxp0a
    ** /dev/rxp0a
    File System: /mnt                 


    NEED SCRATCH FILE (45 BLKS)
    ENTER FILENAME:  x
    ** Last Mounted on /mnt
    ** Phase 1 - Check Blocks and Sizes

    HOLD BAD BLOCK? y
    ...
    HOLD BAD BLOCK? y
    354 BAD I=102
    ** Phase 2 - Check Pathnames
    DUP/BAD  I=102 OWNER=root MODE=100600
    SIZE=57569 MTIME=Jun 8 22:10 1995
    FILE=/BAD/708

    REMOVE? n

    DUP/BAD  I=101 OWNER=root MODE=100600
    SIZE=57569 MTIME=Jun 8 22:10 1995
    FILE=/BAD/1220REMOVE? n
    DUP/BAD  I=100 OWNER=root MODE=100600
    SIZE=57569 MTIME=Jun 8 22:10 1995
    FILE=/BAD/1444
    REMOVE? n
    DUP/BAD  I=99  OWNER=root MODE=100600
    SIZE=57569 MTIME=Jun 8 22:10 1995
    FILE=/BAD/1459
    REMOVE? n

    DUP/BAD  I=98  OWNER=root MODE=100600
    SIZE=57569 MTIME=Jun 8 22:10 1995
    FILE=/BAD/1796

    REMOVE? n

    ** Phase 3 - Check Connectivity
    ** Phase 4 - Check Reference Counts
    ** Phase 5 - Check Free List
    11 DUP BLKS IN FREE LIST
    BAD FREE LIST
    SALVAGE? y

    ** Phase 6 - Salvage Free List
    19 files, 14 used, 56654 free

    ***** FILE SYSTEM WAS MODIFIED *****

    badsect(8) leaves you with a few BIG cave-at’s for the rest of the live time of your 2.11BSD installation:

    • Never call fsck with -y from now on!
    • Let it never delete the /BAD/* -files!
    • Never move it as image with “dd ...”. This affects aslo the way we have to install the root file system!

    Now we’re finally ready to install 2.11BSD onto the RM03 disk. The RL02 installation is not used anymore ... but may serve as “emergency disk”.