Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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:
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.
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.
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.
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.
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.
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.
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.
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.
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.
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?
/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.
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 11:58 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.