xref: /linux/Documentation/filesystems/affs.rst (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
176272168SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
276272168SMauro Carvalho Chehab
376272168SMauro Carvalho Chehab=============================
476272168SMauro Carvalho ChehabOverview of Amiga Filesystems
576272168SMauro Carvalho Chehab=============================
676272168SMauro Carvalho Chehab
776272168SMauro Carvalho ChehabNot all varieties of the Amiga filesystems are supported for reading and
876272168SMauro Carvalho Chehabwriting. The Amiga currently knows six different filesystems:
976272168SMauro Carvalho Chehab
1076272168SMauro Carvalho Chehab==============	===============================================================
1176272168SMauro Carvalho ChehabDOS\0		The old or original filesystem, not really suited for
1276272168SMauro Carvalho Chehab		hard disks and normally not used on them, either.
1376272168SMauro Carvalho Chehab		Supported read/write.
1476272168SMauro Carvalho Chehab
1576272168SMauro Carvalho ChehabDOS\1		The original Fast File System. Supported read/write.
1676272168SMauro Carvalho Chehab
1776272168SMauro Carvalho ChehabDOS\2		The old "international" filesystem. International means that
1876272168SMauro Carvalho Chehab		a bug has been fixed so that accented ("international") letters
1976272168SMauro Carvalho Chehab		in file names are case-insensitive, as they ought to be.
2076272168SMauro Carvalho Chehab		Supported read/write.
2176272168SMauro Carvalho Chehab
2276272168SMauro Carvalho ChehabDOS\3		The "international" Fast File System.  Supported read/write.
2376272168SMauro Carvalho Chehab
2476272168SMauro Carvalho ChehabDOS\4		The original filesystem with directory cache. The directory
2576272168SMauro Carvalho Chehab		cache speeds up directory accesses on floppies considerably,
2676272168SMauro Carvalho Chehab		but slows down file creation/deletion. Doesn't make much
2776272168SMauro Carvalho Chehab		sense on hard disks. Supported read only.
2876272168SMauro Carvalho Chehab
2976272168SMauro Carvalho ChehabDOS\5		The Fast File System with directory cache. Supported read only.
3076272168SMauro Carvalho Chehab==============	===============================================================
3176272168SMauro Carvalho Chehab
3276272168SMauro Carvalho ChehabAll of the above filesystems allow block sizes from 512 to 32K bytes.
3376272168SMauro Carvalho ChehabSupported block sizes are: 512, 1024, 2048 and 4096 bytes. Larger blocks
3476272168SMauro Carvalho Chehabspeed up almost everything at the expense of wasted disk space. The speed
3576272168SMauro Carvalho Chehabgain above 4K seems not really worth the price, so you don't lose too
3676272168SMauro Carvalho Chehabmuch here, either.
3776272168SMauro Carvalho Chehab
3876272168SMauro Carvalho ChehabThe muFS (multi user File System) equivalents of the above file systems
3976272168SMauro Carvalho Chehabare supported, too.
4076272168SMauro Carvalho Chehab
4176272168SMauro Carvalho ChehabMount options for the AFFS
4276272168SMauro Carvalho Chehab==========================
4376272168SMauro Carvalho Chehab
4476272168SMauro Carvalho Chehabprotect
4576272168SMauro Carvalho Chehab		If this option is set, the protection bits cannot be altered.
4676272168SMauro Carvalho Chehab
4776272168SMauro Carvalho Chehabsetuid[=uid]
4876272168SMauro Carvalho Chehab		This sets the owner of all files and directories in the file
4976272168SMauro Carvalho Chehab		system to uid or the uid of the current user, respectively.
5076272168SMauro Carvalho Chehab
5176272168SMauro Carvalho Chehabsetgid[=gid]
5276272168SMauro Carvalho Chehab		Same as above, but for gid.
5376272168SMauro Carvalho Chehab
5476272168SMauro Carvalho Chehabmode=mode
5576272168SMauro Carvalho Chehab		Sets the mode flags to the given (octal) value, regardless
5676272168SMauro Carvalho Chehab		of the original permissions. Directories will get an x
5776272168SMauro Carvalho Chehab		permission if the corresponding r bit is set.
5876272168SMauro Carvalho Chehab		This is useful since most of the plain AmigaOS files
5976272168SMauro Carvalho Chehab		will map to 600.
6076272168SMauro Carvalho Chehab
6176272168SMauro Carvalho Chehabnofilenametruncate
6276272168SMauro Carvalho Chehab		The file system will return an error when filename exceeds
6376272168SMauro Carvalho Chehab		standard maximum filename length (30 characters).
6476272168SMauro Carvalho Chehab
6576272168SMauro Carvalho Chehabreserved=num
6676272168SMauro Carvalho Chehab		Sets the number of reserved blocks at the start of the
6776272168SMauro Carvalho Chehab		partition to num. You should never need this option.
6876272168SMauro Carvalho Chehab		Default is 2.
6976272168SMauro Carvalho Chehab
7076272168SMauro Carvalho Chehabroot=block
7176272168SMauro Carvalho Chehab		Sets the block number of the root block. This should never
7276272168SMauro Carvalho Chehab		be necessary.
7376272168SMauro Carvalho Chehab
7476272168SMauro Carvalho Chehabbs=blksize
7576272168SMauro Carvalho Chehab		Sets the blocksize to blksize. Valid block sizes are 512,
7676272168SMauro Carvalho Chehab		1024, 2048 and 4096. Like the root option, this should
7776272168SMauro Carvalho Chehab		never be necessary, as the affs can figure it out itself.
7876272168SMauro Carvalho Chehab
7976272168SMauro Carvalho Chehabquiet
8076272168SMauro Carvalho Chehab		The file system will not return an error for disallowed
8176272168SMauro Carvalho Chehab		mode changes.
8276272168SMauro Carvalho Chehab
8376272168SMauro Carvalho Chehabverbose
8476272168SMauro Carvalho Chehab		The volume name, file system type and block size will
8576272168SMauro Carvalho Chehab		be written to the syslog when the filesystem is mounted.
8676272168SMauro Carvalho Chehab
8776272168SMauro Carvalho Chehabmufs
8876272168SMauro Carvalho Chehab		The filesystem is really a muFS, also it doesn't
8976272168SMauro Carvalho Chehab		identify itself as one. This option is necessary if
9076272168SMauro Carvalho Chehab		the filesystem wasn't formatted as muFS, but is used
9176272168SMauro Carvalho Chehab		as one.
9276272168SMauro Carvalho Chehab
9376272168SMauro Carvalho Chehabprefix=path
9476272168SMauro Carvalho Chehab		Path will be prefixed to every absolute path name of
9576272168SMauro Carvalho Chehab		symbolic links on an AFFS partition. Default = "/".
9676272168SMauro Carvalho Chehab		(See below.)
9776272168SMauro Carvalho Chehab
9876272168SMauro Carvalho Chehabvolume=name
9976272168SMauro Carvalho Chehab		When symbolic links with an absolute path are created
10076272168SMauro Carvalho Chehab		on an AFFS partition, name will be prepended as the
10176272168SMauro Carvalho Chehab		volume name. Default = "" (empty string).
10276272168SMauro Carvalho Chehab		(See below.)
10376272168SMauro Carvalho Chehab
10476272168SMauro Carvalho ChehabHandling of the Users/Groups and protection flags
10576272168SMauro Carvalho Chehab=================================================
10676272168SMauro Carvalho Chehab
10776272168SMauro Carvalho ChehabAmiga -> Linux:
10876272168SMauro Carvalho Chehab
10976272168SMauro Carvalho ChehabThe Amiga protection flags RWEDRWEDHSPARWED are handled as follows:
11076272168SMauro Carvalho Chehab
11176272168SMauro Carvalho Chehab  - R maps to r for user, group and others. On directories, R implies x.
11276272168SMauro Carvalho Chehab
113*d3a84a8dSMax Staudt  - W maps to w.
11476272168SMauro Carvalho Chehab
11576272168SMauro Carvalho Chehab  - E maps to x.
11676272168SMauro Carvalho Chehab
117*d3a84a8dSMax Staudt  - D is ignored.
11876272168SMauro Carvalho Chehab
119*d3a84a8dSMax Staudt  - H, S and P are always retained and ignored under Linux.
120*d3a84a8dSMax Staudt
121*d3a84a8dSMax Staudt  - A is cleared when a file is written to.
12276272168SMauro Carvalho Chehab
12376272168SMauro Carvalho ChehabUser id and group id will be used unless set[gu]id are given as mount
12476272168SMauro Carvalho Chehaboptions. Since most of the Amiga file systems are single user systems
12576272168SMauro Carvalho Chehabthey will be owned by root. The root directory (the mount point) of the
12676272168SMauro Carvalho ChehabAmiga filesystem will be owned by the user who actually mounts the
12776272168SMauro Carvalho Chehabfilesystem (the root directory doesn't have uid/gid fields).
12876272168SMauro Carvalho Chehab
12976272168SMauro Carvalho ChehabLinux -> Amiga:
13076272168SMauro Carvalho Chehab
13176272168SMauro Carvalho ChehabThe Linux rwxrwxrwx file mode is handled as follows:
13276272168SMauro Carvalho Chehab
133*d3a84a8dSMax Staudt  - r permission will allow R for user, group and others.
13476272168SMauro Carvalho Chehab
135*d3a84a8dSMax Staudt  - w permission will allow W for user, group and others.
13676272168SMauro Carvalho Chehab
137*d3a84a8dSMax Staudt  - x permission of the user will allow E for plain files.
138*d3a84a8dSMax Staudt
139*d3a84a8dSMax Staudt  - D will be allowed for user, group and others.
14076272168SMauro Carvalho Chehab
14176272168SMauro Carvalho Chehab  - All other flags (suid, sgid, ...) are ignored and will
14276272168SMauro Carvalho Chehab    not be retained.
14376272168SMauro Carvalho Chehab
14476272168SMauro Carvalho ChehabNewly created files and directories will get the user and group ID
14576272168SMauro Carvalho Chehabof the current user and a mode according to the umask.
14676272168SMauro Carvalho Chehab
14776272168SMauro Carvalho ChehabSymbolic links
14876272168SMauro Carvalho Chehab==============
14976272168SMauro Carvalho Chehab
15076272168SMauro Carvalho ChehabAlthough the Amiga and Linux file systems resemble each other, there
15176272168SMauro Carvalho Chehabare some, not always subtle, differences. One of them becomes apparent
15276272168SMauro Carvalho Chehabwith symbolic links. While Linux has a file system with exactly one
15376272168SMauro Carvalho Chehabroot directory, the Amiga has a separate root directory for each
15476272168SMauro Carvalho Chehabfile system (for example, partition, floppy disk, ...). With the Amiga,
15576272168SMauro Carvalho Chehabthese entities are called "volumes". They have symbolic names which
15676272168SMauro Carvalho Chehabcan be used to access them. Thus, symbolic links can point to a
15776272168SMauro Carvalho Chehabdifferent volume. AFFS turns the volume name into a directory name
15876272168SMauro Carvalho Chehaband prepends the prefix path (see prefix option) to it.
15976272168SMauro Carvalho Chehab
16076272168SMauro Carvalho ChehabExample:
16176272168SMauro Carvalho ChehabYou mount all your Amiga partitions under /amiga/<volume> (where
16276272168SMauro Carvalho Chehab<volume> is the name of the volume), and you give the option
16376272168SMauro Carvalho Chehab"prefix=/amiga/" when mounting all your AFFS partitions. (They
16476272168SMauro Carvalho Chehabmight be "User", "WB" and "Graphics", the mount points /amiga/User,
16576272168SMauro Carvalho Chehab/amiga/WB and /amiga/Graphics). A symbolic link referring to
16676272168SMauro Carvalho Chehab"User:sc/include/dos/dos.h" will be followed to
16776272168SMauro Carvalho Chehab"/amiga/User/sc/include/dos/dos.h".
16876272168SMauro Carvalho Chehab
16976272168SMauro Carvalho ChehabExamples
17076272168SMauro Carvalho Chehab========
17176272168SMauro Carvalho Chehab
17276272168SMauro Carvalho ChehabCommand line::
17376272168SMauro Carvalho Chehab
17476272168SMauro Carvalho Chehab    mount  Archive/Amiga/Workbench3.1.adf /mnt -t affs -o loop,verbose
17576272168SMauro Carvalho Chehab    mount  /dev/sda3 /Amiga -t affs
17676272168SMauro Carvalho Chehab
17776272168SMauro Carvalho Chehab/etc/fstab entry::
17876272168SMauro Carvalho Chehab
17976272168SMauro Carvalho Chehab    /dev/sdb5	/amiga/Workbench    affs    noauto,user,exec,verbose 0 0
18076272168SMauro Carvalho Chehab
18176272168SMauro Carvalho ChehabIMPORTANT NOTE
18276272168SMauro Carvalho Chehab==============
18376272168SMauro Carvalho Chehab
18476272168SMauro Carvalho ChehabIf you boot Windows 95 (don't know about 3.x, 98 and NT) while you
18576272168SMauro Carvalho Chehabhave an Amiga harddisk connected to your PC, it will overwrite
18676272168SMauro Carvalho Chehabthe bytes 0x00dc..0x00df of block 0 with garbage, thus invalidating
18776272168SMauro Carvalho Chehabthe Rigid Disk Block. Sheer luck has it that this is an unused
18876272168SMauro Carvalho Chehabarea of the RDB, so only the checksum doesn't match anymore.
18976272168SMauro Carvalho ChehabLinux will ignore this garbage and recognize the RDB anyway, but
19076272168SMauro Carvalho Chehabbefore you connect that drive to your Amiga again, you must
19176272168SMauro Carvalho Chehabrestore or repair your RDB. So please do make a backup copy of it
19276272168SMauro Carvalho Chehabbefore booting Windows!
19376272168SMauro Carvalho Chehab
19476272168SMauro Carvalho ChehabIf the damage is already done, the following should fix the RDB
19576272168SMauro Carvalho Chehab(where <disk> is the device name).
19676272168SMauro Carvalho Chehab
19776272168SMauro Carvalho ChehabDO AT YOUR OWN RISK::
19876272168SMauro Carvalho Chehab
19976272168SMauro Carvalho Chehab  dd if=/dev/<disk> of=rdb.tmp count=1
20076272168SMauro Carvalho Chehab  cp rdb.tmp rdb.fixed
20176272168SMauro Carvalho Chehab  dd if=/dev/zero of=rdb.fixed bs=1 seek=220 count=4
20276272168SMauro Carvalho Chehab  dd if=rdb.fixed of=/dev/<disk>
20376272168SMauro Carvalho Chehab
20476272168SMauro Carvalho ChehabBugs, Restrictions, Caveats
20576272168SMauro Carvalho Chehab===========================
20676272168SMauro Carvalho Chehab
20776272168SMauro Carvalho ChehabQuite a few things may not work as advertised. Not everything is
20876272168SMauro Carvalho Chehabtested, though several hundred MB have been read and written using
20976272168SMauro Carvalho Chehabthis fs. For a most up-to-date list of bugs please consult
21076272168SMauro Carvalho Chehabfs/affs/Changes.
21176272168SMauro Carvalho Chehab
21276272168SMauro Carvalho ChehabBy default, filenames are truncated to 30 characters without warning.
21376272168SMauro Carvalho Chehab'nofilenametruncate' mount option can change that behavior.
21476272168SMauro Carvalho Chehab
21576272168SMauro Carvalho ChehabCase is ignored by the affs in filename matching, but Linux shells
21676272168SMauro Carvalho Chehabdo care about the case. Example (with /wb being an affs mounted fs)::
21776272168SMauro Carvalho Chehab
21876272168SMauro Carvalho Chehab    rm /wb/WRONGCASE
21976272168SMauro Carvalho Chehab
22076272168SMauro Carvalho Chehabwill remove /mnt/wrongcase, but::
22176272168SMauro Carvalho Chehab
22276272168SMauro Carvalho Chehab    rm /wb/WR*
22376272168SMauro Carvalho Chehab
22476272168SMauro Carvalho Chehabwill not since the names are matched by the shell.
22576272168SMauro Carvalho Chehab
22676272168SMauro Carvalho ChehabThe block allocation is designed for hard disk partitions. If more
22776272168SMauro Carvalho Chehabthan 1 process writes to a (small) diskette, the blocks are allocated
22876272168SMauro Carvalho Chehabin an ugly way (but the real AFFS doesn't do much better). This
22976272168SMauro Carvalho Chehabis also true when space gets tight.
23076272168SMauro Carvalho Chehab
23176272168SMauro Carvalho ChehabYou cannot execute programs on an OFS (Old File System), since the
23276272168SMauro Carvalho Chehabprogram files cannot be memory mapped due to the 488 byte blocks.
23376272168SMauro Carvalho ChehabFor the same reason you cannot mount an image on such a filesystem
23476272168SMauro Carvalho Chehabvia the loopback device.
23576272168SMauro Carvalho Chehab
23676272168SMauro Carvalho ChehabThe bitmap valid flag in the root block may not be accurate when the
23776272168SMauro Carvalho Chehabsystem crashes while an affs partition is mounted. There's currently
23876272168SMauro Carvalho Chehabno way to fix a garbled filesystem without an Amiga (disk validator)
23976272168SMauro Carvalho Chehabor manually (who would do this?). Maybe later.
24076272168SMauro Carvalho Chehab
24176272168SMauro Carvalho ChehabIf you mount affs partitions on system startup, you may want to tell
24276272168SMauro Carvalho Chehabfsck that the fs should not be checked (place a '0' in the sixth field
24376272168SMauro Carvalho Chehabof /etc/fstab).
24476272168SMauro Carvalho Chehab
24576272168SMauro Carvalho ChehabIt's not possible to read floppy disks with a normal PC or workstation
24676272168SMauro Carvalho Chehabdue to an incompatibility with the Amiga floppy controller.
24776272168SMauro Carvalho Chehab
24876272168SMauro Carvalho ChehabIf you are interested in an Amiga Emulator for Linux, look at
24976272168SMauro Carvalho Chehab
25076272168SMauro Carvalho Chehabhttp://web.archive.org/web/%2E/http://www.freiburg.linux.de/~uae/
251