FAT filesystem and Linux: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
m Dating maintenance tags: {{Cleanup HTML}}
Sir Dirt (talk | contribs)
HTML <tt> tag cleanup
Line 1:
[[Linux]] has several [[filesystem]] drivers for the [[File Allocation Table]] (FAT) filesystem format. These are commonly known by the names used in the <ttcode>[[mount (Unix)|mount]]</ttcode> command to invoke particular drivers in the kernel: ''msdos'', ''vfat'', and ''umsdos''.<ref name="StanfieldSmith">{{cite book |title=Linux system administration |series=Craig Hunt Linux library |author-first1=Vicki |author-last1=Stanfield |author-first2=Roderick W. |author-last2=Smith |edition=2nd |publisher=[[John Wiley and Sons]] |year=2002 |isbn=978-0-7821-4138-2 |pages=166}}</ref><ref name="Ward">{{cite book |title=How Linux works: what every superuser should know |series=No Starch Press Series |author-first=Brian |author-last=Ward |publisher=[[No Starch Press]] |year=2004 |isbn=978-1-59327-035-3 |pages=41}}</ref>
{{cleanup HTML|date=February 2019}}
[[Linux]] has several [[filesystem]] drivers for the [[File Allocation Table]] (FAT) filesystem format. These are commonly known by the names used in the <tt>[[mount (Unix)|mount]]</tt> command to invoke particular drivers in the kernel: ''msdos'', ''vfat'', and ''umsdos''.<ref name="StanfieldSmith">{{cite book |title=Linux system administration |series=Craig Hunt Linux library |author-first1=Vicki |author-last1=Stanfield |author-first2=Roderick W. |author-last2=Smith |edition=2nd |publisher=[[John Wiley and Sons]] |year=2002 |isbn=978-0-7821-4138-2 |pages=166}}</ref><ref name="Ward">{{cite book |title=How Linux works: what every superuser should know |series=No Starch Press Series |author-first=Brian |author-last=Ward |publisher=[[No Starch Press]] |year=2004 |isbn=978-1-59327-035-3 |pages=41}}</ref>
 
== Differences, advantages, and disadvantages ==
Line 26 ⟶ 25:
 
== 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 <ttcode>-o</ttcode> option to the <ttcode>mount</ttcode> command):<ref name="Smith1"/><ref name="Smith2"/>
;<ttcode>uid</ttcode> and <ttcode>gid</ttcode>: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 <ttcode>/etc/passwd</ttcode> 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 <ttcode>mount</ttcode> command would be invoked as <syntaxhighlight lang="bash" inline>mount -t vfat -o uid=745,gid=15</syntaxhighlight>.<ref name="Smith1"/><ref name="Smith2"/> Linux filesystem drivers do not at present incorporate support for [[FAT file password|file/directory password]]s on FAT12/FAT16/FAT32 volumes and multi-user [[FAT file access rights|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]].<!-- not sure if REAL/32 supports owner-IDs on FAT32. If it does it would require certain tweaks as the owner-ID entry is used for the high-word of the cluster number on FAT32 volumes now -->
;<ttcode>umask</ttcode>: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 <ttcode>mount</ttcode> command would be invoked as <syntaxhighlight lang="bash" inline>mount -t vfat -o umask=077</syntaxhighlight>.<ref name="Smith1"/><ref name="Smith2"/>
;<ttcode>conv</ttcode>: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 <ttcode>conv=b</ttcode> (for "binary"), <ttcode>conv=a</ttcode> (for "auto-detect"), and <ttcode>conv=t</ttcode> (for "text"), respectively. The latter two options carry an inherent risk of corrupting non-text file data. No conversion at all is the default.<ref name="Smith1"/><ref name="Smith2"/>
 
== {{anchor|--LINUX-.---}}Data structures of umsdos ==
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 <ttcode>--LINUX-.---</ttcode>.<ref name="StanfieldSmith"/><ref name="Smith1"/><ref name="McCune"/><ref name="Smith2"/><ref name="Danesh"/>
 
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 <ttcode>umssync</ttcode>.<ref name="StanfieldSmith"/><ref name="Smith1"/><ref name="McCune"/>
 
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 <ttcode>--LINUX-.---</ttcode> file. By default, the <ttcode>umssync</ttcode> tool creates <ttcode>--LINUX-.---</ttcode> 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 <ttcode>umssync</ttcode> 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 <ttcode>-c</ttcode> option to the command, which prevents the creation of any new <ttcode>--LINUX-.---</ttcode> files in directories that do not already possess them.<ref name="StanfieldSmith"/><ref name="Smith1"/><ref name="McCune"/>
 
== Installing Linux on and booting it from FAT volumes using umsdos ==
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 [[partition (computing)|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.<ref name="McCune"/>
 
The convention for such an installation is for the Linux [[root directory]] to be a subdirectory of the actual root directory of the DOS [[system partition and boot partition|boot volume]], e.g. <ttcode>C:\LINUX</ttcode> . The various Linux top-level directories are thus, to DOS, directories such as <ttcode>C:\LINUX\ETC</ttcode> (for <ttcode>/etc</ttcode>), <ttcode>C:\LINUX\BIN</ttcode> (for <ttcode>/bin</ttcode>), <ttcode>C:\LINUX\LIB</ttcode> (for <ttcode>/lib</ttcode>), and so forth. The ''umsdos'' filesystem driver automatically prepends the <ttcode>C:\LINUX\</ttcode> 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 <ttcode>loadlin</ttcode> command. So, for example, for the aforegiven root directory <ttcode>loadlin</ttcode> would be invoked with a command line such as <syntaxhighlight inline lang="dos">loadlin c:\linux\boot\vmlinuz rw root=c:\linux</syntaxhighlight> .<ref name="McCune"/><ref name="Danesh">{{cite book |title=Making Linux work: essential tips &amp; techniques |series=1001 Tips Series |author-first=Arman |author-last=Danesh |publisher=Cengage Learning |year=2002 |isbn= 978-1-884133-78-7 |pages=19}}</ref>
 
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.<ref name="McCune"/>
 
== Development history and kernel/distribution 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.<ref name="Smith2">{{cite book |title=The multi-boot configuration handbook |series=Handbook Series |author-first=Roderick W. |author-last=Smith |publisher=[[Que Publishing]] |year=2000 |isbn=978-0-7897-2283-6 |pages=256,341&ndash;342}}</ref> These include distributions such as Phat Linux, which installs in <ttcode>C:\PHAT</ttcode> on DOS by unpacking a [[ZIP file]] and is booted by running a [[COMMAND.COM]] script named <ttcode>LINUX.BAT</ttcode>,<ref name="McCune"/> and [[ZipSlack]]{{Citation needed|date=September 2009}}.
 
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|date=September 2009}} UMSDOS was removed from the Linux 2.6.11 kernel for lack of maintenance.<ref>{{Cite web |title=Summary of changes from v2.6.10 to v2.6.11 |url=https://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.11|website=www.kernel.org |access-date=2017-11-15}}</ref> UVFAT, an extension of UMSDOS to use the Windows data structures for long filenames instead of its own, was discontinued before release.<ref>{{Cite web |title=UMSDOS filesystem: UVFAT support |url=http://linux.voyager.hr/umsdos/#uvfat |website=linux.voyager.hr |access-date=2015-07-16}}</ref> They should work in 2.4.x kernels.{{Citation needed|date=September 2009}}