Monday, July 25, 2005

Mounting a FAT partition in Ubuntu

Having a FAT32 partition to allow read/write access from both Windows and Linux can be extremely useful. Windows XP makes accessing the partition easy, since the OS mounts all available drives on login. Ubuntu, by contrast, will not mount the partition unless specifically instructed to do so. You could do this manually every time you start a new session, but I wouldn't recommend it. The addition of one line to /etc/fstab tells Ubuntu to automatically mount the FAT32 partition at the start of a new session. I made a backup copy of /etc/fstab before editing it.

$ sudo cp /etc/fstab /etc/fstab.bak
$ sudo gedit /etc/fstab


I opened a different terminal tab (Ctrl+Shift+T) and looked up the device name for the partition.

$ sudo fdisk -l

That's an L, as in Lima. Then I added the following line to the end of the file.

/dev/hda5 /media/windows vfat user,iocharset=utf8,umask=000 0 0

With this change, Ubuntu will mount /dev/hda5 to /media/windows and make it visible in computer:/// each time the OS boots. iocharset and umask determine the character set and permissions of the partition respectively. Note that some Linux distros won't allow you to mount a FAT32 partition with the UTF-8 character set because it makes file names case sensitive. Ubuntu displays a warning but doesn't stop you. I wanted to verify that the change had the desired effect without rebooting.

$ sudo mount -a

If I had entered sudo -s -H at the start of the process, I would have been running the commands as root user and would not have had to preface each one with sudo. I personally dislike switching to root unless absolutely necessary. As root user, minor typos can spell major problems.

What do we have in store for the next episode of Live Gnude Girls?
  • Install missing plug-ins for mozilla-firefox.
  • Optimize NVIDIA performance.
  • Import my music collection—in Ogg Vorbis whenever possible.
  • Install the necessary libraries for DVD playback.
In the meantime, I ought to get some rest.

No comments: