LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   mount usb drive read-only fedora 16 (https://www.linuxquestions.org/questions/fedora-35/mount-usb-drive-read-only-fedora-16-a-923857/)

Mes9 01-15-2012 02:21 AM

mount usb drive read-only fedora 16
 
How can I mount my usb drive to be read only. I´ve 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.

MartinStrec 01-15-2012 03:07 AM

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/

jschiwal 01-15-2012 03:56 AM

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.

Mes9 01-15-2012 07:05 AM

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


MartinStrec 01-15-2012 07:24 AM

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.

jschiwal 01-15-2012 10:02 PM

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.

Mes9 01-27-2012 08:27 AM

solved
 
Quote:

Originally Posted by jschiwal (Post 4575518)
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

Mes9 01-28-2012 01:49 PM

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/

Mes9 02-01-2012 05:19 PM

Quote:

Originally Posted by MartinStrec (Post 4574915)
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.

Mes9 02-01-2012 05:37 PM

Maybe solved
 
Quote:

Originally Posted by jschiwal (Post 4574931)
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

Mes9 08-15-2012 05:06 PM

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 (Post 4591032)
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.


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