Monday, October 31, 2005

[LinuxEXP] Mounting the FAT

Just to separate my own experiences in separate posts, considering I don't really like to jam everything into one entry. :)

I believe I'd be spending some time jotting down some of the challenges that I am facing as a relatively new Linux user (well... although I did have some exposure to it when I am in college 3 years ago, but I only and actually use it now)

Mounting a FAT32 (Windows9x/NT/XP) partition

Difficulty: Easy

  1. Login as root from a terminal

  2. Create a directory in your /mnt folder where you want to mount your FAT32 partition. This can be done by executing
    mkdir /mnt/fat32partition
    , which fat32partition is the name of the folder that I'll be mounting my FAT32 partition into.

  3. Execute fdisk -l to list down the device file of the FAT32 partition. Note down the device file name of the partition.

    The output should look something like this:

    Device ... System
    /dev/hda1 HPFS/NTFS
    /dev/hda2 Linux
    /dev/hda3 Extended
    /dev/hda4 W95 FAT32 (LBA)
    /dev/hda5 Linux LVM

    In this scenario, /dev/hda4 is the device file of the partition that we're going to mount.

  4. The next thing is to edit /etc/fstab. Open the file using your favourite text editor (vi, emacs, or any GUI based text editor would do), and add the following line at the bottom of the file (Quoting the article in LinuxForum):

    /dev/Y /mnt/X vfat users,owner,ro,umask=000 0 0

    "where Y is the partition number of the Fat32 partition and X is the name of the directory you created in step 2. Note that this will allow ALL users READ ONLY access to the disk. To allow Read and Write access to ALL users, change the ro to rw. If you want only root to have Read and Write access (while other users have READ ONLY access), change the ro to rw and umask=000 to umask=022."

    Then, obviously, is to save the changes you have made. :)

  5. Then run mount -a and viola! Your FAT32 drive is now mounted and you can access the data in it! :)

    And the coolest thing is that you can now exchange file between OSes easily, provided that you set the correct setting in the umask field :).