# Flash drive mounts read only

## shgadwa

I've had this problem for a while now.

My flash drive does not mount unless I add a entry in /etc/fstab for it and then mount it manually as root. Then, when I do mount it... it mounts read only.

Any ideas?

----------

## mikegpitt

A few questions...

1) How are you trying to mount the drive as a non-root user?

2) What is the filesystem of the flash drive?

3) Have you checked to make sure the physical read-only switch is flipped in the correct direction (assuming your drive has one)?

Also, can you post the output of:

1) `fdisk -l`  (with the flash drive plugged in)

2) `cat /etc/fstab`

----------

## shgadwa

 *mikegpitt wrote:*   

> A few questions...
> 
> 1) How are you trying to mount the drive as a non-root user?
> 
> 2) What is the filesystem of the flash drive?
> ...

 

Its supposed to automatically mount and it does not do that. I try to mount it by clicking on it and it says I don't have permission and that only root can do that. I just tried it in the terminal with my user name and it said only root can do that. Its a FAT drive. It does not have a switch and it works flawlessly on Mac OS X and windows XP both read and write.

```
atlantis shawn # fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes

255 heads, 63 sectors/track, 14593 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x119b2f60

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1           5       40131   83  Linux

/dev/sda2               6         371     2939895   82  Linux swap / Solaris

/dev/sda3             372        6073    45801315   83  Linux

/dev/sda4   *        6074       12801    54042660    7  HPFS/NTFS

Disk /dev/sdb: 16.0 GB, 16039018496 bytes

75 heads, 40 sectors/track, 10442 cylinders

Units = cylinders of 3000 * 512 = 1536000 bytes

Disk identifier: 0xc3072e18

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1       10443    15663084    c  W95 FAT32 (LBA)

```

```
atlantis shawn # cat /etc/fstab

# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't 

# needed; notail increases performance of ReiserFS (at the expense of storage 

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda1      /boot      ext2      noauto,noatime   1 2

/dev/sda3      /      ext4      noatime      0 1

/dev/sda2      none      swap      sw      0 0

/dev/sda4               /media/windows  ntfs-3g         defaults        0 0

/dev/cdrom      /media/CDROM   auto      noauto,ro   0 0

/dev/sdb1               /media/Shawn    auto            defaults        0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

shm         /dev/shm   tmpfs      nodev,nosuid,noexec   0 0

#/squashed/usr/usr.sfs   /squashed/usr/ro   squashfs   loop,ro   0 0

#usr    /usr    aufs    udba=reval,br:/squashed/usr/rw:/squashed/usr/ro  0 0

chromium /home/shawn/.config/chromium tmpfs size=192M,noauto,user,exec,uid=1001,gid=100 0 0
```

----------

## krinn

try

/dev/sdb1               /media/Shawn    auto           nodev,noexec,nosuid,rw,users,umask=007,gid=users

----------

## shgadwa

That did it! Thanks a lot!!

Now my only problem is automounting drives that are not in /etc/fstab... is that possible?

----------

## krinn

udev is there for that.

for some general mount, i think gnome and kde should mount it themself without anything special to do.

----------

## mikegpitt

I don't know in the case of Gnome and KDE, but having an entry in your fstab typically overides automounting.  I would comment out that line to see if automounting works by default.  If it doesn't, can you report back what automounter you are using?  Personally I use halevt, which is a successor to ivman.

----------

## shgadwa

Well, I just realized that I have the same problem with CD ROMS... should I use a different fstab entry for it or what?

Thanks a lot,

~Shawn

----------

## mikegpitt

 *belikeyeshua wrote:*   

> Well, I just realized that I have the same problem with CD ROMS... should I use a different fstab entry for it or what?
> 
> Thanks a lot,
> 
> ~Shawn

 The CD-ROM won't automount with the entry in your fstab.  If you want to add user mounting to the mix add the 'user' flag to the mount options:

```
/dev/cdrom             /mnt/cdrom      auto            noauto,ro,user  0 0
```

----------

