LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-29-2007, 11:29 AM   #1
mg92865
Member
 
Registered: Jun 2006
Distribution: Ubuntu
Posts: 35

Rep: Reputation: 16
Cannot unmount usb drive without sudo


I have a external maxtor usb hard drive, formated in FAT32, which is used for backup and to transfer files between windows and ubuntu7.

As the drive is plugged in, it mounts automatically, at /dev/sda1.

Where is the config settings that allows automounting of drives that
are plugged in?

The drive cannot be ejected from the desktop, and the reason provided by
the system is "cannot remove directory". What is happening here?

So I wrote this script to safely unmount the drive:

#!/bin/bash
# Mike
# 10.7.07
echo Unmounting the External Hard Drive
sudo umount /dev/sda1
echo Done

So this works, but it seems there should be a way to configure the
system to allow a user to eject a usb drive. I don't think I want
to modify fstab, since the drive may not be present each time the
computer boots (First hand experience, the system hangs, producing
a real learning experience for a beginner).

What topic should be reviewed to understand this process?

Thank you for any suggestions.

mg92865
 
Old 12-29-2007, 11:40 AM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
You can change the permissions on /sbin/umount command so anyone can use it or using ' visudo ' to edit sudoers file to add just you to use the umount command without a password.

Brian
 
Old 12-29-2007, 11:43 AM   #3
Acron_0248
Member
 
Registered: Feb 2006
Location: Venezuela
Distribution: Gentoo
Posts: 453

Rep: Reputation: 33
Hi,

If you're using Gnome or Kde, there are daemons running to mount new devices as they are connected, things like hal and hotplug are examples of that, however, I would advise that a little modification of the fstab will be a best choice in your case.

Is nothing dificult, this is an example:
Code:
#Device    #Mount point   #Filesystem   #Options        #Dump #Pass
/dev/sda1  /media/usb     vfat          user,rw,noauto  0     0
This will cover the basics to fit your needs, the 'user' option will let you (as a normal user) mount and umount the device, 'rw' gives you write access and 'noauto' is to avoid that problem of "the drive may not be present each time the computer boots", noauto basically don't let a device to be mounted every time you or the systems call 'mount -a'.

With that configuration, you can add an icon on your desktop to mount and umount the device without sudoing.



Regards
 
Old 12-29-2007, 12:05 PM   #4
mg92865
Member
 
Registered: Jun 2006
Distribution: Ubuntu
Posts: 35

Original Poster
Rep: Reputation: 16
changed umount in /bin not /sbin?

I searched for and found umount command, and its permissions were for root not for users. So from sudo nautilus, I changed the ownership, group and other to read/write, so I think (but don't know) that I have changed the permissions. Rebooted, but umount is still not allowed.

I will go back and review the information on both the sudoers file, its modification, and the mod to the fstab that have been suggested. Thanks for pointing out what I need to review.

mg92865
 
Old 12-29-2007, 01:09 PM   #5
steve02169
Member
 
Registered: Feb 2007
Location: Quincy, MA USA
Distribution: Fedora Core 6
Posts: 96

Rep: Reputation: 15
Quote:
Originally Posted by mg92865 View Post
...So from sudo nautilus, I changed the ownership, group and other to read/write, so I think (but don't know) that I have changed the permissions...

mg92865
You forgot execute, which is required to run umount.

(I also recommend the fstab solution, though)
 
Old 12-29-2007, 01:18 PM   #6
crenclan
Member
 
Registered: Mar 2006
Location: North Ga. USA
Distribution: various
Posts: 39

Rep: Reputation: 15
Question

When I plug my ext hdd in it mounts automatically & shows a desktop icon. To unmount I right click the icon then left click unmount. This seems pretty simple. Am I missing something ? Am I doing it wrong ?
My current distro is Mint, which is basically ubuntu 7.10. I've done it this way with other distros also.
 
Old 12-29-2007, 01:19 PM   #7
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by Acron_0248 View Post
Hi,

If you're using Gnome or Kde, there are daemons running to mount new devices as they are connected, things like hal and hotplug are examples of that, however, I would advise that a little modification of the fstab will be a best choice in your case.

Is nothing dificult, this is an example:
Code:
#Device    #Mount point   #Filesystem   #Options        #Dump #Pass
/dev/sda1  /media/usb     vfat          user,rw,noauto  0     0
This will cover the basics to fit your needs, the 'user' option will let you (as a normal user) mount and umount the device, 'rw' gives you write access and 'noauto' is to avoid that problem of "the drive may not be present each time the computer boots", noauto basically don't let a device to be mounted every time you or the systems call 'mount -a'.
In addition to this, I recommend writing a udev rule for the device. See this for some info.
 
Old 12-30-2007, 09:15 AM   #8
mg92865
Member
 
Registered: Jun 2006
Distribution: Ubuntu
Posts: 35

Original Poster
Rep: Reputation: 16
Unable to mount the usb drive with suggested changes

Well, I believe I need additional help on this issue. This is the line that I entered in the fstab file, but the system complains that mount point for /media/usb does not exist.

/dev/sda1 /media/usb vfat user,rw,noauto 0 0

The system boots fine, I can mount drive myself using

mkdir mymount
sudo mount /dev/sda1 mymount

If I want to eject the drive the system complains that /media/usb does not exist

I am not really clear about mount points. How do I actually create a persistent mount point?
I use a mount point with partition image software but it seems to be temporary, as I have to create it each time I use it.

Thank you,

mg92865
 
Old 12-30-2007, 09:32 AM   #9
Acron_0248
Member
 
Registered: Feb 2006
Location: Venezuela
Distribution: Gentoo
Posts: 453

Rep: Reputation: 33
Because the example I did was using as 'mount point' /media/usb which is a directory that won't be created by it self or by the system, you have to do that.

If you create for instance:

mkdir /media/mymount

Then, in the fstab you change /media/usb to /media/mymount

So, you have to change the fstab to use the mount point you've created, whatever it is.




Regards
 
Old 12-30-2007, 10:20 AM   #10
mg92865
Member
 
Registered: Jun 2006
Distribution: Ubuntu
Posts: 35

Original Poster
Rep: Reputation: 16
What does "media" represent?

So in your example you use /media/mymount. I see that mymount is the mount point I have created, but I am unclear as to what "media" represents.

Before attempting these changes, I used this external usb drive to hold partition images in case of crash. I would each time use
mkdir backups
sudo mount /dev/sda1 backups

and the volume would be available for writing in partimage software.

Would you explain what "media" represents in your example?

Thanks,

mg92865
 
Old 12-30-2007, 10:56 AM   #11
Acron_0248
Member
 
Registered: Feb 2006
Location: Venezuela
Distribution: Gentoo
Posts: 453

Rep: Reputation: 33
/media is a standard directory used by distros to mount removeable devices.

Any distro that follows the Filesystem Hierarchy Standard (FHS), will set all removeable devices to be mounted at /media.

Of course, you don't have to follow this standards if you don't want to, but standards where made to have an order and common structures among distributions.

You can read more about it in the Mount Point For Removeable Media at FHS.

If you type only:

mkdir mymount

at a console, the directory will be created inside the current directory, normally you see this at the prompt console or using the command pwd. Let's say that you're at:

/home/mg92865

And you type mkdir mymount, then, you should have this directory:

/home/mg92865/mymount

That will be the 'mount point' you need to add in the fstab.




Regards

Last edited by Acron_0248; 12-30-2007 at 10:58 AM.
 
  


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
How to fix USB Pen Drive unmount problems with slack 9.1? asowani Linux - Software 4 04-24-2008 03:16 AM
USB Flash drive works great, BUT I can't unmount it?? Balarabay1 Linux - Hardware 6 11-20-2006 01:02 PM
Unmount USB Drive stevsom Linux - General 2 05-15-2005 12:21 AM
flash drive won't unmount MiniMe001 Linux - Software 3 11-12-2004 08:36 PM
do I need to unmount a hard drive? d'oh! Linux - Newbie 3 02-11-2004 03:28 PM

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

All times are GMT -5. The time now is 06:05 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