Discussion:
PDP11 BSD Unix disk allocation vector
(too old to reply)
Jonathan Harston
2022-07-04 13:13:34 UTC
Permalink
Documentation tells me that the allocation vector in
BSD2.9 Unix is:
Disk addresses (...) are (...) packed into 3 bytes each.
The first 10 addresses specify device blocks directly. The last 3
addresses are singly, doubly, and triply indirect (addresses)...
https://minnie.tuhs.org/cgi-bin/utree.pl?file=2.9BSD/usr/man/cat5/filsys.5

Documentation tells me that BSD2-11 Unix is:
28 of the di_addr address bytes are used; 7 addresses of 4
bytes each: 4 direct (4Kb directly accessible) and 3 indirect.
https://github.com/RetroBSD/2.11BSD/blob/master/usr/man/cat5/fs.0

However, the BSD2.9 disk images I have appear to have the first 4
3-byte disk address specifying disk blocks, not the first ten, eg:
https://skn.noip.me/pdp11/rl0.dsk


In all other aspects it's BSD2.9: it has 14-byte filenames, it has
3-byte disk addresses, it starts up claiming it is
Berkeley UNIX (Rev. 2.9.1).

Is there a way to tell from the on-disk data that it is using
4 x 3-byte block addresses and not 10 x 3-byte block addresses?

Is the documentation faulty? Should I assume that BSD2.9 /does/
use 4 x 3-byte block addresses?
--
jgh
Johnny Billquist
2022-07-04 21:51:31 UTC
Permalink
Post by Jonathan Harston
Documentation tells me that the allocation vector in
Disk addresses (...) are (...) packed into 3 bytes each.
The first 10 addresses specify device blocks directly. The last 3
addresses are singly, doubly, and triply indirect (addresses)...
https://minnie.tuhs.org/cgi-bin/utree.pl?file=2.9BSD/usr/man/cat5/filsys.5
28 of the di_addr address bytes are used; 7 addresses of 4
bytes each: 4 direct (4Kb directly accessible) and 3 indirect.
https://github.com/RetroBSD/2.11BSD/blob/master/usr/man/cat5/fs.0
However, the BSD2.9 disk images I have appear to have the first 4
https://skn.noip.me/pdp11/rl0.dsk
In all other aspects it's BSD2.9: it has 14-byte filenames, it has
3-byte disk addresses, it starts up claiming it is
Berkeley UNIX (Rev. 2.9.1).
Is there a way to tell from the on-disk data that it is using
4 x 3-byte block addresses and not 10 x 3-byte block addresses?
Is the documentation faulty? Should I assume that BSD2.9 /does/
use 4 x 3-byte block addresses?
2.11BSD lifted the 14-byte filename limit around patch 250 or so, when
disklabels were introduced (I think name length happened at the same time).
MAXPATHLENGTH is 256 and MAXNAMLENGTH is 63 on current 2.11BSD

It also changed to use the format of inodes and so on. I can't remember
all the details off the top of my head, but I think you should start by
checking if there is a disk label on the disk. If not, you should assume
it's the old V7 format, which was also used by 2.9 BSD. If you find a
disk label, you should assume you have the new format, which is what
2.11BSD currently use. It still uses the same identifier for file system
type.

Disk labels are usually in block 1 (talking about 512 byte blocks) and
you should have the magic number in the first four bytes for a
disklabel. For currnet 2.11BSD that is. I don't think anything was
sitting in that block of the disk before then.

Johnny

Loading...