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