LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-28-2006, 02:34 PM   #1
HPB
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
fstab, automount usb flash


System info

OS: SUSE 10.1 (DVD.iso)

Current FSTAB

/dev/hda2 / reiserfs acl,user_xattr 1 1
/dev/hda3 /home reiserfs acl,user_xattr 1 2
/dev/hda4 /local vfat users,gid=users,umask=0002,utf8=true 0 0
/dev/hda1 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/dev/sda1 /mnt/usbflash vfat defaults,umask=0222,utf8=true 0 0

The last line, I have put in. The USB flash is formatted with FAT.

After restart of computer, the USB flash is not availeble. If I go to terminal and log in as root, and follow it up by typing "mount -t vfat /dev/sda1 /mnt/usbflash", I can afterwards open my USB flash.

Could a friendly soul please help me, what to alter in the last line of FSTAB.

THX
 
Old 05-28-2006, 02:50 PM   #2
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
add 'users' to your mount options to allow non-root users to mount the drive. Also make sure the permissions are set correctly on the '/mnt/usbflash' folder. Also, were you wanting to mount this read-only? Your umask options are set for this.

Try it like this if you want a specific user to write to this drive:
Code:
/dev/sda1 /mnt/usbflash vfat defaults,users,uid=<username>,gid=users,umask=022, 0 0
Make sure to do this before mounting the drive:
Code:
#chown username.users /mnt/usbflash
#chmod 755 /mnt/usbflash
regards,
...drkstr

Last edited by drkstr; 05-28-2006 at 02:51 PM.
 
Old 05-28-2006, 03:14 PM   #3
HPB
LQ Newbie
 
Registered: May 2006
Posts: 2

Original Poster
Rep: Reputation: 0
FSTAB, automount USB flash, 2.

Quote:
Originally Posted by drkstr
add 'users' to your mount options to allow non-root users to mount the drive. Also make sure the permissions are set correctly on the '/mnt/usbflash' folder. Also, were you wanting to mount this read-only? Your umask options are set for this.

Try it like this if you want a specific user to write to this drive:
Code:
/dev/sda1 /mnt/usbflash vfat defaults,users,uid=<username>,gid=users,umask=022, 0 0
Make sure to do this before mounting the drive:
Code:
#chown username.users /mnt/usbflash
#chmod 755 /mnt/usbflash
regards,
...drkstr
The "chmod 755 /mnt/usbflash" went OK

The "chown username.users /mnt/usbflash" reported something like "operation not allowed". The folowing reported the same, "chown hp.users /mnt/usbflash" and "chmod hp.users /mnt/usbflash"

New FSTAB

/dev/hda2 / reiserfs acl,user_xattr 1 1
/dev/hda3 /home reiserfs acl,user_xattr 1 2
/dev/hda4 /local vfat users,gid=users,umask=0002,utf8=true 0 0
/dev/hda1 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/dev/sda1 /mnt/usbflash vfat defaults,users,uid=hp,gid=users,umask=022 0 0

After reboot, no succes. Help again, please.
 
Old 05-28-2006, 05:06 PM   #4
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
The "chmod 755 /mnt/usbflash" went OK

The "chown username.users /mnt/usbflash" reported something like "operation not allowed". The folowing reported the same, "chown hp.users /mnt/usbflash" and "chmod hp.users /mnt/usbflash"
The '#' before the command indicates that it must be run as root. Is that what you did? You also need to make sure this is done before mounting. Switch over to root with 'su' then run
Code:
#umount /mnt/usbfash
#chown hp.users /mnt/usbflash
I am assuming hp is your username?

If it still does not work, please list the output of 'ls -l /mnt'

regards,
...drkstr
 
Old 05-30-2006, 02:21 PM   #5
_gnomm
Member
 
Registered: Nov 2005
Location: IL
Distribution: Slackware
Posts: 53

Rep: Reputation: 15
ok thanks!!it mounts my flash drive!!
for the first time
but!!!

when i'm plugging it out end then plugging in back can't read it!!

here what i've got:

root@gnom: /home/gnom# umount /mnt/usbflash
umount: /mnt/usbflash: device is busy
umount: /mnt/usbflash: device is busy
root@gnom:/home/gnom# mount -a -t vfat /dev/sda1 /mnt/usbflash -o user,exec,dev,suid,rw,umask=000
mount: special device /dev/sda1 does not exist
root@gnom:/home/gnom#

can you help me??

tnanx!!
 
Old 05-30-2006, 04:06 PM   #6
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Well first off, make sure you ‘unmount’ the device before pulling it out or your Linux box will hate you for it.

Quote:
root@gnom: /home/gnom# umount /mnt/usbflash
umount: /mnt/usbflash: device is busy
umount: /mnt/usbflash: device is busy
If you did not already pull the device out and you still get this error, it means you have a file or directory on the device open. ‘fuser –k /mnt/usbflash’ should take care of that. Once you killed any processes using the device, umount it like normal then remove the device.


Quote:
root@gnom:/home/gnom# mount -a -t vfat /dev/sda1 /mnt/usbflash -o user,exec,dev,suid,rw,umask=000
mount: special device /dev/sda1 does not exist
root@gnom:/home/gnom#
A couple things may cause this. The problem with removable devices is the system device that points to it could change based on what else you have plugged into your usb ports. For instance, if you take your flash device out, then plug something in like an ipod, then plug in your flash device back in; the ipod will get /dev/sda1 and the and the flash device will get the next available /dev/sda2.

If you are using udev with a 2.6 kernel to handle the device creation, most of this stuff should be handled pretty automatically. All you need to do is A) make sure you un-mount before pulling out the device, and b) plug things in the same order and location (usb port) that you did when you created the /etc/fstab. This way it should create the same device name every time.

Regards,
…drkstr
 
Old 05-31-2006, 04:35 AM   #7
_gnomm
Member
 
Registered: Nov 2005
Location: IL
Distribution: Slackware
Posts: 53

Rep: Reputation: 15
ok thanks for reply!!i'll try it,
but where is the sense of automount if i need to type command for unmounting?is there any way not to type comands and to make my linux box to do it automatically?? automount and auto unmount??
 
Old 05-31-2006, 08:40 AM   #8
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
yes, you could write a bash script that automatically mounts the drive when it detects the device file is created by udev, and automatically destroys the device file when the flash drive is removed. Although I wouldn't recommend doing the later unless you really know what you're doing. It would be better just to do 'umount /mnt/usbflash' when you are done using it.

regards,
...drkstr
 
Old 05-31-2006, 09:23 AM   #9
_gnomm
Member
 
Registered: Nov 2005
Location: IL
Distribution: Slackware
Posts: 53

Rep: Reputation: 15
ok, thank you for reply!!!
 
Old 05-31-2006, 04:47 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can use autofs to auto-mount your usb stick. So there is no need to manually (or via /etc/fstab) mount it and you cat unplug it when you want without the need to unmount it first. Take a look here for details.

Regards
 
Old 05-31-2006, 05:35 PM   #11
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Good advice bathory. I've never used this before, I should look into it myself.

regards,
...drkstr
 
  


Reply



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
Mandriva 2006 USB flash Drive Automount casperbg Linux - Hardware 4 10-20-2005 01:43 PM
fstab/automount/dvd-ram problem cjnodell SUSE / openSUSE 3 08-08-2005 02:48 AM
Flash disk automount sixth_sense Linux - Hardware 3 08-07-2005 04:54 PM
Automount network smb share with fstab phatboyz Linux - Networking 2 11-03-2004 12:05 PM
automount vs fstab Walter Sobchek Linux - Networking 10 08-16-2004 09:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration