Annotation of researchv10dc/dist/man/v3/man5/fs.5, revision 1.1.1.1

1.1       root        1: .pa 1
                      2: .he 'FILE SYSTEM (V)'3/15/72'FILE SYSTEM (V)'
                      3: .ti 0
                      4: NAME           format of file system
                      5: .sp
                      6: .ti 0
                      7: DESCRIPTION
                      8: .br
                      9: .in 8
                     10: Every
                     11: file system storage volume
                     12: (e.g. RF disk, RK disk, DECtape reel)
                     13: has a common format for certain vital information.
                     14: 
                     15: Every such volume is divided into a certain number
                     16: of 256 word (512 byte) blocks.  Blocks 0 and 1 are
                     17: collectively known as the super_____-block_____ for the device;
                     18: they define its extent and contain an i-node map
                     19: and a free-storage map.
                     20: The first word
                     21: contains the number of bytes in the free-storage
                     22: map; it is always even.
                     23: It is followed by the map.
                     24: There is one bit for each block on the device; the bit is "1"
                     25: if the block is free.
                     26: Thus if the
                     27: number of free-map bytes is n_, the blocks on the device
                     28: are numbered 0 through 8n_-1.
                     29: The free-map count is followed by the free map
                     30: itself.
                     31: The bit for block k_ of the device
                     32: is in byte k_/8 of the map; it is offset k_(mod 8) bits from the right.
                     33: Notice that bits exist for the superblock and the i-list,
                     34: even though they are never allocated or freed.
                     35: 
                     36: After the free map is a word containing the byte count
                     37: for the i-node map.  It too is always even.
                     38: I-numbers below 41(10) are reserved
                     39: for special files, and are
                     40: never allocated; the first bit in the i-node
                     41: free map refers to i-number 41.
                     42: Therefore the byte number in the i-node map
                     43: for i-node i_ is (i_-41)/8.
                     44: It is offset (i_-41) (mod 8) bits from the right; unlike
                     45: the free map, a "0" bit indicates an available i-node.
                     46: 
                     47: I-numbers begin at 1, and the storage for i-nodes
                     48: begins at block 2.
                     49: Also, i-nodes are 32 bytes long, so 16 of them fit into a block.
                     50: Therefore, i-node i_ is located in block (i_+31)/16 of
                     51: the file system, and begins 32\u.\d((i_+31)(mod 16)) bytes
                     52: from its start.
                     53: 
                     54: There is always one file system which is always mounted;
                     55: in standard UNIX it resides on the RF disk.
                     56: This device is also used for swapping.
                     57: On the primary file system device, there are
                     58: several pieces of information following that previously
                     59: discussed.
                     60: There are two words with the calendar time
                     61: (measured since 00:00 Jan 1, 1972);
                     62: two words with the time spent executing in the system;
                     63: two words with the time spent waiting for I/O on the RF and RK
                     64: disks; two words with the time spent executing in a user's
                     65: core; one byte with the count of errors on the RF
                     66: disk; and one byte with the count of errors on the RK disk.
                     67: All the times are measured in sixtieths of a second.
                     68: 
                     69: I-node 41(10) is reserved for the root directory of the
                     70: file system.
                     71: No i-numbers other than this one and those from
                     72: 1 to 40 (which represent special files) have a built-in
                     73: meaning.
                     74: Each i-node represents one file.
                     75: The format of an i-node is as follows, where the
                     76: left column represents the offset from the beginning
                     77: of the i-node:
                     78: .sp
                     79: .nf
                     80: .in +3
                     81: 0-1    flags (see below)
                     82: 2      number of links
                     83: 3      user ID of owner
                     84: 4-5    size in bytes
                     85: 6-7    first indirect block or contents block
                     86: .li
                     87: ...
                     88: 20-21  eighth indirect block or contents block
                     89: 22-25  creation time
                     90: 26-29  modification time
                     91: 30-31          unused
                     92: .fi
                     93: .sp
                     94: .ti -3
                     95: The flags are as follows:
                     96: .sp
                     97: .nf
                     98: 100000 i-node is allocated
                     99: 040000 directory
                    100: 020000 file has been modified (always on)
                    101: 010000 large file
                    102: 000040 set user ID on execution
                    103: 000020 executable
                    104: 000010 read, owner
                    105: 000004 write, owner
                    106: 000002 read, non-owner
                    107: 000001 write, non-owner
                    108: .sp
                    109: .in -3
                    110: .fi
                    111: The allocated bit (flag 100000) is believed even
                    112: if the i-node map says the i-node is free;
                    113: thus corruption of the map may cause i-nodes
                    114: to become unallocatable, but will not cause active
                    115: nodes to be reused.
                    116: 
                    117: Byte number n_ of a file is accessed as follows:
                    118: n_ is divided by 512 to find its logical block number (say b_)
                    119: in the file.
                    120: If the file is small (flag 010000 is 0),
                    121: then b_ must be less than 8, and the physical block
                    122: number corresponding to b_ is the b_th entry
                    123: in the address portion of the i-node.
                    124: 
                    125: Even if the file is large, b_ will be less than
                    126: 128 (128*512 = 2^16).
                    127: The first number in the i-node address
                    128: portion
                    129: gives the physical block number of the indirect block.
                    130: b_ is doubled
                    131: to give a byte offset in the indirect block
                    132: and the word there found is the physical address of
                    133: the block corresponding to b_.
                    134: 
                    135: For block b_ in a file to exist, it
                    136: is not necessary that all blocks less than b_ exist.
                    137: A zero block number either in the address words of
                    138: the i-node or in an indirect block indicates that the
                    139: corresponding block has never been allocated.
                    140: Such a missing block reads as if it contained all zero words.
                    141: 
                    142: .in 16
                    143: .ti 0
                    144: BUGS           Two blocks are not enough to handle
                    145: the i- and free-storage maps for an RP02
                    146: disk pack, which contains around 10 million words.
                    147: .sp

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.