1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
|
.\"
.\" Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2021 Oxide Computer Company
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.Dd November 29, 2021
.Dt PCFS 7FS
.Os
.Sh NAME
.Nm pcfs
.Nd FAT formatted file system
.Sh SYNOPSIS
.In sys/param.h
.In sys/mount.h
.In sys/fs/pc_fs.h
.Ft int
.Fo mount
.Fa "const char *spec"
.Fa "const char *dir"
.Fa "int mflag"
.Fa \(dqpcfs\(dq
.Fa NULL
.Fa 0
.Fa "const char *optptr"
.Fa "int optlen"
.Fc
.Sh DESCRIPTION
.Nm
is a file system type that enables direct access to files on FAT formatted disks
from within the SunOS operating system.
.Pp
Once mounted,
.Nm
provides standard file operations and semantics.
Using
.Nm
you can create, delete, read, and write files on a FAT formatted disk.
You can also create and delete directories and list files in a directory.
.Pp
.Nm
supports FAT12 (floppies) and FAT16 and FAT32 file systems.
.Pp
.Nm
file systems can be force umounted using the
.Fl -f
argument to
.Xr umount 1M .
.Pp
The
.Nm
file system contained on the block special file identified by
.Fa spec
is mounted on the directory identified by
.Fa dir .
.Fa spec
and
.Fa dir
are pointers to pathnames.
.Fa mflag
specifies the
.Fa mount
options.
The
.Dv MS_DATA
bit in
.Fa mflag
must be set.
Mount options can be passed to
.Nm
using the optptr and optlen arguments.
See
.Xr mount_pcfs 1M
for a list of mount options supported by
.Nm
.Pp
Because FAT formatted media can record file timestamps between January 1st 1980
and December 31st 2127, it's not possible to fully represent UNIX
.Vt time_t
in
.Nm
for 32 bit or 64 bit programs.
In particular, if post-2038 timestamps are present on a FAT formatted medium and
.Nm
returns these, 32bit applications may unexpectedly fail with
.Er EOVERFLOW
errors.
To prevent this, the default behaviour of
.Nm
has been modified to clamp
post-2038 timestamps to the latest possible value for a 32bit
.Vt time_t ,
which is January 19th 2038, 03:14:06 UTC when setting and retrieving file
timestamps.
You can override this behavior using the
.Ar noclamptime
mount option, as described in
.Xr mount_pcfs 1M .
.Pp
Timestamps on FAT formatted media are recorded in local time.
If the recording and receiving systems use different timezones, the
representation of timestamps shown on the two systems for the same medium might
vary.
To correct this,
.Nm
provides a timezone mount option to force interpretation
of timestamps as read from a FAT formatted medium in a given timezone
.Pq that of the recorder .
By default, the local timezone of the receiver is used.
See
.Xr mount_pcfs 1M
for details.
.Pp
The root directory of a FAT formatted medium has no timestamps and
.Nm
returns the time when the mount was done as timestamp for the root of the
filesystem.
.Pp
The FAT filesystem doesn't support multiple links.
As a result, the link count
for all files and directories in
.Nm
is hard-coded as
.Dq 1 .
.Ss Mounting File Systems
Use the following command to mount
.Nm
from diskette:
.Bd -literal -offset indent
mount -F pcfs device-special directory-name
.Ed
.Pp
You can use:
.Bd -literal -offset indent
mount directory-name
.Ed
if the following line is in your
.Pa /etc/vfstab
file:
.Bd -literal -offset indent
device-special - directory-name pcfs - no rw
.Ed
.Pp
Use the following command to mount
.Nm
from non-diskette media:
.Bd -literal -offset indent
mount -F pcfs device-special:logical-drive directory-name
.Ed
.Pp
You can use:
.Bd -literal -offset indent
mount directory-name
.Ed
if the following line is in your
.Pa /etc/vfstab
file:
.Bd -literal -offset indent
device-special:logical_drive - directory-name pcfs - no rw
.Ed
.Pp
.Ar device-special
specifies the special block device file for the diskette
.Pq Pa /dev/disketteN
or the entire hard disk
.Po
Pa /dev/dsk/cNtNdNp0
for a SCSI, SATA, NVME disk, and
.Pa /dev/dsk/cNdNp0
for IDE disks
.Pc
or the PCMCIA pseudo-floppy memory card
.Pq Pa /dev/dsk/cNtNdNsN .
.Pp
.Ar logical-drive
specifies either the DOS logical drive letter
.Po
.Sy c
through
.Sy z
.Pc
or a drive number
.Pq 1 through 24 .
Drive letter
.Sy c
is equivalent to drive number
.Sy 1
and represents the Primary DOS partition on the disk; drive letters
.Sy d
through
.Sy z
are equivalent to drive numbers
.Sy 2
through
.Sy 24 ,
and represent DOS drives within the Extended FAT partition.
Note that
.Ar device-special
and
.Ar logical-drive
must be separated by a colon.
.Pp
.Ar directory-name
specifies the location where the file system is mounted.
.Pp
For example, to mount the Primary DOS partition from a SCSI hard disk,
use:
.Bd -literal -offset indent
mount -F pcfs /dev/dsk/cNtNdNp0:c /pcfs/c
.Ed
.Pp
To mount the first logical drive in the Extended DOS partition from an IDE hard
disk, use:
.Bd -literal -offset indent
mount -F pcfs /dev/dsk/cNdNp0:d /pcfs/d
.Ed
.Pp
To mount a DOS diskette in the first floppy drive when volume management is not
running use:
.Bd -literal -offset indent
mount -F pcfs /dev/diskette /pcfs/a
.Ed
.Pp
If Volume Management is running, run
.Xr volcheck 1
to automatically mount the floppy and some removable disks.
.Pp
To mount a PCMCIA pseudo-floppy memory card, with Volume Management not running
.Pq or not managing the PCMCIA media ,
use:
.Bd -literal -offset indent
mount -F pcfs /dev/dsk/cNtNdNsN /pcfs
.Ed
.Ss "Conventions"
Files and directories created through
.Nm
must comply with either the FAT short file name convention or the long file name
convention introduced with Windows 95.
The FAT short file name convention is of the form
.Pa filename[.ext] ,
where
.Em filename
generally consists of from one to eight upper-case characters, while the
optional
.Em ext
consists of from one to three upper-case characters.
.Pp
The long file name convention is much closer to illumos file names.
A long file name can consist of any characters valid in a short file name,
lowercase letters, non-leading spaces, the characters
.Sy +,;=[] ,
any number of periods, and can be up to 255 characters long.
Long file names have an associated short file name for systems that do not
support long file names.
The short file name is not visible if the system recognizes long file names.
.Nm
generates a unique short name automatically when creating a long file name.
.Pp
Given a long file name such as
.Pa This is a really long filename.TXT ,
the short file name will generally be of the form
.Pa THISIS~N\&.TXT ,
where
.Em N
is a number.
The long file name will probably get the short name
.Pa THISIS~1.TXT ,
or
.Pa THISIS~2.TXT
if
.Pa THISIS~1.TXT
already exits
.Po or
.Pa THISIS~3.TXT
if both exist, and so forth
.Pc .
If you use
.Nm
file systems on systems that do not support long file names, you may want to
continue following the short file name conventions.
See
.Sx EXAMPLES .
.Pp
When creating a file name,
.Nm
creates a short file name if it fits the FAT short file name format, otherwise
it creates a long file name.
This is because long file names take more directory space.
Because the root directory of a
.Nm
file system is fixed size, long file names in the root directory should be
avoided if possible.
.Pp
When displaying file names,
.Nm
shows them exactly as they are on the media.
This means that short names are displayed as uppercase and long file names
retain their case.
Earlier versions of
.Nm
folded all names to lowercase, which can be forced with the
.Dv PCFS_MNT_FOLDCASE
mount option.
All file name searches within
.Nm ,
however, are treated as if they were uppercase, so
.Pa readme.txt
and
.Pa ReAdMe.TxT
refer to the same file.
.Pp
To format a diskette or a PCMCIA pseudo-floppy memory card in FAT format in the
SunOS system, use either the
.Xr fdformat 1
.Fl -d
or the DOS
.Sy FORMAT
command.
.Ss Boot Partitions
On x86 systems, hard drives may contain an fdisk partition reserved for the boot
utilities.
The most common case is the EFI system partition.
These partitions are special instances of
.Nm .
You can mount an x86 boot partition with the command:
.Bd -literal -offset indent
mount -F pcfs device-special:boot directory-name
.Ed
or you can use:
.Bd -literal -offset indent
mount directory-name
.Ed
if the following line is in your
.Pa /etc/vfstab
file:
.Bd -literal -offset indent
device-special:boot - directory-name pcfs - no rw
.Ed
.Pp
.Ar device-special
specifies the special block device file for the entire hard disk
.Pq Pa /dev/dsk/cNtNdNp0
.Pp
.Ar directory-name
specifies the location where the file system is mounted.
.Pp
All files on a boot partition are owned by super-user.
Only the super-user may create, delete, or modify files on a boot partition.
.Sh ENVIRONMENT
See
.Xr environ 5
for descriptions of the following environment variables
for the current locale setting:
.Ev LANG ,
.Ev LC_ALL ,
.Ev LC_CTYPE ,
and
.Ev LC_COLLATE .
.Sh FILES
.Bl -tag -width Pa
.It Pa /usr/lib/fs/pcfs/mount
.Nm
mount command.
.It Pa /usr/kernel/fs/amd64/pcfs
64-bit kernel module (x86).
.El
.Sh EXAMPLES
.Sy Example 1
Sample Displays of File Names
.Pp
If you copy a file
.Pa financial.data
from a UNIX file system to
.Nm ,
it displays as
.Pa financial.data
in
.Nm
but may show up as
.Pa FINANC~1.DAT
in systems that do not support long file names.
.Pp
The following are legal long file names.
They are also illegal short file names:
.Bl -item -offset indent
.It
.Pa test.sh.orig
.It
.Pa data+
.El
.Pp
Other systems that do not support long file names may see:
.Bl -item -offset indent
.It
.Pa TESTSH~1.ORI
.It
.Pa DATA~1
.It
.Pa LOGIN~1
.El
The short file name is generated from the initial characters of the long file
name, so differentiate names in the first few characters.
For example, these names:
.Bl -item -offset indent
.It
.Pa WorkReport.January.Data
.It
.Pa WorkReport.February.Data
.It
.Pa WorkReport.March.Data
.El
result in these short names, which are not distinguishable:
.Bl -item -offset indent
.It
.Pa WORKRE~1.DAT
.It
.Pa WORKRE~2.DAT
.It
.Pa WORKRE~2.DAT
.It
.Pa WORKRE~2.DAT
.It
.Pa WORKRE~13.DAT
.El
.Pp
These names, however:
.Bl -item -offset indent
.It
.Pa January.WorkReport.Data
.It
.Pa February.WorkReport.Data
.It
.Pa March.WorkReport.Data
.El
result in the more descriptive short names:
.Bl -item -offset indent
.It
.Pa JANUAR~1.DAT
.It
.Pa FEBRUA~1.DAT
.It
.Pa MARCHW~1.DAT
.El
.Sh SEE ALSO
.Xr chgrp 1 ,
.Xr chown 1 ,
.Xr dos2unix 1 ,
.Xr eject 1 ,
.Xr fdformat 1 ,
.Xr unix2dos 1 ,
.Xr volcheck 1 ,
.Xr mount 1M ,
.Xr mount_pcfs 1M ,
.Xr umount 1M ,
.Xr ctime 3C ,
.Xr vfstab 4 ,
.Xr environ 5
.Sh WARNINGS
Do not physically eject a FAT floppy while the device is mounted as
.Nm
If Volume Management is managing a device, use the
.Xr eject 1
command before physically removing media.
.Pp
When mounting
.Nm
on a hard disk, make sure the first block on that device contains a valid fdisk
partition table.
.Pp
Because
.Nm
has no provision for handling owner-IDs or group-IDs on files,
.Xr chown 1
or
.Xr chgrp 1
may generate various errors.
This is a limitation of
.Nm
but it should not cause problems other than error messages.
.Sh NOTES
Only the following characters are allowed in
.Nm
short file names and extensions:
.Bl -item -offset indent
.It
0-9
.It
A-Z
.It
$#&@!%()-{}<>`_^~|'
.It
.El
illumos and FAT use different character sets and have different
requirements for the text file format.
Use the
.Xr dos2unix 1
and
.Xr unix2dos 1
commands to convert files between them.
.Pp
.Nm
offers a convenient transportation vehicle for files between multiple systems.
Because the FAT disk format was designed for use under DOS, it does not operate
efficiently under illumos and should not be used as the format for a regular
local storage.
Instead, use ZFS for local storage within an illumos system.
.Pp
Although long file names can contain spaces
(just as in UNIX file names) ,
some utilities may be confused by them.
.Pp
When
.Nm
encounters long file names with non-ASCII characters, it converts such long file
names in Unicode scalar values into UTF-8 encoded filenames so that they are
legible and usable with any of illumos UTF-8 locales.
In the same context, when new file names with non-ASCII characters are created,
.Nm
expects that such file names are in UTF-8.
This feature increases the interoperability of
.Nm
on illumos with other operating
systems.
.Sh BUGS
.Nm
should handle the disk change condition in the same way that DOS does, so you do
not need to unmount the file system to change floppies.
|