| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | It implements all of | 
 | 2 |   - Xenix FS, | 
 | 3 |   - SystemV/386 FS, | 
 | 4 |   - Coherent FS. | 
 | 5 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | To install: | 
 | 7 | * Answer the 'System V and Coherent filesystem support' question with 'y' | 
 | 8 |   when configuring the kernel. | 
 | 9 | * To mount a disk or a partition, use | 
 | 10 |     mount [-r] -t sysv device mountpoint | 
 | 11 |   The file system type names | 
 | 12 |                -t sysv | 
 | 13 |                -t xenix | 
 | 14 |                -t coherent | 
 | 15 |   may be used interchangeably, but the last two will eventually disappear. | 
 | 16 |  | 
 | 17 | Bugs in the present implementation: | 
 | 18 | - Coherent FS: | 
 | 19 |   - The "free list interleave" n:m is currently ignored. | 
 | 20 |   - Only file systems with no filesystem name and no pack name are recognized. | 
 | 21 |   (See Coherent "man mkfs" for a description of these features.) | 
 | 22 | - SystemV Release 2 FS: | 
 | 23 |   The superblock is only searched in the blocks 9, 15, 18, which | 
 | 24 |   corresponds to the beginning of track 1 on floppy disks. No support | 
 | 25 |   for this FS on hard disk yet. | 
 | 26 |  | 
 | 27 |  | 
| Adrian Bunk | 3982cd9 | 2006-12-06 20:40:01 -0800 | [diff] [blame] | 28 | These filesystems are rather similar. Here is a comparison with Minix FS: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 |  | 
| Adrian Bunk | 3982cd9 | 2006-12-06 20:40:01 -0800 | [diff] [blame] | 30 | * Linux fdisk reports on partitions | 
 | 31 |   - Minix FS     0x81 Linux/Minix | 
 | 32 |   - Xenix FS     ?? | 
 | 33 |   - SystemV FS   ?? | 
 | 34 |   - Coherent FS  0x08 AIX bootable | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 |  | 
| Adrian Bunk | 3982cd9 | 2006-12-06 20:40:01 -0800 | [diff] [blame] | 36 | * Size of a block or zone (data allocation unit on disk) | 
 | 37 |   - Minix FS     1024 | 
 | 38 |   - Xenix FS     1024 (also 512 ??) | 
 | 39 |   - SystemV FS   1024 (also 512 and 2048) | 
 | 40 |   - Coherent FS   512 | 
 | 41 |  | 
 | 42 | * General layout: all have one boot block, one super block and | 
 | 43 |   separate areas for inodes and for directories/data. | 
 | 44 |   On SystemV Release 2 FS (e.g. Microport) the first track is reserved and | 
 | 45 |   all the block numbers (including the super block) are offset by one track. | 
 | 46 |  | 
 | 47 | * Byte ordering of "short" (16 bit entities) on disk: | 
 | 48 |   - Minix FS     little endian  0 1 | 
 | 49 |   - Xenix FS     little endian  0 1 | 
 | 50 |   - SystemV FS   little endian  0 1 | 
 | 51 |   - Coherent FS  little endian  0 1 | 
 | 52 |   Of course, this affects only the file system, not the data of files on it! | 
 | 53 |  | 
 | 54 | * Byte ordering of "long" (32 bit entities) on disk: | 
 | 55 |   - Minix FS     little endian  0 1 2 3 | 
 | 56 |   - Xenix FS     little endian  0 1 2 3 | 
 | 57 |   - SystemV FS   little endian  0 1 2 3 | 
 | 58 |   - Coherent FS  PDP-11         2 3 0 1 | 
 | 59 |   Of course, this affects only the file system, not the data of files on it! | 
 | 60 |  | 
 | 61 | * Inode on disk: "short", 0 means non-existent, the root dir ino is: | 
 | 62 |   - Minix FS                            1 | 
 | 63 |   - Xenix FS, SystemV FS, Coherent FS   2 | 
 | 64 |  | 
 | 65 | * Maximum number of hard links to a file: | 
 | 66 |   - Minix FS     250 | 
 | 67 |   - Xenix FS     ?? | 
 | 68 |   - SystemV FS   ?? | 
 | 69 |   - Coherent FS  >=10000 | 
 | 70 |  | 
 | 71 | * Free inode management: | 
 | 72 |   - Minix FS                             a bitmap | 
 | 73 |   - Xenix FS, SystemV FS, Coherent FS | 
 | 74 |       There is a cache of a certain number of free inodes in the super-block. | 
 | 75 |       When it is exhausted, new free inodes are found using a linear search. | 
 | 76 |  | 
 | 77 | * Free block management: | 
 | 78 |   - Minix FS                             a bitmap | 
 | 79 |   - Xenix FS, SystemV FS, Coherent FS | 
 | 80 |       Free blocks are organized in a "free list". Maybe a misleading term, | 
 | 81 |       since it is not true that every free block contains a pointer to | 
 | 82 |       the next free block. Rather, the free blocks are organized in chunks | 
 | 83 |       of limited size, and every now and then a free block contains pointers | 
 | 84 |       to the free blocks pertaining to the next chunk; the first of these | 
 | 85 |       contains pointers and so on. The list terminates with a "block number" | 
 | 86 |       0 on Xenix FS and SystemV FS, with a block zeroed out on Coherent FS. | 
 | 87 |  | 
 | 88 | * Super-block location: | 
 | 89 |   - Minix FS     block 1 = bytes 1024..2047 | 
 | 90 |   - Xenix FS     block 1 = bytes 1024..2047 | 
 | 91 |   - SystemV FS   bytes 512..1023 | 
 | 92 |   - Coherent FS  block 1 = bytes 512..1023 | 
 | 93 |  | 
 | 94 | * Super-block layout: | 
 | 95 |   - Minix FS | 
 | 96 |                     unsigned short s_ninodes; | 
 | 97 |                     unsigned short s_nzones; | 
 | 98 |                     unsigned short s_imap_blocks; | 
 | 99 |                     unsigned short s_zmap_blocks; | 
 | 100 |                     unsigned short s_firstdatazone; | 
 | 101 |                     unsigned short s_log_zone_size; | 
 | 102 |                     unsigned long s_max_size; | 
 | 103 |                     unsigned short s_magic; | 
 | 104 |   - Xenix FS, SystemV FS, Coherent FS | 
 | 105 |                     unsigned short s_firstdatazone; | 
 | 106 |                     unsigned long  s_nzones; | 
 | 107 |                     unsigned short s_fzone_count; | 
 | 108 |                     unsigned long  s_fzones[NICFREE]; | 
 | 109 |                     unsigned short s_finode_count; | 
 | 110 |                     unsigned short s_finodes[NICINOD]; | 
 | 111 |                     char           s_flock; | 
 | 112 |                     char           s_ilock; | 
 | 113 |                     char           s_modified; | 
 | 114 |                     char           s_rdonly; | 
 | 115 |                     unsigned long  s_time; | 
 | 116 |                     short          s_dinfo[4]; -- SystemV FS only | 
 | 117 |                     unsigned long  s_free_zones; | 
 | 118 |                     unsigned short s_free_inodes; | 
 | 119 |                     short          s_dinfo[4]; -- Xenix FS only | 
 | 120 |                     unsigned short s_interleave_m,s_interleave_n; -- Coherent FS only | 
 | 121 |                     char           s_fname[6]; | 
 | 122 |                     char           s_fpack[6]; | 
 | 123 |     then they differ considerably: | 
 | 124 |         Xenix FS | 
 | 125 |                     char           s_clean; | 
 | 126 |                     char           s_fill[371]; | 
 | 127 |                     long           s_magic; | 
 | 128 |                     long           s_type; | 
 | 129 |         SystemV FS | 
 | 130 |                     long           s_fill[12 or 14]; | 
 | 131 |                     long           s_state; | 
 | 132 |                     long           s_magic; | 
 | 133 |                     long           s_type; | 
 | 134 |         Coherent FS | 
 | 135 |                     unsigned long  s_unique; | 
 | 136 |     Note that Coherent FS has no magic. | 
 | 137 |  | 
 | 138 | * Inode layout: | 
 | 139 |   - Minix FS | 
 | 140 |                     unsigned short i_mode; | 
 | 141 |                     unsigned short i_uid; | 
 | 142 |                     unsigned long  i_size; | 
 | 143 |                     unsigned long  i_time; | 
 | 144 |                     unsigned char  i_gid; | 
 | 145 |                     unsigned char  i_nlinks; | 
 | 146 |                     unsigned short i_zone[7+1+1]; | 
 | 147 |   - Xenix FS, SystemV FS, Coherent FS | 
 | 148 |                     unsigned short i_mode; | 
 | 149 |                     unsigned short i_nlink; | 
 | 150 |                     unsigned short i_uid; | 
 | 151 |                     unsigned short i_gid; | 
 | 152 |                     unsigned long  i_size; | 
 | 153 |                     unsigned char  i_zone[3*(10+1+1+1)]; | 
 | 154 |                     unsigned long  i_atime; | 
 | 155 |                     unsigned long  i_mtime; | 
 | 156 |                     unsigned long  i_ctime; | 
 | 157 |  | 
 | 158 | * Regular file data blocks are organized as | 
 | 159 |   - Minix FS | 
 | 160 |                7 direct blocks | 
 | 161 |                1 indirect block (pointers to blocks) | 
 | 162 |                1 double-indirect block (pointer to pointers to blocks) | 
 | 163 |   - Xenix FS, SystemV FS, Coherent FS | 
 | 164 |               10 direct blocks | 
 | 165 |                1 indirect block (pointers to blocks) | 
 | 166 |                1 double-indirect block (pointer to pointers to blocks) | 
 | 167 |                1 triple-indirect block (pointer to pointers to pointers to blocks) | 
 | 168 |  | 
 | 169 | * Inode size, inodes per block | 
 | 170 |   - Minix FS        32   32 | 
 | 171 |   - Xenix FS        64   16 | 
 | 172 |   - SystemV FS      64   16 | 
 | 173 |   - Coherent FS     64    8 | 
 | 174 |  | 
 | 175 | * Directory entry on disk | 
 | 176 |   - Minix FS | 
 | 177 |                     unsigned short inode; | 
 | 178 |                     char name[14/30]; | 
 | 179 |   - Xenix FS, SystemV FS, Coherent FS | 
 | 180 |                     unsigned short inode; | 
 | 181 |                     char name[14]; | 
 | 182 |  | 
 | 183 | * Dir entry size, dir entries per block | 
 | 184 |   - Minix FS     16/32    64/32 | 
 | 185 |   - Xenix FS     16       64 | 
 | 186 |   - SystemV FS   16       64 | 
 | 187 |   - Coherent FS  16       32 | 
 | 188 |  | 
 | 189 | * How to implement symbolic links such that the host fsck doesn't scream: | 
 | 190 |   - Minix FS     normal | 
 | 191 |   - Xenix FS     kludge: as regular files with  chmod 1000 | 
 | 192 |   - SystemV FS   ?? | 
 | 193 |   - Coherent FS  kludge: as regular files with  chmod 1000 | 
 | 194 |  | 
 | 195 |  | 
 | 196 | Notation: We often speak of a "block" but mean a zone (the allocation unit) | 
 | 197 | and not the disk driver's notion of "block". |