sysv-fs.txt 7.4 KB

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