UMSDOS HOW-TO <author>Jacques Gelinas, <tt/jacques@solucorp.qc.ca/ <date>v1.2, 2001-12-01 <abstract> <em/Umsdos/ is a linux file system. It provide an alternative to the <em/EXT2/ file-system. Its main goal is to achieve easier coexistence with <em/Ms-DOS/ data by sharing the same partition. This document explain first how to use Umsdos in different configuration, and later explain its operation and try to provide some information letting you decide if it is a good choice for you (see UMSDOS-WHY-TO at the end). </abstract> <toc> <sect>Copyright and License <p> This document is Copyright (c) 1995 by Jacques Gelinas. <p> It is released under the terms of the GNU Free Documentation License. A copy of the license should have been distributed with it, or you can see a copy at <url url="http://www.fsf.org/licenses/fdl.html">. <sect>UMSDOS: Where is it ? <p> <sect1>Copyright and License <p> This document is Copyright (c) 1995, Jacques Gelinas. <p> It may be distributed under the GNU Free Documentation License. You should have received a copy with it. If not, you can view it at <url url="http://www.fsf.org/licenses/fdl.html">. <sect1>History <p> The <em/Umsdos/ project was started in 1992 and made available to the net in January 1994 as a patch. It was included in the standard kernel distribution in July, starting with kernel 1.1.36. <em/Umsdos/ was early adopted in the <em/Slackware/ distribution even before it was officially included in the official kernel. <em/Umsdos/ was improved starting at kernel 1.1.60. Its performance has been dramatically enhanced, especially for writing. Since 1.1.70 (around this), it is stable again. A major bug was solve in <em/Linux/ 1.2.2. This bug was causing some grief to users since the beginning (some file were silently renamed, giving the sad impression that they were deleted). Beware that <em/Slackware/ 2.2 is still shipping release 1.2.1 of the kernel, so has this bug. <sect1>Availability <p> It is available as a patch for kernel 1.0.x. It is built-in for kernel 1.2. It can be compiled in or load as a module. Beware that for now, if you intend to load <em/umsdos/ as a module, you must also use the Ms-DOS fs as a module. This come from a limitation in the module system (some symbols are only export when the drivers is installed as a module). <sect1>Distribution supporting it <p> So far, I think only <em/Slackware/ does support it. I am surely wrong, so please send me info to correct this. <sect1>Home site <p> The home site for <em/Umsdos/ is sunsite.unc.edu. Look in the directory <tt>/pub/Linux/system/Filesystems/umsdos</tt>. <sect1>Technical documentation <p> There is quite a lot of documentation about the internal of <em/Umsdos/. It is available both in <tt/HTML/ and text format at the same location as the utilities. As far as I know, the <tt/HTML/ version is not available online on any web site. You must down-load it and "UN-tar" it and read it locally. <sect1>Who wrote it <p> Jacques Gelinas jacques@solucorp.qc.ca <sect>Umsdos as your root partition <p> <sect1>The pseudo-root concept. <p> With <em/Umsdos/, <em/Linux/ can be installed in a standard DOS partition. <em/Linux/ is then installed as a second (or third) OS in the partition. To avoid name collision (there is maybe a bin or tmp directory in the drive C: already), <em/Umsdos/ use a smart trick: The pseudo-root. All <em/Linux/ files are installed in a DOS subdirectory called <tt/linux/, generally <tt/C: LINUX/. The normal <em>Linux/Unix</em> directory structure goes there. So you get <itemize> <item> <verb/C:\LINUX\BIN/ <item> <verb/C:\LINUX\ETC/ <item> <verb/C:\LINUX\LIB/ <item> <verb/C:\LINUX\ROOT/ <item> <verb/C:\LINUX\SBIN/ <item> <verb/C:\LINUX\TMP/ <item> <verb/C:\LINUX\USR/ <item> <verb/C:\LINUX\VAR/ </itemize> When the <em/Umsdos/ boot, it probes for the directory <tt/linux/ and then <tt>/linux/etc</tt>. If it exist, it activates the pseudo-root mode. Mostly, the pseudo-root mode switch the root of the partition to <tt/C:\\LINUX/ giving the conventional <em/Unix/ directory layout <itemize> <item><verb>/bin</verb> <item><verb>/etc</verb> <item><verb>/lib</verb> <item><verb>/root</verb> <item><verb>/sbin</verb> <item><verb>/tmp</verb> <item><verb>/usr</verb> <item><verb>/var</verb> </itemize> To this list, it adds a new one called <tt/DOS/. This one is a virtual directory. <sect1>Things to know about the pseudo-root <p> <itemize> <item> This mode can only be triggered at boot time. There is no way to activate this by a mount command. <item> This mechanism is purely a different view of a normal <em/Umsdos/ file-system. This means that a partition normally used as a root partition can be normally mounted. There won't be any pseudo-root effect. For example, if you boot linux with a maintenance floppy and mount your normal root partition in <tt>/mnt</tt>, you will find all your linux directory in <tt>/mnt/linux/bin, /mnt/linux/etc</tt> and so on. </itemize> <sect>Different topics about the operation of <em/Umsdos/ <p> <sect1>Mount option <p> You can use the same mount option as for the Ms-DOS file system. The option conv= is questionable on a <em/Umsdos/ system. I suggest to avoid it. Mostly the option you may want to look at are <itemize> <item>uid= <item>gid= <item>umask= </itemize> Just remember that <em/Umsdos/ manage non promoted directory the same way as the <em/Ms-DOS/ file system. The option above will apply globally to all non promoted directory. <em/uid/ setup the default owner, <em/gid/ setup the default group and <em/umask/ setup the default permissions. <sect1>How to set defaults for the root <p> umssetup was created to provide at run time default ownership for the root partition. For other <em/Umsdos/ partition, mount option may be used or umssetup. Storing mount option in /etc/fstab is the prefered way for non root partition. Here is an example. Put this in /etc/rc.d/rc.S. <tscreen><verb> /sbin/umssetup -u jack -g group -m 0755 / </verb></tscreen> <sect1>To swap or not to swap <p> Using a swap file is generally slower than a swap partition. It is however much more flexible. You can setup a swap file in a <em/Umsdos/ partition the same way you do it for any other <em/Linux/ file systems. For example, to setup a 8 megabytes swap file in the root directory: <tscreen><verb> dd if=/dev/zero bs=1024k count=8 of=/swap mkswap /swap 8192 sync swapon /swap </verb></tscreen> Once done, you can put the following line in /etc/fstab <tscreen><verb> /swap swap swap default </verb></tscreen> And the swap file will be activated at each boot (There is generally a "swapon -a" in <tt>/etc/rc.d/rc.S</tt>). <sect>How to boot a Umsdos system <p> <sect1>Loadlin <p> The package lodlin15.tgz available from sunsite.unc.edu in <tt>/pub/Linux/system/Bootutils</tt>. This utility is particularly suited to boot a <em/Umsdos/ system. Generally all you need to do is <tscreen><verb> Boot DOS C:>loadlinx zimage root=D: </verb></tscreen> where zimage is a normal kernel image (compressed) simply copied somewhere in the DOS drive. <tt/D:/ is the DOS drive where you have installed <em/Linux/. <sect1>From a floppy <p> Booting a <em/Umsdos/ system from a floppy is not different from booting a <em/Ext2/ system. You need a kernel zImage file properly initialize to locate your root <em/Umsdos/ partition. This is generally achieved using the command <tt/rdev/. The following sequence will initialize a zImage and put it on a floppy. <tscreen><verb> rdev zImage /dev/hda1 rdev -R zImage 0 dd if=zImage bs=8192 of=/dev/fd0 </verb></tscreen> If this looks confusing, just format a boot-able DOS floppy and put the following component on it. <itemize> <item>loadlin.exe <item>loadlinx.exe <item>zimage </itemize> and setup the autoexec.bat like this <tscreen><verb> loadlinx zimage rw root=C: </verb></tscreen> <sect1>LILO <p> LILO, the official <em/Linux/ boot loader can also be used to boot a <em/Umsdos/ system. I have no experience with it though. Since 1.1.60, it should work. Please email if you know something. <sect1>How to defragment a <em/Umsdos/ partition <p> It can be done using any popular DOS tool. There is nothing particular about file produced by <em/Umsdos/. And <em/Umsdos/ do not expect anything particular (directory layout, directory entry sequence, etc...) from the file system under it. As far as I know, there is no <em/Linux/ tool to achieve this. <sect1>Advance tricks <p> <em/Umsdos/ rely on the <tt/--linux-.---/ which rely on the <em/DOS/ directory. Some users may want to experiment a bit. The utility <tt/udosctl/ part of the umsdos_progs package (containing <tt/umssync/ and <tt/umssetup/) allows basic directory operation (listing, deletion) independently on the <tt/--linux-.---/ and the <em/DOS/ directory. <sect>Basic principle <p> <sect1>Introduction <p> <em/Umsdos/ map <em/Linux/ files directly to <em/Ms-DOS/ files. This is a one for one translation. File content is not manipulated at all. <em/Umsdos/ only works on names. For special files (links and devices for example), it introduces special management. For each directory, there is a file named <tt/--linux-.---/. <sect1><em/Umsdos/ can replace the <em/Ms-DOS/ file-system. <p> <em/Umsdos/ can be thought as a general purpose superset of the <em/Ms-DOS/ file system of linux. In fact this capability or flexibility yields much confusion about <em/Umsdos/. Here is why. Try to mount a newly formatted <em/DOS/ floppy like this. <tscreen><verb> mount -t umsdos /dev/fd0 /mnt </verb></tscreen> And do this, <tscreen><verb> ls / >/mnt/LONGFILENAME ls -l /mnt </verb></tscreen> You will get the following result <tscreen><verb> -rwxr-xr-x 1 root root 302 Apr 14 23:25 longfile </verb></tscreen> So far, it seems that the <em/Umsdos/ file system does not do much more (in fact nothing at all) than the normal <em/Ms-DOS/ file system of <em/Linux/. <em/???/ <sect1>Directory promotion <p> Pretty unimpressive so far. Here is the trick. Unless promoted a <em/DOS/ directory will be managed the same way with <em/Umsdos/ than the <em/Ms-DOS/ file-system will. <em/Umsdos/ use a special file in each subdirectory to achieve the translation between the extended capabilities (long name, ownership, etc...) of <em/Umsdos/ and the limitation of the <em/DOS/ file-system. This file is invisible to <em/Umsdos/ users, but visible when you boot <em/DOS/. To avoid cluttering the <em/DOS/ partition with those file (<tt/--linux-.---/) uselessly, the file is now optional. If absent, <em/Umsdos/ behave like <em/Ms-DOS/. When a directory is promoted, any subsequent operation will be done with the full semantic normally available to <em/Unix/ and <em/Linux/ users. And all subdirectory created afterward will be silently promoted. This feature allows you to logically organize your <em/DOS/ partition into <em/DOS/ stuff and <em/Linux/ stuff. It is important to understand that those <tt/--linux-.---/ file do take some place (generally 2k per directory). <em/DOS/ generally use large cluster (as big as 16k for a 500meg partition), so avoiding putting <tt/--linux-.---/ everywhere can save your day. <sect1>How to promote: <tt>/sbin/umssync</tt> <p> A directory can be promoted any time using <tt>/sbin/umssync</tt>. It can be used at any time. Promoting a directory do the following operation <itemize> <item>Create a <tt/--linux-.---/. <item>Establish a one to one relation between the <tt/--linux-.---/ and the current content of the directory. </itemize> <tt>/sbin/umssync</tt> maintain an existing <tt/--linux-.---/ file. It does not create it from scratch all the time. It simply add missing entries in it (Files created during a <em/DOS/ session). It will also removed files which do not exist anymore in the <em/DOS/ directory from the <em/--linux-.---/. <tt/umssync/ gets its name from that. It put <em/--linux-.---/ in sync with the underlying <em/DOS/ directory. <sect1>Using <tt>/sbin/umssync</tt> at boot time <p> It is a good idea to place a call to <tt>/sbin/umssync</tt> at the end of your /etc/rc.d/rc.S if it's not there. The following command is adequate for most system: <tscreen><verb> /sbin/umssync -r99 -c -i+ / </verb></tscreen> The <tt/-c/ option prevent <tt/umssync/ from promoting directories. It will only update existing <tt/--linux-.---/. This command is useful if you access <em/Linux/ directory during a <em/DOS/ session. <em/Linux/ has no efficient way to tell that a directory has been modified by <em/DOS/ so <em/Umsdos/ can't do a <em/umssync/ operation as needed. <sect1>How to UN-promote <p> Remove the <tt/--linux-.---/ file using <em/DOS/. You will be sorry. <sect1>What about files created during a <em/DOS/ session ? <p> Unless you use <tt/umssync/ on a directory where files have been added or removed by <em/DOS/, you will notice some problems: <itemize> <item>It won't crash the system nor it won't cause major problems, only annoyance :-) <item>Files created by <em/DOS/. <itemize> <item>They will be invisible in <em/Linux/. <item>When trying to create a file with the same name, you will get an error message stating that the file already exist. <item>This creates more confusion that real problem. It does not harm the file system. </itemize> <item>Files deleted by <em/DOS/ won't cause problem. <em/Umsdos/ will notice the absence at the first access. A message will be output (and generally written into <tt>/var/adm/syslog</tt>). </itemize> <sect>Installation/UN-installation and some tricks <p> The installation of a <em/Umsdos/ is not much different from the installation of an ordinary (<em/Ext2 based/) <em/Linux/ system. There are two main differences. <sect1>The pseudo-root <tt>/mnt/linux</tt> <p> The normal steps for an installation are <enum> <item>Setting a partition with fdisk and formatting it. <item>Mounting it as /mnt relative to our installation root disk. <item>Copy all packages into <tt>/mnt</tt>. </enum> With <em/Umsdos/, the step 1 is not required (wasn't it the goal of <em/Umsdos/ not to reformat ?). It is possible to install a <em/Umsdos/ system just by copying all packages into <tt>/mnt</tt>. This will certainly work. But it will create a bunch of subdirectories into your <em/DOS/ root directory (C:) and you won't like it. This is the reason all <em/Umsdos/ installation use the pseudo-root. And this is the major difference between a normal <em/Ext2/ installation and a <em/Umsdos/ one: All files are copied into <tt>/mnt/linux</tt>. <sect1>Preparing <tt>/mnt/linux</tt> <p> <tt>/mnt/linux</tt> is not an ordinary directory. It has to be promoted so it will correctly handle <em/Linux/ long file name and special files (links, device). The step required to setup <tt>/mnt/linux</tt> are: <enum> <item><tt>mkdir /mnt/linux</tt> <item><tt>umssync /mnt/linux</tt> </enum> That's it! <sect1>Making sure <tt>/mnt/linux</tt> is correctly setup <p> Even if the setup of <tt>/mnt/linux</tt> is pretty simple, there are many installation package out there who get it wrong. How can ? <!-- <quote> --> The biggest installation problem come from an incompatible <tt/umssync/ program. <em/Umsdos/ has been update in linux 1.1.88 (Can't remember exactly) and a flaw was uncovered in <tt>umssync</tt>. To avoid confusion in the <em/Linux/ community, it was decided to raise the compatibility level required for all <em/Umsdos/ tools. Old version of the tools were simply rejected. It sounds like many distribution did not update their <tt>umssync</tt> utility on the installation disk. <!-- </quote> --> There are still many distribution like this out there. The net result is that the directory <tt>/mnt/linux</tt> is not promoted at all and will truncate all long file name and will reject all special file. It is possible to do a test very early during the installation to find out if something went wrong. Thanks to the pseudo console mechanism of <em/Linux/, you can do that without leaving the installation program. Do the following steps: <enum> <item>Press <tt>Alt-F2</tt> (<tt/Alt/ key at the same time as the <tt/F2/ key). <item>login as root. <item><tt>cd /mnt/linux</tt> If this fail, you are trying this too early. A good time to do this is at the end of the packages selection. <item><tt>>TOTO</tt> <item><tt>ls -l</tt> You should see an empty file <tt/TOTO/ in uppercase. If you see it in lowercase, something went wrong. Try to do the <tt/umssync/ step again. <tt/umssync/ can be use over and over without problem. <tt>umssync .</tt> If there is no error message, try the <tt/TOTO/ test again. If <tt/TOTO/ appears fine, then all is OK. Something is strange in this installation, but you just save it. Continue <item>Press <tt>Alt-F1</tt> to get back to the installation screen. </enum> <!-- <code> --> If the test fail, the best fix is to get a newer installation root disk. You can generally fix this root disk by installing a newer version of <tt/umssync/. This is not difficult but required a working <em/Linux/ system. You simply have to mount the root disk floppy and replace the offending <tt/umssync/ with a new one. <!-- </quote> --> <sect1>Oops releasing pseudo root ... <p> Most <em/Umsdos/ installation which fail, do this by printing this strange message. This is not a bug in <em/Umsdos/ although the message looks strange. Here are the known causes. <itemize> <item>The most common one <p> The <em/Slackware/ installation try to setup a swap file very early during the installation. To do so, it asks you to select a partition (dos drive), then mount it and set the swap file. When installing a <em/Slackware/ system, you must setup the target partition prior to install. This normally mounts the <em/DOS/ partition on <tt>/mnt</tt>, creates the <tt>/mnt/linux</tt> directory and applies <tt/umssync/ on it. This is where most problems come from. Most user just forget the "setup target partition" step and go directly to the rest of the installation. Since <tt>/mnt</tt> is already mounted, this mistake goes unnotice. This means that <tt>/mnt/linux</tt> was not created properly (Not promoted). All special files and links and long names can't be created properly. <item>Invalid umssync utility <p> <tt>/mnt/linux</tt> was improperly setup-ed. Generally caused by an improper <tt>umssync</tt> utility on the installation root disk. <item>Old bug in umsdos <p> There was a bug in <em/Umsdos/ prior to <em/Linux 1.2.2/. The pseudo-root mode would not activate properly if the file <tt>/etc/init</tt> was missing. <tt/init/ is now located in <tt>/sbin</tt>. You can fix it by getting a newer kernel. This is recommended because another bug was uncover and fixed in 1.2.2. If you can't upgrade, do this <enum> <item>Boot from you installation disk. <item>Login as root. <item><tt>mount -t umsdos /dev/hdXX /mnt</tt> where <tt>/dev/hdXX</tt> is your <em/DOS/ partition. <item><tt>cd /mnt/linux/etc</tt> <item><tt>ln -s ../sbin/init init</tt> <item><tt>cd /</tt> <item><tt>Ctrl-Alt-Del</tt> <item>Boot your <em/Umsdos/ normally. </enum> </itemize> Unfortunatly, the first two (Installation problems) produce a completly unusable installation. Uninstall it (See next section) and install again. <sect1>How to UN-install a <em/Umsdos/ system <p> One neat thing about <em/Umsdos/ and its pseudo-root mechanism, is that you can UN-install it without pain. You just boot <em/DOS/ and recursively delete the <tt/linux/ directory. That's all. <em/Umsdos/ requires no special drivers in the config.sys, nor it creates anything special outside of the <tt/linux/ directory. <sect1>Moving a <em/Umsdos/ system to another <em/DOS/ drive <p> This can be done from <em/Linux/ or from <em/DOS/. You just have to copy recursively the <tt/linux/ directory from one drive to the other. After that you will have to adjust you boot mechanism (generally loadlin command) and the <tt>/etc/fstab</tt> file. <em/Umsdos/ can live on any <em/DOS/ drive. There is no need to install it on the <tt/C:/ drive, nor it is important to have it on the first hard drive. It does not matter at all. In fact, one may decide to have several <em/Umsdos/ installations on different drive just to do experiments. <sect1>About installing 50 <em/Umsdos/ systems. <p> How about installing a bunch of <em/Linux/ systems in no time ? <em/Umsdos/ systems are living in a <em/DOS/ world. You can take advantage of this if you wish to install <em/Linux/ easily. You can install and configure a <em/Umsdos/ system at your site. When you are satisfied with the configuration and the different packages you have selected, you can boot <em/DOS/ and copy the complete <tt/linux/ directory to your <em/DOS/ file server. Then you go to other <em/DOS/ station and simply copy the files on the network drive to the local drive. That's it. Only adjust the boot script (<em/Loadlinx/) and go. With minimal adjustment (Host name, IP number), anyone will be able to install a <em/Linux/ system in a matter of minute. Interest readers may note that installing <em/Linux/ systems by copying running system also works for any other <em/Linux/ systems, including <em/Ext2/ based one. One beauty of <em/Linux/ is that there is no hidden files which have to be install by magic installation program. <sect>Setting a <em/Linux/ section in a <em/DOS/ partition <p> <em/Umsdos/ has some use even for <em/Ext2/ (Native <em/Linux/ file-system) users. One common scenario is this: <itemize> <item><em/Linux/ being your <em/OS/ of choice, the <em/Linux/ partition start to fill and fill and fill. <item>Your <em/DOS/ partition is collecting dust, being half empty. <item>You are suddenly out of space in the <em/Ext2/ partition. <item>You are still not sure you want to get rid of <em/DOS/. </itemize> <em/Umsdos/ may save the day here. You can setup a <em/Linux/ directory in the <em/DOS/ partition and use it without restriction for <em/Linux/ usage. For example, say you want to setup a new directory named <tt/"extra"/ in your <tt/C:/ drive. And you want this directory to behave as a normal <em/Linux/ directory. Do this (assuming that C: is /dev/hda1). <tscreen><verb> mkdir /c /sbin/mount -t umsdos /dev/hda1 /c mkdir /c/extra umssync /c/extra </verb></tscreen> You must be root to do this. By setting up <tt>/etc/fstab</tt> like this, you will always have access to the <tt>/c/extra</tt> directory. <sect>UMSDOS-WHY-TO <p> Explaining how to operate or install a <em/Umsdos/ system is not enough. Most people are seeking some advises about using <em/Umsdos/ or not. <sect1>The goal of <em/Umsdos/ <p> The goal of <em/Umsdos/ was to ease the installation of <em/Linux/. An other goal was to ease its UN-installation. The idea here was to promote the spreading of <em/Linux/. Installing a new OS on a system is always troublesome. <em>OS/2</em> for one will happily pollute your <tt>C:</tt> root with a bunch of new directories. If you are clever like me, it will also erase your config.sys and autoexec.bat files :-( The pseudo-root feature of <em/Umsdos/ avoid this unwanted invasion. <em/Linux/ can be UN-install without side effect. <sect1>Who needs it <p> If you have a small hard drive, <em/Umsdos/ will allow you to share disk space between <em/DOS/ and <em/Linux/. A disk below 300 megs is in my opinion a small disk. This opinion is based on the size of the different package available today. One popular word processor may eat as much as 70 megabytes if you select all features. If you have a larger drive, you may consider having a dedicated <em/Linux/ partition running the <em/Ext2/ file-system. <em/Ext2/ use a smaller cluster size that <em/DOS/ (1k in fact) so installing many small files will eat less space than in a <em/Umsdos/ partition. <sect1>Performance issue <p> The following point apply to <em/Umsdos/ compared with <em/Ext2/. <itemize> <item>Directory management is faster on <em/Ext2/. This come from the overhead of the double directory structure of <em/Umsdos/. <item>File access (reading and writing) is probably faster on <em/Umsdos/ than <em/Ext2/. This come from the simplicity of the <em/FAT/ file-system used by <em/DOS/. Beware that this simplicity come with a cost: <itemize> <item>A maximum of around 65,000 files or clusters per partitions. This also means that a 500 megabytes partition will use cluster 16k large. In other word, a file containing a single byte will use 16k of disk storage. <item>Everything is controlled by the <tt/FAT/ located at the beginning of the hard drive. The <em/DOS/ file-system is probably more fragile because of this. <item>No provision to avoid fragmentation of files. A <em/Umsdos/ system will generally be used as a single user workstation. In this case, this does not matter much. As a multi-user engine, files will get spread-ed all around the drive, lowering file access performance. </itemize> <item>Symbolic links are stored in normal file. If you intend to have a lot of them, you will find that <em/Umsdos/ use quite a lot of disk space compared to <em/Ext2/. </itemize> </article>