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