Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 ==================
0004 SystemV Filesystem
0005 ==================
0006 
0007 It implements all of
0008   - Xenix FS,
0009   - SystemV/386 FS,
0010   - Coherent FS.
0011 
0012 To install:
0013 
0014 * Answer the 'System V and Coherent filesystem support' question with 'y'
0015   when configuring the kernel.
0016 * To mount a disk or a partition, use::
0017 
0018     mount [-r] -t sysv device mountpoint
0019 
0020   The file system type names::
0021 
0022                -t sysv
0023                -t xenix
0024                -t coherent
0025 
0026   may be used interchangeably, but the last two will eventually disappear.
0027 
0028 Bugs in the present implementation:
0029 
0030 - Coherent FS:
0031 
0032   - The "free list interleave" n:m is currently ignored.
0033   - Only file systems with no filesystem name and no pack name are recognized.
0034     (See Coherent "man mkfs" for a description of these features.)
0035 
0036 - SystemV Release 2 FS:
0037 
0038   The superblock is only searched in the blocks 9, 15, 18, which
0039   corresponds to the beginning of track 1 on floppy disks. No support
0040   for this FS on hard disk yet.
0041 
0042 
0043 These filesystems are rather similar. Here is a comparison with Minix FS:
0044 
0045 * Linux fdisk reports on partitions
0046 
0047   - Minix FS     0x81 Linux/Minix
0048   - Xenix FS     ??
0049   - SystemV FS   ??
0050   - Coherent FS  0x08 AIX bootable
0051 
0052 * Size of a block or zone (data allocation unit on disk)
0053 
0054   - Minix FS     1024
0055   - Xenix FS     1024 (also 512 ??)
0056   - SystemV FS   1024 (also 512 and 2048)
0057   - Coherent FS   512
0058 
0059 * General layout: all have one boot block, one super block and
0060   separate areas for inodes and for directories/data.
0061   On SystemV Release 2 FS (e.g. Microport) the first track is reserved and
0062   all the block numbers (including the super block) are offset by one track.
0063 
0064 * Byte ordering of "short" (16 bit entities) on disk:
0065 
0066   - Minix FS     little endian  0 1
0067   - Xenix FS     little endian  0 1
0068   - SystemV FS   little endian  0 1
0069   - Coherent FS  little endian  0 1
0070 
0071   Of course, this affects only the file system, not the data of files on it!
0072 
0073 * Byte ordering of "long" (32 bit entities) on disk:
0074 
0075   - Minix FS     little endian  0 1 2 3
0076   - Xenix FS     little endian  0 1 2 3
0077   - SystemV FS   little endian  0 1 2 3
0078   - Coherent FS  PDP-11         2 3 0 1
0079 
0080   Of course, this affects only the file system, not the data of files on it!
0081 
0082 * Inode on disk: "short", 0 means non-existent, the root dir ino is:
0083 
0084   =================================  ==
0085   Minix FS                            1
0086   Xenix FS, SystemV FS, Coherent FS   2
0087   =================================  ==
0088 
0089 * Maximum number of hard links to a file:
0090 
0091   ===========  =========
0092   Minix FS     250
0093   Xenix FS     ??
0094   SystemV FS   ??
0095   Coherent FS  >=10000
0096   ===========  =========
0097 
0098 * Free inode management:
0099 
0100   - Minix FS
0101       a bitmap
0102   - Xenix FS, SystemV FS, Coherent FS
0103       There is a cache of a certain number of free inodes in the super-block.
0104       When it is exhausted, new free inodes are found using a linear search.
0105 
0106 * Free block management:
0107 
0108   - Minix FS
0109       a bitmap
0110   - Xenix FS, SystemV FS, Coherent FS
0111       Free blocks are organized in a "free list". Maybe a misleading term,
0112       since it is not true that every free block contains a pointer to
0113       the next free block. Rather, the free blocks are organized in chunks
0114       of limited size, and every now and then a free block contains pointers
0115       to the free blocks pertaining to the next chunk; the first of these
0116       contains pointers and so on. The list terminates with a "block number"
0117       0 on Xenix FS and SystemV FS, with a block zeroed out on Coherent FS.
0118 
0119 * Super-block location:
0120 
0121   ===========  ==========================
0122   Minix FS     block 1 = bytes 1024..2047
0123   Xenix FS     block 1 = bytes 1024..2047
0124   SystemV FS   bytes 512..1023
0125   Coherent FS  block 1 = bytes 512..1023
0126   ===========  ==========================
0127 
0128 * Super-block layout:
0129 
0130   - Minix FS::
0131 
0132                     unsigned short s_ninodes;
0133                     unsigned short s_nzones;
0134                     unsigned short s_imap_blocks;
0135                     unsigned short s_zmap_blocks;
0136                     unsigned short s_firstdatazone;
0137                     unsigned short s_log_zone_size;
0138                     unsigned long s_max_size;
0139                     unsigned short s_magic;
0140 
0141   - Xenix FS, SystemV FS, Coherent FS::
0142 
0143                     unsigned short s_firstdatazone;
0144                     unsigned long  s_nzones;
0145                     unsigned short s_fzone_count;
0146                     unsigned long  s_fzones[NICFREE];
0147                     unsigned short s_finode_count;
0148                     unsigned short s_finodes[NICINOD];
0149                     char           s_flock;
0150                     char           s_ilock;
0151                     char           s_modified;
0152                     char           s_rdonly;
0153                     unsigned long  s_time;
0154                     short          s_dinfo[4]; -- SystemV FS only
0155                     unsigned long  s_free_zones;
0156                     unsigned short s_free_inodes;
0157                     short          s_dinfo[4]; -- Xenix FS only
0158                     unsigned short s_interleave_m,s_interleave_n; -- Coherent FS only
0159                     char           s_fname[6];
0160                     char           s_fpack[6];
0161 
0162     then they differ considerably:
0163 
0164         Xenix FS::
0165 
0166                     char           s_clean;
0167                     char           s_fill[371];
0168                     long           s_magic;
0169                     long           s_type;
0170 
0171         SystemV FS::
0172 
0173                     long           s_fill[12 or 14];
0174                     long           s_state;
0175                     long           s_magic;
0176                     long           s_type;
0177 
0178         Coherent FS::
0179 
0180                     unsigned long  s_unique;
0181 
0182     Note that Coherent FS has no magic.
0183 
0184 * Inode layout:
0185 
0186   - Minix FS::
0187 
0188                     unsigned short i_mode;
0189                     unsigned short i_uid;
0190                     unsigned long  i_size;
0191                     unsigned long  i_time;
0192                     unsigned char  i_gid;
0193                     unsigned char  i_nlinks;
0194                     unsigned short i_zone[7+1+1];
0195 
0196   - Xenix FS, SystemV FS, Coherent FS::
0197 
0198                     unsigned short i_mode;
0199                     unsigned short i_nlink;
0200                     unsigned short i_uid;
0201                     unsigned short i_gid;
0202                     unsigned long  i_size;
0203                     unsigned char  i_zone[3*(10+1+1+1)];
0204                     unsigned long  i_atime;
0205                     unsigned long  i_mtime;
0206                     unsigned long  i_ctime;
0207 
0208 
0209 * Regular file data blocks are organized as
0210 
0211   - Minix FS:
0212 
0213              - 7 direct blocks
0214              - 1 indirect block (pointers to blocks)
0215              - 1 double-indirect block (pointer to pointers to blocks)
0216 
0217   - Xenix FS, SystemV FS, Coherent FS:
0218 
0219              - 10 direct blocks
0220              -  1 indirect block (pointers to blocks)
0221              -  1 double-indirect block (pointer to pointers to blocks)
0222              -  1 triple-indirect block (pointer to pointers to pointers to blocks)
0223 
0224 
0225   ===========  ==========   ================
0226                Inode size   inodes per block
0227   ===========  ==========   ================
0228   Minix FS        32        32
0229   Xenix FS        64        16
0230   SystemV FS      64        16
0231   Coherent FS     64        8
0232   ===========  ==========   ================
0233 
0234 * Directory entry on disk
0235 
0236   - Minix FS::
0237 
0238                     unsigned short inode;
0239                     char name[14/30];
0240 
0241   - Xenix FS, SystemV FS, Coherent FS::
0242 
0243                     unsigned short inode;
0244                     char name[14];
0245 
0246   ===========    ==============    =====================
0247                  Dir entry size    dir entries per block
0248   ===========    ==============    =====================
0249   Minix FS       16/32             64/32
0250   Xenix FS       16                64
0251   SystemV FS     16                64
0252   Coherent FS    16                32
0253   ===========    ==============    =====================
0254 
0255 * How to implement symbolic links such that the host fsck doesn't scream:
0256 
0257   - Minix FS     normal
0258   - Xenix FS     kludge: as regular files with  chmod 1000
0259   - SystemV FS   ??
0260   - Coherent FS  kludge: as regular files with  chmod 1000
0261 
0262 
0263 Notation: We often speak of a "block" but mean a zone (the allocation unit)
0264 and not the disk driver's notion of "block".