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