18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci============================= 48c2ecf20Sopenharmony_ciOverview of Amiga Filesystems 58c2ecf20Sopenharmony_ci============================= 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciNot all varieties of the Amiga filesystems are supported for reading and 88c2ecf20Sopenharmony_ciwriting. The Amiga currently knows six different filesystems: 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci============== =============================================================== 118c2ecf20Sopenharmony_ciDOS\0 The old or original filesystem, not really suited for 128c2ecf20Sopenharmony_ci hard disks and normally not used on them, either. 138c2ecf20Sopenharmony_ci Supported read/write. 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciDOS\1 The original Fast File System. Supported read/write. 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciDOS\2 The old "international" filesystem. International means that 188c2ecf20Sopenharmony_ci a bug has been fixed so that accented ("international") letters 198c2ecf20Sopenharmony_ci in file names are case-insensitive, as they ought to be. 208c2ecf20Sopenharmony_ci Supported read/write. 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciDOS\3 The "international" Fast File System. Supported read/write. 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciDOS\4 The original filesystem with directory cache. The directory 258c2ecf20Sopenharmony_ci cache speeds up directory accesses on floppies considerably, 268c2ecf20Sopenharmony_ci but slows down file creation/deletion. Doesn't make much 278c2ecf20Sopenharmony_ci sense on hard disks. Supported read only. 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciDOS\5 The Fast File System with directory cache. Supported read only. 308c2ecf20Sopenharmony_ci============== =============================================================== 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciAll of the above filesystems allow block sizes from 512 to 32K bytes. 338c2ecf20Sopenharmony_ciSupported block sizes are: 512, 1024, 2048 and 4096 bytes. Larger blocks 348c2ecf20Sopenharmony_cispeed up almost everything at the expense of wasted disk space. The speed 358c2ecf20Sopenharmony_cigain above 4K seems not really worth the price, so you don't lose too 368c2ecf20Sopenharmony_cimuch here, either. 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciThe muFS (multi user File System) equivalents of the above file systems 398c2ecf20Sopenharmony_ciare supported, too. 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciMount options for the AFFS 428c2ecf20Sopenharmony_ci========================== 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciprotect 458c2ecf20Sopenharmony_ci If this option is set, the protection bits cannot be altered. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cisetuid[=uid] 488c2ecf20Sopenharmony_ci This sets the owner of all files and directories in the file 498c2ecf20Sopenharmony_ci system to uid or the uid of the current user, respectively. 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cisetgid[=gid] 528c2ecf20Sopenharmony_ci Same as above, but for gid. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cimode=mode 558c2ecf20Sopenharmony_ci Sets the mode flags to the given (octal) value, regardless 568c2ecf20Sopenharmony_ci of the original permissions. Directories will get an x 578c2ecf20Sopenharmony_ci permission if the corresponding r bit is set. 588c2ecf20Sopenharmony_ci This is useful since most of the plain AmigaOS files 598c2ecf20Sopenharmony_ci will map to 600. 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cinofilenametruncate 628c2ecf20Sopenharmony_ci The file system will return an error when filename exceeds 638c2ecf20Sopenharmony_ci standard maximum filename length (30 characters). 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cireserved=num 668c2ecf20Sopenharmony_ci Sets the number of reserved blocks at the start of the 678c2ecf20Sopenharmony_ci partition to num. You should never need this option. 688c2ecf20Sopenharmony_ci Default is 2. 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ciroot=block 718c2ecf20Sopenharmony_ci Sets the block number of the root block. This should never 728c2ecf20Sopenharmony_ci be necessary. 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_cibs=blksize 758c2ecf20Sopenharmony_ci Sets the blocksize to blksize. Valid block sizes are 512, 768c2ecf20Sopenharmony_ci 1024, 2048 and 4096. Like the root option, this should 778c2ecf20Sopenharmony_ci never be necessary, as the affs can figure it out itself. 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ciquiet 808c2ecf20Sopenharmony_ci The file system will not return an error for disallowed 818c2ecf20Sopenharmony_ci mode changes. 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_civerbose 848c2ecf20Sopenharmony_ci The volume name, file system type and block size will 858c2ecf20Sopenharmony_ci be written to the syslog when the filesystem is mounted. 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cimufs 888c2ecf20Sopenharmony_ci The filesystem is really a muFS, also it doesn't 898c2ecf20Sopenharmony_ci identify itself as one. This option is necessary if 908c2ecf20Sopenharmony_ci the filesystem wasn't formatted as muFS, but is used 918c2ecf20Sopenharmony_ci as one. 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ciprefix=path 948c2ecf20Sopenharmony_ci Path will be prefixed to every absolute path name of 958c2ecf20Sopenharmony_ci symbolic links on an AFFS partition. Default = "/". 968c2ecf20Sopenharmony_ci (See below.) 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_civolume=name 998c2ecf20Sopenharmony_ci When symbolic links with an absolute path are created 1008c2ecf20Sopenharmony_ci on an AFFS partition, name will be prepended as the 1018c2ecf20Sopenharmony_ci volume name. Default = "" (empty string). 1028c2ecf20Sopenharmony_ci (See below.) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ciHandling of the Users/Groups and protection flags 1058c2ecf20Sopenharmony_ci================================================= 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ciAmiga -> Linux: 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ciThe Amiga protection flags RWEDRWEDHSPARWED are handled as follows: 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci - R maps to r for user, group and others. On directories, R implies x. 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci - W maps to w. 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci - E maps to x. 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci - D is ignored. 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci - H, S and P are always retained and ignored under Linux. 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci - A is cleared when a file is written to. 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ciUser id and group id will be used unless set[gu]id are given as mount 1248c2ecf20Sopenharmony_cioptions. Since most of the Amiga file systems are single user systems 1258c2ecf20Sopenharmony_cithey will be owned by root. The root directory (the mount point) of the 1268c2ecf20Sopenharmony_ciAmiga filesystem will be owned by the user who actually mounts the 1278c2ecf20Sopenharmony_cifilesystem (the root directory doesn't have uid/gid fields). 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ciLinux -> Amiga: 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ciThe Linux rwxrwxrwx file mode is handled as follows: 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci - r permission will allow R for user, group and others. 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci - w permission will allow W for user, group and others. 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci - x permission of the user will allow E for plain files. 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci - D will be allowed for user, group and others. 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci - All other flags (suid, sgid, ...) are ignored and will 1428c2ecf20Sopenharmony_ci not be retained. 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ciNewly created files and directories will get the user and group ID 1458c2ecf20Sopenharmony_ciof the current user and a mode according to the umask. 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ciSymbolic links 1488c2ecf20Sopenharmony_ci============== 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ciAlthough the Amiga and Linux file systems resemble each other, there 1518c2ecf20Sopenharmony_ciare some, not always subtle, differences. One of them becomes apparent 1528c2ecf20Sopenharmony_ciwith symbolic links. While Linux has a file system with exactly one 1538c2ecf20Sopenharmony_ciroot directory, the Amiga has a separate root directory for each 1548c2ecf20Sopenharmony_cifile system (for example, partition, floppy disk, ...). With the Amiga, 1558c2ecf20Sopenharmony_cithese entities are called "volumes". They have symbolic names which 1568c2ecf20Sopenharmony_cican be used to access them. Thus, symbolic links can point to a 1578c2ecf20Sopenharmony_cidifferent volume. AFFS turns the volume name into a directory name 1588c2ecf20Sopenharmony_ciand prepends the prefix path (see prefix option) to it. 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ciExample: 1618c2ecf20Sopenharmony_ciYou mount all your Amiga partitions under /amiga/<volume> (where 1628c2ecf20Sopenharmony_ci<volume> is the name of the volume), and you give the option 1638c2ecf20Sopenharmony_ci"prefix=/amiga/" when mounting all your AFFS partitions. (They 1648c2ecf20Sopenharmony_cimight be "User", "WB" and "Graphics", the mount points /amiga/User, 1658c2ecf20Sopenharmony_ci/amiga/WB and /amiga/Graphics). A symbolic link referring to 1668c2ecf20Sopenharmony_ci"User:sc/include/dos/dos.h" will be followed to 1678c2ecf20Sopenharmony_ci"/amiga/User/sc/include/dos/dos.h". 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ciExamples 1708c2ecf20Sopenharmony_ci======== 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ciCommand line:: 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci mount Archive/Amiga/Workbench3.1.adf /mnt -t affs -o loop,verbose 1758c2ecf20Sopenharmony_ci mount /dev/sda3 /Amiga -t affs 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/etc/fstab entry:: 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci /dev/sdb5 /amiga/Workbench affs noauto,user,exec,verbose 0 0 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ciIMPORTANT NOTE 1828c2ecf20Sopenharmony_ci============== 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ciIf you boot Windows 95 (don't know about 3.x, 98 and NT) while you 1858c2ecf20Sopenharmony_cihave an Amiga harddisk connected to your PC, it will overwrite 1868c2ecf20Sopenharmony_cithe bytes 0x00dc..0x00df of block 0 with garbage, thus invalidating 1878c2ecf20Sopenharmony_cithe Rigid Disk Block. Sheer luck has it that this is an unused 1888c2ecf20Sopenharmony_ciarea of the RDB, so only the checksum doesn't match anymore. 1898c2ecf20Sopenharmony_ciLinux will ignore this garbage and recognize the RDB anyway, but 1908c2ecf20Sopenharmony_cibefore you connect that drive to your Amiga again, you must 1918c2ecf20Sopenharmony_cirestore or repair your RDB. So please do make a backup copy of it 1928c2ecf20Sopenharmony_cibefore booting Windows! 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ciIf the damage is already done, the following should fix the RDB 1958c2ecf20Sopenharmony_ci(where <disk> is the device name). 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ciDO AT YOUR OWN RISK:: 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci dd if=/dev/<disk> of=rdb.tmp count=1 2008c2ecf20Sopenharmony_ci cp rdb.tmp rdb.fixed 2018c2ecf20Sopenharmony_ci dd if=/dev/zero of=rdb.fixed bs=1 seek=220 count=4 2028c2ecf20Sopenharmony_ci dd if=rdb.fixed of=/dev/<disk> 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ciBugs, Restrictions, Caveats 2058c2ecf20Sopenharmony_ci=========================== 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ciQuite a few things may not work as advertised. Not everything is 2088c2ecf20Sopenharmony_citested, though several hundred MB have been read and written using 2098c2ecf20Sopenharmony_cithis fs. For a most up-to-date list of bugs please consult 2108c2ecf20Sopenharmony_cifs/affs/Changes. 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ciBy default, filenames are truncated to 30 characters without warning. 2138c2ecf20Sopenharmony_ci'nofilenametruncate' mount option can change that behavior. 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ciCase is ignored by the affs in filename matching, but Linux shells 2168c2ecf20Sopenharmony_cido care about the case. Example (with /wb being an affs mounted fs):: 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci rm /wb/WRONGCASE 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ciwill remove /mnt/wrongcase, but:: 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci rm /wb/WR* 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ciwill not since the names are matched by the shell. 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ciThe block allocation is designed for hard disk partitions. If more 2278c2ecf20Sopenharmony_cithan 1 process writes to a (small) diskette, the blocks are allocated 2288c2ecf20Sopenharmony_ciin an ugly way (but the real AFFS doesn't do much better). This 2298c2ecf20Sopenharmony_ciis also true when space gets tight. 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ciYou cannot execute programs on an OFS (Old File System), since the 2328c2ecf20Sopenharmony_ciprogram files cannot be memory mapped due to the 488 byte blocks. 2338c2ecf20Sopenharmony_ciFor the same reason you cannot mount an image on such a filesystem 2348c2ecf20Sopenharmony_civia the loopback device. 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ciThe bitmap valid flag in the root block may not be accurate when the 2378c2ecf20Sopenharmony_cisystem crashes while an affs partition is mounted. There's currently 2388c2ecf20Sopenharmony_cino way to fix a garbled filesystem without an Amiga (disk validator) 2398c2ecf20Sopenharmony_cior manually (who would do this?). Maybe later. 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ciIf you mount affs partitions on system startup, you may want to tell 2428c2ecf20Sopenharmony_cifsck that the fs should not be checked (place a '0' in the sixth field 2438c2ecf20Sopenharmony_ciof /etc/fstab). 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ciIt's not possible to read floppy disks with a normal PC or workstation 2468c2ecf20Sopenharmony_cidue to an incompatibility with the Amiga floppy controller. 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ciIf you are interested in an Amiga Emulator for Linux, look at 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_cihttp://web.archive.org/web/%2E/http://www.freiburg.linux.de/~uae/ 251