Mapping drives in Xandros

How to use the same drive letters as Windows?

By Floor Anthoni (July 2007)
Linux assigns drive letters different compared to Windows, which may cause confusion in a dual-boot of Windows and Linux. How can drive letters in Linux be made identical to Windows? Here is the method to have identical disk drive letters in both systems, Windows and Linux or Xandros. It relies on changing the file system table fstab.
 back to contents page  Seafriends home page   feedback   Rev:070705,

drive letter confusion 

One of the first nuisances Windows users encounter in a dual-booting Windows and Linux system, is the differences in disk naming, which may not be noticeable if you have only one hard drive. 
A case study
I have two swappable ez-swap drives on the IDE (ATA) bus. These are 3.5" form factor 200GB disks, each inside a tray that slides into a 5.25" form factor docking slot that also supplies voltage and a cooling fan. Such IDE swappable drives can be turned on or off only when the CPU power is off. 
The advantages of having swappable drives are:
  • disk storage can be extended indefinitely, as is welcome for movie production.
  • very large backups of over 200GB can be done.
  • backups can be removed and stored off-site.
  • because most drives are off most of the time, their lives are extended considerably
  • mistakes by accidentally writing wrong information, are reduced.
  • backups of backups can be made.
The problem is that the drive letters assigned by Linux are not only not the way Windows does it, but also that they change the moment a swappable drive is disconnected or reconnected. The table below shows the problem. Note that the primary drives are hda, hdb, hdc and hdd is the DVD drive (which could also be hdb as the DVD is often connected on the same cable as the primary hda).
Windows Linux (all drives on) Linux (one drive off)
hda:C Windows
hda:D swap
hda:<linux partition skipped>
hda:E own work
hda:F workspace
hdb:G backup1
hdc:H backup2
hda:C Windows
hdb:D backup1
hdc:E  backup2
hda:/ <Linux>
hda:F swap
hda:G own work
hda:H workspace
hda:C Windows
hdb:D backup1
hdc: <missing>
hda:/ <Linux>
hda:D swap
hda:E own  work
hda:F workspace

It doesn't need much imagination to see that drive letters change once again when two drives are placed off-line. Obviously the Windows scheme is the preferable one, with the drive most likely off-line having the highest drive letter.

One of the things to get used to, is that within Linux a lot of things can be changed. Settings are stored in text files, and many programs also consist of 'script' or 'executable text'.

changing fstab

The file system table fstab defines all file systems in use and where these are 'mounted'. Remember that all devices within Linux are treated as files. A printer is a file to which one writes. A keyboard is a file from which one reads. The two places where these devices are found are in the directories /dev/ and /disks/ where they are 'mounted'. 

The directory (folder) with all system settings and configurations is /etc/ and /etc/fstab is a text file defining the file systems. It is generated automatically by Xandros,  and a backup copy is kept in /etc/devices/shadow/fstab. For this to work, you must make sure that all your drives are connected so that Xandros may detect them.

You will need to use an editor, and the standard 'K' editor kedit, is smart and friendly. Now you need to switch user and log in as administrator (also called 'root'). Double-click on the editor icon and open /etc/fstab. Note that script and config files do not have the extension .txt even though they contain pure text. fstab is a wide text file so you may need to widen the window. In the table below you'll see the changes made to map the drive letters properly. It pays to have a copy of this file such as fstabold, in case you wish to go back to the old settings.
# /etc/fstab -- static file system information
auto generation: off
# generated by: /sbin/etcdev2fstab
# NOTE: to make this file readable, it has been formatted for 132 columns
#<device>              <mountpoint>      <fstype>  <options>                                       <dbg> <pass>
/dev/hda6              /                 reiserfs  rw,usrquota,grpquota                            0     0
/dev/hda1              /disks/C         vfat   rw,nosuid,nodev,noexec,nouser,async,fmask=111,dmask=0 0   0
/dev/hdb1              /disks/I     ufsd  rw,nosuid,nodev,noexec,nouser,async,umask=0,iocharset=iso8859-1 0 0
/dev/hdd1              /disks/H     ufsd  rw,nosuid,nodev,noexec,nouser,async,umask=0,iocharset=iso8859-1 0 0
/dev/hda5              /disks/D         vfat   rw,nosuid,nodev,noexec,nouser,async,fmask=111,dmask=0 0   0
/dev/hda7              /disks/E         vfat   rw,nosuid,nodev,noexec,nouser,async,fmask=111,dmask=0 0   0
/dev/hda8              /disks/F         vfat   rw,nosuid,nodev,noexec,nouser,async,fmask=111,dmask=0 0   0
/dev/hda9              /disks/G     ufsd  rw,nosuid,nodev,noexec,nouser,async,umask=0,iocharset=iso8859-1 0 0
/dev/hdc               /media/cdrom0     auto      rw,nosuid,nodev,exec,nouser,noauto,async        0     0
/dev/floppy/0          /media/floppy0    auto      rw,nosuid,nodev,exec,nouser,noauto,sync         0     0
proc                   /proc             proc      rw                                              0     0
usbfs                  /proc/bus/usb     usbfs     rw,devmode=0666                                 0     0
/boot/linux-swap.swp   none              swap      sw                                              0     0

Note that the # has been taken out of the second line to turn autogeneration off. The only changes of importance are those in the column <mount point>. Changes have also been made to the cdrom, but these will be discussed in the chapter to make the DVD work, and watching movies.

The good news is that when you turn swap drives off, this table won't change and Linux won't stumble either. If you wish to know more about this table, consult the manual pages as described in the next chapter.

You will undoubtedly be using CrossOver Office (XO) for windows compatibility, and here you have to enter the disk drives D ... H because by default XO only knows the C drive. This is dealt with in a separate chapter.

[if the text in the text block is too small to read, press CTRL and + to enlarge all text]

browsing the manual

In the console, which is really a simulation of a character terminal, the computer listens to the command you enter, hence this is called the command line. Under your finger tips rests now the full power of the operating system, if only you knew what to type. This is where the manual comes in, and your most important command to learn is man (for manual).

Find the console in the menu: launch> applications> system> console. Drag it onto the desktop and select copy from the context menu. Right-click on the desktop> arrange icons> vertically, to realign them. But you already knew this.

The command line always begins with your logon, like
where the $ is the prompt of the command line and ~ means 'my home' as in Windows' 'My_Documents', even though this folder is found in C:\My_Documents\peter\...   Likewise, 'my home' in Xandros is found in /home/peter/...

Now type:
man man
which means: display what's in the manual about the manual, and a screenful of a document is displayed. Scroll through it with the pagedown/nextpage key and back again with the pageup key or the vertical slider. To get out, use CTRL+Z or CTRL+C, the break command. Note here that Windows has hi-jacked the international CTRL+C break key to mean copy-to-clipboard. The confusions Windows has sown are just endless - sigh. But now you'll understand that copying text from the console cannot be done with CTRL+C. Use the context menu (mouse right-click) instead.

You may wish to 'pipe' the text to the printer for safekeeping, which is not a bad idea:
man man |lpr
Note that the up-arrow key repeats previous commands, and this will save you a lot of re-keying.

Finally, learn about the fstab page:
man fstab|lpr

The manual can also be searched by key words:
man -k keyword

The manual is thousands of pages large, growing as you download more modules and libraries and applications.

While we're at the console and command line, there is another command you will find handy: locate fstab
which means: where can I find files or folders named 'fstab'?
The locate command searches a database which is occasionally reconstructed, or can be reconstructed by the administrator with the updatedb command. It is very thorough and includes all Windows folders and files as well.

In the beginning, these manual pages look alien indeed, but do not let this turn you off. You'll get used to it - slowly. The main thing to remember is that all this gobbledigook can be used to your advantage as you learn how to be the boss of this enormous and powerful machine.