1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun============================= 4*4882a593SmuzhiyunOverview of Amiga Filesystems 5*4882a593Smuzhiyun============================= 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunNot all varieties of the Amiga filesystems are supported for reading and 8*4882a593Smuzhiyunwriting. The Amiga currently knows six different filesystems: 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun============== =============================================================== 11*4882a593SmuzhiyunDOS\0 The old or original filesystem, not really suited for 12*4882a593Smuzhiyun hard disks and normally not used on them, either. 13*4882a593Smuzhiyun Supported read/write. 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunDOS\1 The original Fast File System. Supported read/write. 16*4882a593Smuzhiyun 17*4882a593SmuzhiyunDOS\2 The old "international" filesystem. International means that 18*4882a593Smuzhiyun a bug has been fixed so that accented ("international") letters 19*4882a593Smuzhiyun in file names are case-insensitive, as they ought to be. 20*4882a593Smuzhiyun Supported read/write. 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunDOS\3 The "international" Fast File System. Supported read/write. 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunDOS\4 The original filesystem with directory cache. The directory 25*4882a593Smuzhiyun cache speeds up directory accesses on floppies considerably, 26*4882a593Smuzhiyun but slows down file creation/deletion. Doesn't make much 27*4882a593Smuzhiyun sense on hard disks. Supported read only. 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunDOS\5 The Fast File System with directory cache. Supported read only. 30*4882a593Smuzhiyun============== =============================================================== 31*4882a593Smuzhiyun 32*4882a593SmuzhiyunAll of the above filesystems allow block sizes from 512 to 32K bytes. 33*4882a593SmuzhiyunSupported block sizes are: 512, 1024, 2048 and 4096 bytes. Larger blocks 34*4882a593Smuzhiyunspeed up almost everything at the expense of wasted disk space. The speed 35*4882a593Smuzhiyungain above 4K seems not really worth the price, so you don't lose too 36*4882a593Smuzhiyunmuch here, either. 37*4882a593Smuzhiyun 38*4882a593SmuzhiyunThe muFS (multi user File System) equivalents of the above file systems 39*4882a593Smuzhiyunare supported, too. 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunMount options for the AFFS 42*4882a593Smuzhiyun========================== 43*4882a593Smuzhiyun 44*4882a593Smuzhiyunprotect 45*4882a593Smuzhiyun If this option is set, the protection bits cannot be altered. 46*4882a593Smuzhiyun 47*4882a593Smuzhiyunsetuid[=uid] 48*4882a593Smuzhiyun This sets the owner of all files and directories in the file 49*4882a593Smuzhiyun system to uid or the uid of the current user, respectively. 50*4882a593Smuzhiyun 51*4882a593Smuzhiyunsetgid[=gid] 52*4882a593Smuzhiyun Same as above, but for gid. 53*4882a593Smuzhiyun 54*4882a593Smuzhiyunmode=mode 55*4882a593Smuzhiyun Sets the mode flags to the given (octal) value, regardless 56*4882a593Smuzhiyun of the original permissions. Directories will get an x 57*4882a593Smuzhiyun permission if the corresponding r bit is set. 58*4882a593Smuzhiyun This is useful since most of the plain AmigaOS files 59*4882a593Smuzhiyun will map to 600. 60*4882a593Smuzhiyun 61*4882a593Smuzhiyunnofilenametruncate 62*4882a593Smuzhiyun The file system will return an error when filename exceeds 63*4882a593Smuzhiyun standard maximum filename length (30 characters). 64*4882a593Smuzhiyun 65*4882a593Smuzhiyunreserved=num 66*4882a593Smuzhiyun Sets the number of reserved blocks at the start of the 67*4882a593Smuzhiyun partition to num. You should never need this option. 68*4882a593Smuzhiyun Default is 2. 69*4882a593Smuzhiyun 70*4882a593Smuzhiyunroot=block 71*4882a593Smuzhiyun Sets the block number of the root block. This should never 72*4882a593Smuzhiyun be necessary. 73*4882a593Smuzhiyun 74*4882a593Smuzhiyunbs=blksize 75*4882a593Smuzhiyun Sets the blocksize to blksize. Valid block sizes are 512, 76*4882a593Smuzhiyun 1024, 2048 and 4096. Like the root option, this should 77*4882a593Smuzhiyun never be necessary, as the affs can figure it out itself. 78*4882a593Smuzhiyun 79*4882a593Smuzhiyunquiet 80*4882a593Smuzhiyun The file system will not return an error for disallowed 81*4882a593Smuzhiyun mode changes. 82*4882a593Smuzhiyun 83*4882a593Smuzhiyunverbose 84*4882a593Smuzhiyun The volume name, file system type and block size will 85*4882a593Smuzhiyun be written to the syslog when the filesystem is mounted. 86*4882a593Smuzhiyun 87*4882a593Smuzhiyunmufs 88*4882a593Smuzhiyun The filesystem is really a muFS, also it doesn't 89*4882a593Smuzhiyun identify itself as one. This option is necessary if 90*4882a593Smuzhiyun the filesystem wasn't formatted as muFS, but is used 91*4882a593Smuzhiyun as one. 92*4882a593Smuzhiyun 93*4882a593Smuzhiyunprefix=path 94*4882a593Smuzhiyun Path will be prefixed to every absolute path name of 95*4882a593Smuzhiyun symbolic links on an AFFS partition. Default = "/". 96*4882a593Smuzhiyun (See below.) 97*4882a593Smuzhiyun 98*4882a593Smuzhiyunvolume=name 99*4882a593Smuzhiyun When symbolic links with an absolute path are created 100*4882a593Smuzhiyun on an AFFS partition, name will be prepended as the 101*4882a593Smuzhiyun volume name. Default = "" (empty string). 102*4882a593Smuzhiyun (See below.) 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunHandling of the Users/Groups and protection flags 105*4882a593Smuzhiyun================================================= 106*4882a593Smuzhiyun 107*4882a593SmuzhiyunAmiga -> Linux: 108*4882a593Smuzhiyun 109*4882a593SmuzhiyunThe Amiga protection flags RWEDRWEDHSPARWED are handled as follows: 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun - R maps to r for user, group and others. On directories, R implies x. 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun - W maps to w. 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun - E maps to x. 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun - D is ignored. 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun - H, S and P are always retained and ignored under Linux. 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun - A is cleared when a file is written to. 122*4882a593Smuzhiyun 123*4882a593SmuzhiyunUser id and group id will be used unless set[gu]id are given as mount 124*4882a593Smuzhiyunoptions. Since most of the Amiga file systems are single user systems 125*4882a593Smuzhiyunthey will be owned by root. The root directory (the mount point) of the 126*4882a593SmuzhiyunAmiga filesystem will be owned by the user who actually mounts the 127*4882a593Smuzhiyunfilesystem (the root directory doesn't have uid/gid fields). 128*4882a593Smuzhiyun 129*4882a593SmuzhiyunLinux -> Amiga: 130*4882a593Smuzhiyun 131*4882a593SmuzhiyunThe Linux rwxrwxrwx file mode is handled as follows: 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun - r permission will allow R for user, group and others. 134*4882a593Smuzhiyun 135*4882a593Smuzhiyun - w permission will allow W for user, group and others. 136*4882a593Smuzhiyun 137*4882a593Smuzhiyun - x permission of the user will allow E for plain files. 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun - D will be allowed for user, group and others. 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun - All other flags (suid, sgid, ...) are ignored and will 142*4882a593Smuzhiyun not be retained. 143*4882a593Smuzhiyun 144*4882a593SmuzhiyunNewly created files and directories will get the user and group ID 145*4882a593Smuzhiyunof the current user and a mode according to the umask. 146*4882a593Smuzhiyun 147*4882a593SmuzhiyunSymbolic links 148*4882a593Smuzhiyun============== 149*4882a593Smuzhiyun 150*4882a593SmuzhiyunAlthough the Amiga and Linux file systems resemble each other, there 151*4882a593Smuzhiyunare some, not always subtle, differences. One of them becomes apparent 152*4882a593Smuzhiyunwith symbolic links. While Linux has a file system with exactly one 153*4882a593Smuzhiyunroot directory, the Amiga has a separate root directory for each 154*4882a593Smuzhiyunfile system (for example, partition, floppy disk, ...). With the Amiga, 155*4882a593Smuzhiyunthese entities are called "volumes". They have symbolic names which 156*4882a593Smuzhiyuncan be used to access them. Thus, symbolic links can point to a 157*4882a593Smuzhiyundifferent volume. AFFS turns the volume name into a directory name 158*4882a593Smuzhiyunand prepends the prefix path (see prefix option) to it. 159*4882a593Smuzhiyun 160*4882a593SmuzhiyunExample: 161*4882a593SmuzhiyunYou mount all your Amiga partitions under /amiga/<volume> (where 162*4882a593Smuzhiyun<volume> is the name of the volume), and you give the option 163*4882a593Smuzhiyun"prefix=/amiga/" when mounting all your AFFS partitions. (They 164*4882a593Smuzhiyunmight be "User", "WB" and "Graphics", the mount points /amiga/User, 165*4882a593Smuzhiyun/amiga/WB and /amiga/Graphics). A symbolic link referring to 166*4882a593Smuzhiyun"User:sc/include/dos/dos.h" will be followed to 167*4882a593Smuzhiyun"/amiga/User/sc/include/dos/dos.h". 168*4882a593Smuzhiyun 169*4882a593SmuzhiyunExamples 170*4882a593Smuzhiyun======== 171*4882a593Smuzhiyun 172*4882a593SmuzhiyunCommand line:: 173*4882a593Smuzhiyun 174*4882a593Smuzhiyun mount Archive/Amiga/Workbench3.1.adf /mnt -t affs -o loop,verbose 175*4882a593Smuzhiyun mount /dev/sda3 /Amiga -t affs 176*4882a593Smuzhiyun 177*4882a593Smuzhiyun/etc/fstab entry:: 178*4882a593Smuzhiyun 179*4882a593Smuzhiyun /dev/sdb5 /amiga/Workbench affs noauto,user,exec,verbose 0 0 180*4882a593Smuzhiyun 181*4882a593SmuzhiyunIMPORTANT NOTE 182*4882a593Smuzhiyun============== 183*4882a593Smuzhiyun 184*4882a593SmuzhiyunIf you boot Windows 95 (don't know about 3.x, 98 and NT) while you 185*4882a593Smuzhiyunhave an Amiga harddisk connected to your PC, it will overwrite 186*4882a593Smuzhiyunthe bytes 0x00dc..0x00df of block 0 with garbage, thus invalidating 187*4882a593Smuzhiyunthe Rigid Disk Block. Sheer luck has it that this is an unused 188*4882a593Smuzhiyunarea of the RDB, so only the checksum doesn't match anymore. 189*4882a593SmuzhiyunLinux will ignore this garbage and recognize the RDB anyway, but 190*4882a593Smuzhiyunbefore you connect that drive to your Amiga again, you must 191*4882a593Smuzhiyunrestore or repair your RDB. So please do make a backup copy of it 192*4882a593Smuzhiyunbefore booting Windows! 193*4882a593Smuzhiyun 194*4882a593SmuzhiyunIf the damage is already done, the following should fix the RDB 195*4882a593Smuzhiyun(where <disk> is the device name). 196*4882a593Smuzhiyun 197*4882a593SmuzhiyunDO AT YOUR OWN RISK:: 198*4882a593Smuzhiyun 199*4882a593Smuzhiyun dd if=/dev/<disk> of=rdb.tmp count=1 200*4882a593Smuzhiyun cp rdb.tmp rdb.fixed 201*4882a593Smuzhiyun dd if=/dev/zero of=rdb.fixed bs=1 seek=220 count=4 202*4882a593Smuzhiyun dd if=rdb.fixed of=/dev/<disk> 203*4882a593Smuzhiyun 204*4882a593SmuzhiyunBugs, Restrictions, Caveats 205*4882a593Smuzhiyun=========================== 206*4882a593Smuzhiyun 207*4882a593SmuzhiyunQuite a few things may not work as advertised. Not everything is 208*4882a593Smuzhiyuntested, though several hundred MB have been read and written using 209*4882a593Smuzhiyunthis fs. For a most up-to-date list of bugs please consult 210*4882a593Smuzhiyunfs/affs/Changes. 211*4882a593Smuzhiyun 212*4882a593SmuzhiyunBy default, filenames are truncated to 30 characters without warning. 213*4882a593Smuzhiyun'nofilenametruncate' mount option can change that behavior. 214*4882a593Smuzhiyun 215*4882a593SmuzhiyunCase is ignored by the affs in filename matching, but Linux shells 216*4882a593Smuzhiyundo care about the case. Example (with /wb being an affs mounted fs):: 217*4882a593Smuzhiyun 218*4882a593Smuzhiyun rm /wb/WRONGCASE 219*4882a593Smuzhiyun 220*4882a593Smuzhiyunwill remove /mnt/wrongcase, but:: 221*4882a593Smuzhiyun 222*4882a593Smuzhiyun rm /wb/WR* 223*4882a593Smuzhiyun 224*4882a593Smuzhiyunwill not since the names are matched by the shell. 225*4882a593Smuzhiyun 226*4882a593SmuzhiyunThe block allocation is designed for hard disk partitions. If more 227*4882a593Smuzhiyunthan 1 process writes to a (small) diskette, the blocks are allocated 228*4882a593Smuzhiyunin an ugly way (but the real AFFS doesn't do much better). This 229*4882a593Smuzhiyunis also true when space gets tight. 230*4882a593Smuzhiyun 231*4882a593SmuzhiyunYou cannot execute programs on an OFS (Old File System), since the 232*4882a593Smuzhiyunprogram files cannot be memory mapped due to the 488 byte blocks. 233*4882a593SmuzhiyunFor the same reason you cannot mount an image on such a filesystem 234*4882a593Smuzhiyunvia the loopback device. 235*4882a593Smuzhiyun 236*4882a593SmuzhiyunThe bitmap valid flag in the root block may not be accurate when the 237*4882a593Smuzhiyunsystem crashes while an affs partition is mounted. There's currently 238*4882a593Smuzhiyunno way to fix a garbled filesystem without an Amiga (disk validator) 239*4882a593Smuzhiyunor manually (who would do this?). Maybe later. 240*4882a593Smuzhiyun 241*4882a593SmuzhiyunIf you mount affs partitions on system startup, you may want to tell 242*4882a593Smuzhiyunfsck that the fs should not be checked (place a '0' in the sixth field 243*4882a593Smuzhiyunof /etc/fstab). 244*4882a593Smuzhiyun 245*4882a593SmuzhiyunIt's not possible to read floppy disks with a normal PC or workstation 246*4882a593Smuzhiyundue to an incompatibility with the Amiga floppy controller. 247*4882a593Smuzhiyun 248*4882a593SmuzhiyunIf you are interested in an Amiga Emulator for Linux, look at 249*4882a593Smuzhiyun 250*4882a593Smuzhiyunhttp://web.archive.org/web/%2E/http://www.freiburg.linux.de/~uae/ 251