LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 01-15-2012, 02:21 AM   #1
Mes9
Member
 
Registered: Jan 2012
Distribution: Fedora 17
Posts: 31

Rep: Reputation: 0
Question mount usb drive read-only fedora 16


How can I mount my usb drive to be read only. Ive been going through various documentation and it is a bit confusing, dont know if it is because fedora 16 does things differently or what. Where I am now is that I think its my fstab file I have to configure but the options in it are all set to defaults. The default is r/w. And even though my usb drive mounts automatically it dosnt add an entry to fstab instead it is set in something called by-label.

The reason why im doing this is because im configuring aide and my aide.conf file is going to be on this usb drive as my database.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-15-2012, 03:07 AM   #2
MartinStrec
Member
 
Registered: Jan 2012
Location: Czech
Distribution: Fedora, RHEL, Ubuntu, Mint
Posts: 110

Rep: Reputation: 13
Mounting removable drives (USB, CD) to /media/DEVICENAME is managed by gnome-volume-manager. Look for its documentation. You can disable that manager and mount from command line when standard /etc/fstab works.

see
http://www.linuxforums.org/forum/red...-usb-disk.html
http://www.togaware.com/linux/surviv...e_Manager.html
http://www.cyberciti.biz/faq/disable...-automounting/
 
Old 01-15-2012, 03:56 AM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Adding an entry in /etc/fstab, the system should obey the mount options and mount location, even when automounting. Use the UUID value in the first device field. Use the noauto option to allow the system to boot up without the drive being present.

Try first letting it automount. Base the fstab entry on the current mtab entry, or mount command output.
Here is an example from my fstab:
Code:
UUID=266D-3D87  /mnt/disk vfat   rw,nosuid,nodev,noexec,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro,owner,user,helper=udisk
It is for an sdcard. I added some options I wanted to what was present already in /etc/mtab.
 
2 members found this post helpful.
Old 01-15-2012, 07:05 AM   #4
Mes9
Member
 
Registered: Jan 2012
Distribution: Fedora 17
Posts: 31

Original Poster
Rep: Reputation: 0
this is what ive done

Here is what I wrote in my fstab:
Code:
/dev/sdc1 /media/PENDRIVE vfat r,user,owner,comment 0 0
Here is the output from the auto-mount
Code:
Error
Unable to mount PENDRIVE

Error mounting: mount exited with exit code 1: helper failed with:
[mntent] line 1 in /etc/fstab is bad
mount: mount point /media/PENDRIVE does not exist
 
Old 01-15-2012, 07:24 AM   #5
MartinStrec
Member
 
Registered: Jan 2012
Location: Czech
Distribution: Fedora, RHEL, Ubuntu, Mint
Posts: 110

Rep: Reputation: 13
It means directory /media/PENDRIVE doesn't exist. Create it using command 'mkdir /media/PENDRIVE'. I don't know if mount command can create empty directory (mountpoint) itself.
 
1 members found this post helpful.
Old 01-15-2012, 10:02 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
It would be better to use the UUID since you don't know which device will be used. Also, you want your options to apply to a particular filesystem, not any USB drive.
 
Old 01-27-2012, 08:27 AM   #7
Mes9
Member
 
Registered: Jan 2012
Distribution: Fedora 17
Posts: 31

Original Poster
Rep: Reputation: 0
Smile solved

Quote:
Originally Posted by jschiwal View Post
It would be better to use the UUID since you don't know which device will be used. Also, you want your options to apply to a particular filesystem, not any USB drive.
Here's what I did
find UUID
Code:
ls -l /dev/disk/by-uuid
fstab entry:
Code:
 UUID=0000-0000 /media/PENDRIVE/usb1 vfat ro,noauto,user,owner,noexec 0 0

Make mountpoint
sudo mkdir /media/PENDRIVE/usb1

manual mounting of the pendrive:
Code:
sudo mount /media/PENDRIVE/usb1
It's working...yae!
Thank you so much for your reply's

Last edited by Mes9; 01-28-2012 at 01:43 PM. Reason: line 12 /etc/fstab is bad
 
Old 01-28-2012, 01:49 PM   #8
Mes9
Member
 
Registered: Jan 2012
Distribution: Fedora 17
Posts: 31

Original Poster
Rep: Reputation: 0
Unhappy

It hasn't worked with the traditional methods, so I guess there is no way around gnome-volume-manager, it seems it overwrites what I've done so far.
I guess I need to dig the net for some instructions on usage..... :-(

http://linuxtidbits.wordpress.com/20...-to-play-nice/

Last edited by Mes9; 02-01-2012 at 04:07 PM.
 
Old 02-01-2012, 05:19 PM   #9
Mes9
Member
 
Registered: Jan 2012
Distribution: Fedora 17
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by MartinStrec View Post
Mounting removable drives (USB, CD) to /media/DEVICENAME is managed by gnome-volume-manager. Look for its documentation. You can disable that manager and mount from command line when standard /etc/fstab works.


As I understand it the gnome-volume-manager manages tweaks for all kinds of programs, so if I disable it to manage mounting manually it will disable the settings for everything else it manages.
 
Old 02-01-2012, 05:37 PM   #10
Mes9
Member
 
Registered: Jan 2012
Distribution: Fedora 17
Posts: 31

Original Poster
Rep: Reputation: 0
Unhappy Maybe solved

Quote:
Originally Posted by jschiwal View Post
Adding an entry in /etc/fstab, the system should obey the mount options and mount location, even when automounting. Use the UUID value in the first device field. Use the noauto option to allow the system to boot up without the drive being present.

Try first letting it automount. Base the fstab entry on the current mtab entry, or mount command output.
Here is an example from my fstab:
Code:
UUID=266D-3D87  /mnt/disk vfat   rw,nosuid,nodev,noexec,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro,owner,user,helper=udisk
It is for an sdcard. I added some options I wanted to what was present already in /etc/mtab.
It got all mixed up, it was working but then I had problems, in Nautilus it couldnt un-mount and the Folders where both named PENDRIVE instead of PENDRIVE & usb1. And it would auto-mount still and ignore my options in fstab.

I think it has something to with that gnome-volume-manager thinks it owns the /media mountpoint so I've changed it to /mnt. It seems to work but I'l give it some days to see before I believe it.

find UUID
Code:
ls -l /dev/disk/by-uuid
mountpoint
Code:
sudo mkdir /mnt/PENDRIVE
      sudo mkdir /mnt/PENDRIVE/usb1
fstab entry
Code:
UUID=25E9-3553 /mnt/PENDRIVE/usb1  vfat  ro,noauto,nodev,noexec,uid=1000,gid=1000,user,owner,comment,noexec  0 0
mount
Code:
sudo mount /mnt/PENDRIVE/usb1
 
Old 08-15-2012, 05:06 PM   #11
Mes9
Member
 
Registered: Jan 2012
Distribution: Fedora 17
Posts: 31

Original Poster
Rep: Reputation: 0
Wink The code is working on Fedora 17, my Fedora 16 is offline, and this post was working on my Fedora 16

Quote:
Originally Posted by Mes9 View Post
It got all mixed up, it was working but then I had problems, in Nautilus it couldnt un-mount and the Folders where both named PENDRIVE instead of PENDRIVE & usb1. And it would auto-mount still and ignore my options in fstab.

I think it has something to with that gnome-volume-manager thinks it owns the /media mountpoint so I've changed it to /mnt. It seems to work but I'l give it some days to see before I believe it.

find UUID
Code:
ls -l /dev/disk/by-uuid
mountpoint
Code:
sudo mkdir /mnt/PENDRIVE
      sudo mkdir /mnt/PENDRIVE/usb1
fstab entry
Code:
UUID=25E9-3553 /mnt/PENDRIVE/usb1  vfat  ro,noauto,nodev,noexec,uid=1000,gid=1000,user,owner,comment,noexec  0 0
mount
Code:
sudo mount /mnt/PENDRIVE/usb1
Its working.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does my usb drive mount read only mode unix1adm Ubuntu 10 11-30-2013 03:35 PM
[SOLVED] Usb flash drive error: Unable to read mount point hewjr1000 Linux - Newbie 4 11-18-2010 05:59 PM
Fedora will only mount my USB drive as read-only santiagosilva Linux - Hardware 6 02-17-2010 03:51 PM
how to mount usb flash drive in fedora? jvan Linux - Newbie 4 01-24-2008 03:12 AM
Cannot mount a USB drive as read/write. icheyne MEPIS 2 06-28-2005 01:48 AM


All times are GMT -5. The time now is 09:09 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration