[CentOS] Can't mount FAT32 partition

Thu Sep 1 02:58:36 UTC 2005
Sean O'Connell <oconnell at soe.ucsd.edu>

On Thu, 2005-09-01 at 11:10 +0900, Dave Gutteridge wrote:
> I've almost got this solved.
> 
> To make a long story of experimentation short, using the check disk 
> utility inside Windows XP was not sufficient for ensuring the partition 
> was in working order. I had to use my trusty Win98 boot disk, and run 
> scandisk from there, where it fixed something to do with the directory 
> structure. And then I went back to XP and ran checkdisk, where it then 
> found cross linked files to repair. Not that I know what a cross linked 
> file is, but my suspicion is that this all had something to do with the 
> assault that Linux performed on my disk when I tried to mount the drive 
> with the wrong settings.
> 
> So where I'm at now is that I can mount the drive from the command line 
> like so:
> [root at localhost ~]# mount /dev/hda1 /mnt/windows
> ... but only the root user can see it.
> 
> I want to be able to make it so that any user (which is almost always 
> me, but sometimes I'm root, sometimes I'm just a user with the account 
> "dave") can access the drive, and that it comes up in Gnome/Nautilus on 
> boot.
> 
> Here is what I currently have in /etc/fstab:
> /dev/hda1               /mnt/windows            vfat    
> rw,uid=512,gid=1002 0 0
> 
> This also only seems to give root access. "dave" can not access the 
> drive, and it does not show up in Gnome/Nautilus.
> 
> In this thread I got a lot of different variations on what that line 
> should read, so I'm not sure which is the best for my situation.
> 
> How do I ensure universal read/write access to the disk for all users on 
> my computer?

Dave-

Since you mounted the drive as root, it is owned by root. You'll need to
do some setup work to get the windows partition mounted so non-root
users can access it. You can do it one of a few ways:

1) add something in /etc/fstab like

/dev/hda1 /mnt/windows vfat rw,gid=windows,umask=002 0 0

where windows is a group whose members you want to have read/write
access to the partition. everything will be owned by root, but the group
writes will be allowed by way of the umask setting.

2) or you can use consolehelper to allow people logged in on your
machine the ability to mount and have access to the partition.

in /etc/fstab

/dev/hda1 /mnt/windows vfat noauto,user 0 0

in /etc/security/console.perms

add something like these 2 lines

<win>=/dev/hda1 /mnt/windows

<console>  0600 <win>        0660 root.disk

This should allow the person logged in on the console the rights to do a
mount /mnt/windows and then have unfettered access. Of course, if
another person logged in later, they wouldn't have access unless the
first person unmounted the partition.

It all kind of depends on how you want to handle it. I'm sure there are
other options out there.

-- 
Sean O'Connell
Office of Engineering Computing         oconnell at soe.ucsd.edu
Jacobs School of Engineering, UCSD      858.534.9716 (49716)