FAT filesystem and Linux

Last updated

Linux has several filesystem drivers for the File Allocation Table (FAT) filesystem format. These are commonly known by the names used in the mount command to invoke particular drivers in the kernel: msdos, vfat, and umsdos. [1] [2]

Contents

History and support

Most of the major Linux distributions, including RedHat, SuSE, and Debian, do not employ umsdos to permit installation of Linux on a FAT disc volume. A few distributions do, however. [3] These include distributions such as Phat Linux, which installs in C:\PHAT on DOS by unpacking a ZIP file and is booted by running a COMMAND.COM script named LINUX.BAT, [4] and ZipSlack [ citation needed ].

The UMSDOS project was started in 1992 by Jacques Gelinas and made available to the net in January 1994 as a patch. It was included in the standard distribution starting with kernel 1.1.36.[ citation needed ] UMSDOS was removed from the Linux 2.6.11 kernel for lack of maintenance. [5] UVFAT, an extension of UMSDOS to use the Windows data structures for long filenames instead of its own, was discontinued before release. [6] They should work in 2.4.x kernels.[ citation needed ]

Earlier Linux distributions which used UMSDOS are MuLinux, [7] Monkey Linux [8] and Winlinux 2000. [9]

Feature comparison

All of the Linux filesystem drivers support all three FAT types, namely FAT12, FAT16 and FAT32. Where they differ is in the provision of support for long filenames, beyond the 8.3 filename structure of the original FAT filesystem format, and in the provision of Unix file semantics that do not exist as standard in the FAT filesystem format such as file permissions. [1] The filesystem drivers are mutually exclusive. Only one can be used to mount any given disk volume at any given time. Thus the choice among them is determined by what long filenames and Unix semantics they support and what use one wants to make of the disk volume. [10]

msdos

The msdos filesystem driver provides no extra Unix file semantics and no long filename support. If a FAT disk filesystem is mounted using this driver, only 8.3 filenames will be visible, no long filenames will be accessible, nor will any long filename data structures of any kind on the disk volume be maintained. The vfat filesystem driver provides long filename support using the same disk data structures that Microsoft Windows uses for VFAT long filename support on FAT format volumes, but it does not support any extra Unix file semantics. The umsdos filesystem driver provides long filename support, and extra Unix file semantics. However, it does so using on-disk data structures that are not recognized by any filesystem drivers for any operating systems other than Linux. [1] [2] [10] [11]

umsdos

The key advantage to umsdos out of the three is that it provides full Unix file semantics. Therefore, it can be used in situations where it is desirable to install Linux on and run it from a FAT disk volume, which require such semantics to be available. However, Linux installed on and running from such a disk volume is slower than Linux installed on and running from a disk volume formatted with, for example, the ext2 filesystem format. [1] [12] Further, unless a utility program is regularly run every time that one switches from running Windows to running Linux, certain changes made to files and directories on the disk by Windows will cause error messages about inaccessible files in Linux. [4]

vfat

vfat, although lacking full Unix file semantics and lacking the ability to have Linux installed on and running from a FAT disk volume, does not have the aforementioned disadvantages of umsdos when it comes to simply sharing data on a FAT disk volume between Linux and other operating systems such as Windows. Its data structures are the same as those used by Windows for VFAT long filenames, and it does not require running a synchronization utility in order to prevent Windows and Linux data structures from becoming disjointed. For this reason, it is the most appropriate of Linux's FAT filesystem drivers to use in the majority of situations. [1] [10] [4]

FS-DriverLong filenamesUnix file semanticsComment
msdosNoNo8.3 filenames only
vfatYesNoUses same data structures that Windows uses
umsdosYesYesCan host Linux; may need maintenance when switching OS

Commonalities

As mentioned previously, all of the Linux filesystem drivers support all of the three File Allocation Table sizes, 12-bit, 16-bit, and 32-bit. Other common features that they all support are various Linux mounting options (specified with the -o option to the mount command): [10] [3]

uid and gid
These two options tell the filesystem driver to set the (default, in the case of umsdos) owner user ID and group ID to be a single, specified, value for all files in the volume. Both IDs are specified as numeric values (as to be found in the /etc/passwd file). So, for example, to specify to the vfat filesystem driver that all files and directories are to have owner ID 745 and group ID 15, the mount command would be invoked as mount -t vfat -o uid=745,gid=15. [10] [3] Linux filesystem drivers do not at present incorporate support for file/directory passwords on FAT12/FAT16/FAT32 volumes and multi-user world/group/owner access permissions for read/write/delete/execute rights on FAT12/FAT16 volumes as implemented in various operating systems of the Digital Research family, including DR-DOS, PalmDOS, Novell DOS, OpenDOS, FlexOS, Concurrent DOS, Multiuser DOS, System Manager and REAL/32.
umask
This option sets the umask to apply globally to all files in the volume. For example, to specify to the vfat filesystem driver that no "group" or "other" access is to be allowed, the mount command would be invoked as mount -t vfat -o umask=077. [10] [3]
conv
This option specifies file content conversion semantics. It is possible for the filesystem drivers to convert the newline conventions in files, between LF termination and CRLF termination, on the fly as files are read and written. By default this conversion is entirely disabled. The filesystem drivers can perform conversion for some files, attempting to auto-detect what files to convert based upon the extension portion of the filename, or globally for all files. These three conversion levels are specified as conv=b (for "binary"), conv=a (for "auto-detect"), and conv=t (for "text"), respectively. The latter two options carry an inherent risk of corrupting non-text file data. No conversion at all is the default. [10] [3]

umsdos

Data structure

The umsdos FAT filesystem driver stores all of the extra information relating to Unix file semantics in what, to another FAT filesystem driver, appears to be just a normal file in each directory and subdirectory, named --LINUX-.---. [1] [10] [4] [3] [13]

In the absence of this file in any given directory, and thus by default, the umsdos filesystem driver provides the same semantics as the msdos filesystem driver does for the directory: only 8.3 filenames and no extra Unix file semantics. To enable the umsdos driver's extra abilities, it is necessary to create that file in the directory and synchronize its internal data with the normal FAT data for any existing entries already in the directory. This is done with a tool called umssync. [1] [10] [4]

This is the utility program that is run, across every directory on the disc volume, every time that one switches from running Windows to running Linux, in order for the umsdos filesystem driver to incorporate any changes made to files and directories by Windows into its private data structures in its --LINUX-.--- file. By default, the umssync tool creates --LINUX-.--- files in directories if they do not already exist, resulting in such a file in every directory in the disc volume. When switching between Windows and Linux this behaviour is not often considered desirable. Therefore, the normal mode of operation when invoking umssync after switching from Windows to Linux (which is usually done by running the tool at Linux boot time from a startup script) is to employ the -c option to the command, which prevents the creation of any new --LINUX-.--- files in directories that do not already possess them. [1] [10] [4]

Installing Linux on FAT

As mentioned, umsdos permits installing Linux on, and then bootstrapping and running it from, a FAT format disc volume. The advantage of this is that it permits the use of Linux on a computer where DOS is already installed, without requiring that the hard disc be repartitioned. Linux is not bootstrapped directly from a Volume Boot Record in such a scenario. Instead DOS is first bootstrapped, and loadlin or linld is used to then bootstrap Linux from DOS. [4]

The convention for such an installation is for the Linux root directory to be a subdirectory of the root directory of the DOS boot volume, e.g. C:\LINUX . The various Linux top-level directories are thus, to DOS, directories such as C:\LINUX\ETC (for /etc), C:\LINUX\BIN (for /bin), C:\LINUX\LIB (for /lib), and so forth. The umsdos filesystem driver automatically prepends the C:\LINUX\ to all pathnames. The location of the Linux root directory is supplied to the umsdos filesystem driver in the first place via an option to the loadlin command. So, for example, loadlin would be invoked with a command line such as loadlin c:\linux\boot\vmlinuz rw root=c:\linux . [4] [13]

The installation of Linux into such a directory in the first place simply involves unpacking files from an archive into that directory and its subdirectories. Such an installation also generally requires the use of a swap file rather than a swap partition for Linux, however this is related to the desire not to repartition the hard disc and unrelated to the umsdos filesystem driver per se. [4]

Accessing FAT formatted volumes without kernel support

Although the filesystem drivers in the kernel make it possible to access files and directories on FAT formatted volumes in the normal manner, it is also possible to do so without kernel driver support, using the utility programs that form the mtools utility suite. Like the vfat FAT filesystem driver, mountlo provides long filename support using the same disc data structures that Microsoft Windows uses. [3] [14] [15]

Alternately, one of the FUSE filesystem drivers may be used—FatFuse, FuseFat or mountlo. [16]

POSIX overlay filesystem

A modern equivalent of UMSDOS is POSIX Overlay Filesystem (posixovl). It works in FUSE. [17]

See also

Related Research Articles

<span class="mw-page-title-main">ISO 9660</span> File system for CD-R and CD-ROM optical discs

ISO 9660 is a file system for optical disc media. The file system is an international standard available from the International Organization for Standardization (ISO). Since the specification is available for anybody to purchase, implementations have been written for many operating systems.

ext2, or second extended file system, is a file system for the Linux kernel. It was initially designed by French software developer Rémy Card as a replacement for the extended file system (ext). Having been designed according to the same principles as the Berkeley Fast File System from BSD, it was the first commercial-grade filesystem for Linux.

File Allocation Table (FAT) is a file system developed for personal computers and was the default filesystem for MS-DOS and Windows 9x operating systems. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. The increase in disk drives capacity required three major variants: FAT12, FAT16 and FAT32. FAT was replaced with NTFS as the default file system on Microsoft operating systems starting with Windows XP. Nevertheless, FAT continues to be used on flash and other solid-state memory cards and modules, many portable and embedded devices because of its compatibility and ease of implementation.

<span class="mw-page-title-main">Disk partitioning</span> Creation of separate accessible storage areas on a secondary computer storage device

Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions. Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.

An 8.3 filename is a filename convention used by old versions of DOS and versions of Microsoft Windows prior to Windows 95 and Windows NT 3.5. It is also used in modern Microsoft operating systems as an alternate filename to the long filename for compatibility with legacy programs. The filename convention is limited by the FAT file system. Similar 8.3 file naming schemes have also existed on earlier CP/M, TRS-80, Atari, and some Data General and Digital Equipment Corporation minicomputer operating systems.

AmigaDOS is the disk operating system of the AmigaOS, which includes file systems, file and directory manipulation, the command-line interface, and file redirection.

<span class="mw-page-title-main">Virtual file system</span> Abstract layer on top of a more concrete file system

A virtual file system (VFS) or virtual filesystem switch is an abstract layer on top of a more concrete file system. The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way. A VFS can, for example, be used to access local and network storage devices transparently without the client application noticing the difference. It can be used to bridge the differences in Windows, classic Mac OS/macOS and Unix filesystems, so that applications can access files on local file systems of those types without having to know what type of file system they are accessing.

<span class="mw-page-title-main">Filename</span> Text string used to uniquely identify a computer file

A filename or file name is a name used to uniquely identify a computer file in a file system. Different file systems impose different restrictions on filename lengths.

fstab is a system file commonly found in the directory /etc on Unix and Unix-like computer systems. In Linux, it is part of the util-linux package. The fstab file typically lists all available disk partitions and other types of file systems and data sources that may not necessarily be disk-based, and indicates how they are to be initialized or otherwise integrated into the larger file system structure.

HFS Plus or HFS+ is a journaling file system developed by Apple Inc. It replaced the Hierarchical File System (HFS) as the primary file system of Apple computers with the 1998 release of Mac OS 8.1. HFS+ continued as the primary Mac OS X file system until it was itself replaced with the Apple File System (APFS), released with macOS High Sierra in 2017. HFS+ is also one of the formats supported by the iPod digital music player.

<span class="mw-page-title-main">File system</span> Format or program for storing files and directories

In computing, a file system or filesystem is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one large body of data with no way to tell where one piece of data stopped and the next began, or where any piece of data was located when it was time to retrieve it. By separating the data into pieces and giving each piece a name, the data are easily isolated and identified. Taking its name from the way a paper-based data management system is named, each group of data is called a "file". The structure and logic rules used to manage the groups of data and their names is called a "file system."

A file system API is an application programming interface through which a utility or user program requests services of a file system. An operating system may provide abstractions for accessing different file systems transparently.

In computer data storage, a volume or logical drive is a single accessible storage area with a single file system, typically resident on a single partition of a hard disk. Although a volume might be different from a physical disk drive, it can still be accessed with an operating system's logical interface. However, a volume differs from a partition.

Long filename (LFN) support is Microsoft's backward-compatible extension of the 8.3 filename naming scheme used in DOS. Long filenames can be more descriptive, including longer filename extensions such as .jpeg, .tiff, .html, and .xhtml that are common on other operating systems, rather than specialized shortened names such as .jpg, .tif, .htm, or .xht. The standard has been common with File Allocation Table (FAT) filesystems since its first implementation in Windows NT 3.5 of 1994.

The following tables compare general and technical information for a number of file systems.

exFAT is a file system introduced by Microsoft in 2006 and optimized for flash memory such as USB flash drives and SD cards. exFAT was proprietary until 28 August 2019, when Microsoft published its specification. Microsoft owns patents on several elements of its design.

The multi-stage booting process of Linux is in many ways similar to the BSD and other Unix-style boot processes, from which it derives.

In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an application program to interact with a device by using its device driver via standard input/output system calls. Using standard system calls simplifies many programming tasks, and leads to consistent user-space I/O mechanisms regardless of device features and functions.

The FAT file system is a file system used on MS-DOS and Windows 9x family of operating systems. It continues to be used on mobile devices and embedded systems, and thus is a well suited file system for data exchange between computers and devices of almost any type and age from 1981 through the present.

References

  1. 1 2 3 4 5 6 7 8 Stanfield, Vicki; Smith, Roderick W. (2002). Linux system administration. Craig Hunt Linux library (2nd ed.). John Wiley and Sons. p. 166. ISBN   978-0-7821-4138-2.
  2. 1 2 Ward, Brian (2004). How Linux works: what every superuser should know. No Starch Press Series. No Starch Press. p. 41. ISBN   978-1-59327-035-3.
  3. 1 2 3 4 5 6 7 Smith, Roderick W. (2000). The multi-boot configuration handbook. Handbook Series. Que Publishing. pp.  256, 341–342. ISBN   978-0-7897-2283-6.
  4. 1 2 3 4 5 6 7 8 9 McCune, Mike (2001). Integrating Linux and Windows. Open source technology series. Prentice Hall PTR. pp.  7–9. ISBN   978-0-13-030670-8.
  5. "Summary of changes from v2.6.10 to v2.6.11". www.kernel.org. Retrieved 2017-11-15.
  6. "UMSDOS filesystem: UVFAT support". linux.voyager.hr. Retrieved 2015-07-16.
  7. MuLinux Project
  8. Monkey Linux Explained
  9. The Linux/Windows combo: Use these resources to make it work
  10. 1 2 3 4 5 6 7 8 9 10 Roderick W. Smith (2005). Linux in a Windows world. O'Reilly Media, Inc. p. 449. ISBN   0-596-00758-2.
  11. Negus, Christopher (2007). Linux bible: boot up to Ubuntu, Fedora, KNOPPIX, Debian, SUSE, and 11 other distributions. Bible Series. John Wiley and Sons. pp.  159. ISBN   978-0-470-08279-9.
  12. Strobel, Stefan; Elling, Volker (1997). Linux, unleashing the workstation in your PC. The Complete Linux Kit, Rainer Maurer (3rd ed.). Springer. p. 43. ISBN   978-0-387-94880-5.
  13. 1 2 Danesh, Arman (2002). Making Linux work: essential tips & techniques. 1001 Tips Series. Cengage Learning. pp.  19. ISBN   978-1-884133-78-7.
  14. Rajagopal, Raj (2000). Multi-operating system networking: living with Unix, Netware, and NT. Auerbach Best Practices Series. CRC Press. pp.  25–21. ISBN   978-0-8493-9831-5.
  15. Welsh, Matt (2003). Running Linux. Essential Guide to Linux (4th ed.). O'Reilly Media, Inc. p. 405. ISBN   978-0-596-00272-5.
  16. "FUSE: NonNativeFileSystems". Archived from the original on 2015-09-15.
  17. "POSIX Overlay Filesystem".

Further reading