Mounting a FAT32 drive and edit the fstab file and what all means
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 31
  1. #1
    zellis Guest

    Post Mounting a FAT32 drive and edit the fstab file and what all means

    After hours of editing the fstab file, reading, more reading, did I mentioned reading? I saw the light what everything means in the fstab file.

    How to mount the drive

    Open Terminal/Konsole
    Step1: type mkdir /mnt/fatshare . You can name fatshare whatever you want to.
    Step2: login as root ( type su - )
    Step3: Enter password
    Step4: type gedit /etc/fstab

    fstab is where the configuration is loaded at start up of your system of which devices to mount.

    Step5: Add a line like this into the file:
    /dev/hda9 /mnt/fatshare vfat umask=022 0 0
    An example often used : - This means the owner has +rwx, the group and everyone else only +r-x access.


    Remember the owner will be usually root and the group as well, thus anybody else includes normals users.

    Another example This means owner has +rwx ,the group with id = 500 +rwx, everybody else no access (---)
    /dev/hda9 /mnt/fatshare vfat gid=500,umask=007 0 0
    "r" = read, "w" = write, "x" = execute "-" = no access

    Full explanation later on how to calculate the umask digits.

    Step6:
    save it and exit.

    Step7:
    Close apps and reboot, read on to see the options and at the end is the option how to do it immediately.


    You can see that there are 6 columns

    The 1st column is the device /dev/hda9 (maybe be different on your system)

    The 2nd column is the mount point - the name of directory created in step 1 - this case it is /mnt/fatshare

    The 3rd column is the filesystem type.
    In this case it is vfat for a fat32 drive

    The 4th columns is the options one can set.
    You will seperate different options with a comman(,)
    Here is the list of the options:

    auto or noauto
    Default is auto - this determines whether the device will mounted automatically at startup.
    noauto - Device must be mounted by an user before it can be used.
    NOTES ON no-auto:
    noauto option is good for removable storage media's such as a stiffy (floppy) , cd/dvd, usb drives/devices since it won't always have a media in it with startup. Much mount it before it can be used, although you will see the mount directory (e.g. /mnt/fatshare/) will recommend the add users or user option too.

    users - Allow an user to mount the device and another user to unmount ( command = umount ) the device

    uid=userid
    The system will give the access to the user with this id according to the umask value.


    gid=groupid
    The system will only give access to the group with this id according to the umask value.

    user/nouser
    Default is nouser - Only the root users can mount the device
    user - Normal users can mount the device

    ro/rw
    The default is rw - Set filesystem permissions to read + write
    ro - Set filesystem permissions to read only

    exec/noexec
    Default is exec - let one execute binaries
    noexec - Won't allow you to execute binaries

    sync/async
    Default is async - asynchrously - e.g. when copy a file it will write a time after the cp command has been issued.
    sync - synchrously - e.g. when copy a file it will copy it the same time the cp command has been issued

    defaults
    The defaults are rw, suid, dev,exec,auto, nouser, and async

    umask=007
    Your 3 digits may be different.

    How the umask digits works:
    The first digit refer to the owner
    The second digit refer to the group
    The third digit refer to anybody or everybody else not the owner nor a member in the group.

    Every digit is determined by adding the following up and deduct it from the number 777
    4 = Read
    2 = Write
    1 = Execute
    0 = no access

    E.g.
    The owner much have +rwx (read, write, execute) access, it is +4+2+1 = 7
    The group much have +r-x (read, execute) access, it is +4+1=5
    Everyone else much have +r-x (read, execute) access, it is +4+1=5

    Take 777 - 755 = 022
    So 022 will be your mask


    The 5th column determines whether or not the file will be backed up. This is called the dump option. 0 = off and 1 = on.

    The 6th column is the fsck that check the filesystem.
    0 the filesystem will not be checked
    1 should be used for root filesystem
    2 should be used for other filesystems, according what i found on various sites

    Take note:
    all mounted drives are recorded in the file "/etc/mtab"


    Reboot, and all should be mounted. If you don't want to reboot you can also mount the drive immediately from the terminal/console window

    To mount the drive immediately - This will only last in your current session.

    log in as root. Type su -
    Enter password for root
    Type mount -t vfat /dev/hda9 /mnt/fatshare
    hda9 - type the correct device number you need

    To give other users access to the drive (Because root is the owner and the group) use the chmod command
    Type: chmod a+rw /mnt/myshare
    This means anybody has access to the mounted drive

    Hope this clear up a few questions
    Last edited by zellis; 18th March 2007 at 07:44 PM.

  2. #2
    Join Date
    Dec 2004
    Location
    Canada
    Age
    29
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,
    Nice how-to I couldn't have said it better myself.

    Code:
    /dev/hda9 /mnt/fatshare vfat umask =022 0 0
    just a tip, there's no space inbetween the "umask" and the "="...
    Yeah, what I like to to to have ultimate permission and security is leave the owner as root, and have the gid=group, where group is the group including users that I trust. Eg, me, family members, but the "guest" account is excluded. A nice tool to making custom groups is system-config-users... You can install it with
    yum install system-config-users
    The menu entry is under "System Preferences"
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  3. #3
    tizwoz Guest

    Wink

    Thank you so much for this how to. You've obviously put a lot of reserach an work into and it sure has paid off has it will have benefited many members like myself.

    Keep up the good work!
    Last edited by tizwoz; 8th July 2006 at 08:19 AM. Reason: error

  4. #4
    karry66 Guest
    Your method did not work for me, i tried this and worked!
    /dev/hda5 /mnt/windows vfat users,defaults,umask=000 0 0

    where /dev/hda5 = is my drive
    /mnt/windows = my created file share with windows

  5. #5
    Join Date
    Dec 2004
    Location
    Canada
    Age
    29
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because you wanted write permissions, right? Umask=000 means all can read/write, which isn't safe. I would use the gid=### option on fstab to give you permissions and no one else.
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  6. #6
    j-billy Guest
    Quote Originally Posted by zellis
    After hours of editing the fstab file, reading, more reading, did I mentioned reading? I saw the light what everything means in the fstab file.

    How to mount the drive

    Open Terminal/Konsole
    Step1: type mkdir /mnt/fatshare . You can name fatshare whatever you want to.
    Step2: login as root ( type su - )
    Step3: Enter password
    Step4: type gedit /etc/fstab

    fstab is where the configuration is loaded at start up of your system of which devices to mount.

    Step5: Add a line like this into the file:
    /dev/hda9 /mnt/fatshare vfat umask=022 0 0
    An example often used : - This means the owner has +rwx, the group and everyone else only +r-- access.


    Remember the owner will be usually root and the group as well, thus anybody else includes normals users.

    Another example This means owner has +rwx ,the group with id = 500 +rwx, everybody else no access (---)
    /dev/hda9 /mnt/fatshare vfat gid=500,umask=007 0 0
    "r" = read, "w" = write, "x" = execute "-" = no access

    Full explanation later on how to calculate the umask digits.

    Step6:
    save it and exit.

    Step7:
    Close apps and reboot, read on to see the options and at the end is the option how to do it immediately.


    You can see that there are 6 columns

    The 1st column is the device /dev/hda9 (maybe be different on your system)

    The 2nd column is the mount point - the name of directory created in step 1 - this case it is /mnt/fatshare

    The 3rd column is the filesystem type.
    In this case it is vfat for a fat32 drive

    The 4th columns is the options one can set.
    You will seperate different options with a comman(,)
    Here is the list of the options:

    auto or noauto
    Default is auto - this determines whether the device will mounted automatically at startup.
    noauto - Device must be mounted by an user before it can be used.
    NOTES ON no-auto:
    noauto option is good for removable storage media's such as a stiffy (floppy) , cd/dvd, usb drives/devices since it won't always have a media in it with startup. Much mount it before it can be used, although you will see the mount directory (e.g. /mnt/fatshare/) will recommend the add users or user option too.

    users - Allow an user to mount the device and another user to unmount ( command = umount ) the device

    uid=userid
    The system will give the access to the user with this id according to the umask value.


    gid=groupid
    The system will only give access to the group with this id according to the umask value.

    user/nouser
    Default is nouser - Only the root users can mount the device
    user - Normal users can mount the device

    ro/rw
    The default is rw - Set filesystem permissions to read + write
    ro - Set filesystem permissions to read only

    exec/noexec
    Default is exec - let one execute binaries
    noexec - Won't allow you to execute binaries

    sync/async
    Default is async - asynchrously - e.g. when copy a file it will write a time after the cp command has been issued.
    sync - synchrously - e.g. when copy a file it will copy it the same time the cp command has been issued

    defaults
    The defaults are rw, suid, dev,exec,auto, nouser, and async

    umask=007
    Your 3 digits may be different.

    How the umask digits works:
    The first digit refer to the owner
    The second digit refer to the group
    The third digit refer to anybody or everybody else not the owner nor a member in the group.

    Every digit is determined by adding the following up and deduct it from the number 777
    4 = Read
    2 = Write
    1 = Execute
    0 = no access

    E.g.
    The owner much have +rwx (read, write, execute) access, it is +4+2+1 = 7
    The group much have +r-- (read) access, it is +4
    Everyone else much have +r-- (read) access, it is +4

    Take 777 - 744 = 022
    So 022 will be your mask


    The 5th column determines whether or not the file will be backed up. This is called the dump option. 0 = off and 1 = on.

    The 6th column is the fsck that check the filesystem.
    0 the filesystem will not be checked
    1 should be used for root filesystem
    2 should be used for other filesystems, according what i found on various sites

    Take note:
    all mounted drives are recorded in the file "/etc/mtab"


    Reboot, and all should be mounted. If you don't want to reboot you can also mount the drive immediately from the terminal/console window

    To mount the drive immediately - This will only last in your current session.

    log in as root. Type su -
    Enter password for root
    Type mount -t vfat /dev/hda9 /mnt/fatshare
    hda9 - type the correct device number you need

    To give other users access to the drive (Because root is the owner and the group) use the chmod command
    Type: chmod a+rw /mnt/myshare
    This means anybody has access to the mounted drive

    Hope this clear up a few questions
    Is it the same with a logical partition? because I get this message...
    > -t vfat /dev/hda9 /mnt/fatshare <

  7. #7
    Join Date
    Jun 2006
    Location
    Paris, TX
    Posts
    24,121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Outstanding job zellis! Worked like a charm. I was getting a little annoyed with that nasty red "X" on my DATA drive!

    Now I'm off to dig up a solution for giving complete +rwx access to all users on a USB hot-connected external HDD. (Both vfat and ext3 partitions!) Hints above are appreciated!

    Dan
    Last edited by TangledWeb; 3rd October 2006 at 01:56 AM.

  8. #8
    j-billy Guest
    How can I see which is my fat32 or NTFS drive name?, any command on console?

  9. #9
    Seve's Avatar
    Seve is offline Retired Community Manager
    Join Date
    Oct 2004
    Location
    The GTA, Ontario, Canada
    Age
    62
    Posts
    12,371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by j-billy
    How can I see which is my fat32 or NTFS drive name?, any command on console?
    Hello:
    If you open a terminal and log in as root
    and type
    fdisk -l


    Seve
    Registered Linux User: #384977
    .................................................. ............
    See the Links below for more Help and those much wanted extras ... :)


  10. #10
    j-billy Guest
    Quote Originally Posted by Seve
    Hello:
    If you open a terminal and log in as root
    and type
    fdisk -l
    Seve
    Great!! now I can access my fat partition from fedora, but I must be in /mnt/windowsfat32/, how can I mount it to a drive, I followed the previows steps but it displays an Error!!, check what I did....
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Pantallazo.png 
Views:	344 
Size:	220.4 KB 
ID:	9364  

  11. #11
    Seve's Avatar
    Seve is offline Retired Community Manager
    Join Date
    Oct 2004
    Location
    The GTA, Ontario, Canada
    Age
    62
    Posts
    12,371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello:
    You can mount your fat partition by doing the following;
    If you already have a directory created as /mnt/windowsfat32
    if not then you need to make one.
    then add the following line to your /etc/fstab file
    /dev/hdc1 /mnt/windowsfat32 vfat users,defaults,umask=000 0 0

    reboot your pc and you should be good to go.

    Seve
    Registered Linux User: #384977
    .................................................. ............
    See the Links below for more Help and those much wanted extras ... :)


  12. #12
    j-billy Guest
    Quote Originally Posted by Seve
    Hello:
    You can mount your fat partition by doing the following;
    If you already have a directory created as /mnt/windowsfat32
    if not then you need to make one.
    then add the following line to your /etc/fstab file
    /dev/hdc1 /mnt/windowsfat32 vfat users,defaults,umask=000 0 0

    reboot your pc and you should be good to go.

    Seve
    Shall I include the "/" at the begining of the line....?

  13. #13
    Join Date
    Sep 2006
    Location
    Kentucky, USA
    Age
    39
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you have to include the slash ( / ) in front of /dev/hdc1. Linux looks at your harddrive partitions much the same way we think of a directory structure. So think of /dev/hdc1 as /device/hard-disk C partition 1.

  14. #14
    vamped Guest

    Why /mnt?

    Why mount to /mnt/folder_name ? Are there benefits of that over mounting to, say, your home folder?

    Also, can you mount a specific directory on a drive (rather than at the root of the drive) ?
    for example: hdb is a partition that contains a folder 'x'.
    mounting /dev/hdb /mnt/x mounts hdb to x (not hdb/x to x).

  15. #15
    Join Date
    Nov 2005
    Location
    Los Angeles area
    Posts
    887
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you don't need to reboot to mount.
    Just type, as root, "mount /mnt/fatshare"

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Can't edit fstab as it's a read only file
    By worldttle in forum Using Fedora
    Replies: 25
    Last Post: 12th June 2014, 09:43 AM
  2. How to edit /etc/fstab for mounting new partitions ???
    By codingfreak in forum Hardware & Laptops
    Replies: 2
    Last Post: 8th July 2009, 07:11 AM
  3. hard drive error during boot(edit fstab)
    By xtalman in forum Using Fedora
    Replies: 1
    Last Post: 3rd October 2005, 08:09 PM
  4. Mounting a FAT32 Drive ?
    By pgmoscatt in forum Hardware & Laptops
    Replies: 3
    Last Post: 8th April 2005, 08:53 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •