Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
12-14-2008, 07:57 PM
|
#1
|
|
Member
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 408
Rep:
|
How to stop mounts on /media when inserting a USB device. (SD, Flash, etc.)
Hi group,
I thought I had posted this questions before but I can't find it if I did.
I need to stop my Linux system from mounting USB drives as /media/xxxn. My problem is I am attempting to create a script that I can use to build a file system on an SD card. When I use fdisk and create the partition, the kernel will use the old partition configuration until it is 'ejected' or a system reboot. I can do an 'eject' then I must re-plug the card and then the system does the mounts. I don't want it to do this!
Or is there a way to re-read the partition tables so that I don't need to eject and re-plug?
Thanks for your time.
|
|
|
|
12-14-2008, 09:21 PM
|
#2
|
|
Senior Member
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853
Rep:
|
Take a look at the files in /etc/udev/rules.d/.
You will probably have to configure the UDEV rules.
|
|
|
|
12-15-2008, 06:24 AM
|
#3
|
|
LQ Newbie
Registered: Feb 2008
Posts: 2
Rep:
|
instead of doing an "eject" just , then you should be able to run fdisk on the device.
|
|
|
|
12-15-2008, 07:26 AM
|
#4
|
|
LQ Newbie
Registered: Jan 2007
Location: Lodz, POLAND
Distribution: Debian 4.0, Ubuntu 6.10, Gentoo 2006.1 (x86/amd64)
Posts: 4
Rep:
|
|
|
|
|
12-16-2008, 03:30 PM
|
#5
|
|
Member
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 408
Original Poster
Rep:
|
Must use eject and not umount
Quote:
Originally Posted by zyrotec
instead of doing an "eject" just , then you should be able to run fdisk on the device.
|
The problem is that the old partition map is still in the kernal's memory. So I need to use eject.
|
|
|
|
12-16-2008, 04:39 PM
|
#6
|
|
Member
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 408
Original Poster
Rep:
|
That works
Quote:
Originally Posted by SirYes
|
I tried using parted and that works better but it still mounts the file systems if the partition table has changed.
It does modify the kernel's partition table.
Thanks.
Last edited by MrUmunhum; 12-16-2008 at 04:41 PM.
|
|
|
|
12-17-2008, 12:33 AM
|
#7
|
|
Senior Member
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Rep:
|
Quote:
Originally Posted by MrUmunhum
Hi group,
I thought I had posted this questions before but I can't find it if I did.
I need to stop my Linux system from mounting USB drives as /media/xxxn. My problem is I am attempting to create a script that I can use to build a file system on an SD card. When I use fdisk and create the partition, the kernel will use the old partition configuration until it is 'ejected' or a system reboot. I can do an 'eject' then I must re-plug the card and then the system does the mounts. I don't want it to do this!
Or is there a way to re-read the partition tables so that I don't need to eject and re-plug?
Thanks for your time.
|
hdparm -z allows forces kernel to re-read partition table of drive. Not sure if it can be used on usb drives.
|
|
|
|
12-18-2008, 09:27 AM
|
#8
|
|
Member
Registered: Feb 2008
Location: Bangalore, India
Posts: 66
Rep:
|
for me a combination of umount /media/XXX and partprobe does the trick.
|
|
|
|
12-18-2008, 01:30 PM
|
#9
|
|
LQ Newbie
Registered: Oct 2008
Posts: 2
Rep:
|
This depends largely on what is performing the automount. Many distros set up the desktop environment to perform the automount, in which case, you would need to find the setting in that environment to disable automounting. Some use backend scripts to perform the mount (ie, I've use a combination of udev,pmount, and kludges to make things work my way before).
What distro and what desktop environment are you using?
|
|
|
|
12-19-2008, 02:36 PM
|
#10
|
|
Member
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 408
Original Poster
Rep:
|
Quote:
Originally Posted by pcallycat
This depends largely on what is performing the automount. Many distros set up the desktop environment to perform the automount, in which case, you would need to find the setting in that environment to disable automounting. Some use backend scripts to perform the mount (ie, I've use a combination of udev,pmount, and kludges to make things work my way before).
What distro and what desktop environment are you using?
|
Well I am currently using Fedora Core 8 and Gnome, but I am looking for a universal fix. Have not tried at init 3 level.
|
|
|
|
12-19-2008, 02:37 PM
|
#11
|
|
Member
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 408
Original Poster
Rep:
|
Quote:
Originally Posted by ErV
hdparm -z allows forces kernel to re-read partition table of drive. Not sure if it can be used on usb drives.
|
Yes, that does work. But it still does the mount.
|
|
|
|
12-19-2008, 04:11 PM
|
#12
|
|
LQ Newbie
Registered: Jan 2007
Location: Lodz, POLAND
Distribution: Debian 4.0, Ubuntu 6.10, Gentoo 2006.1 (x86/amd64)
Posts: 4
Rep:
|
Quote:
Originally Posted by MrUmunhum
Yes, that does work. But it still does the mount.
|
Do I really have to do the googling for you? ... 
Anyway: http://www.google.com/search?q=ubunt...vent+automount
Here are good clues:
http://ubuntuforums.org/showthread.php?t=13692
Quote:
|
Originally Posted by init1
Quote:
|
Originally Posted by marquivon
|
From that page, this works for me
Quote:
There is a solution but you will have to enter your password every time you want to mount a removable device:
1. Press Alt+F2 and enter:
polkit-gnome-authorization
2. Go to Storage => Mount file systems from removable drivers
3. Press the "Edit..." button
4. Choose "Active Console: Authentication"
5. Press the "Modify..." button
|
|
And this one is good too:
Quote:
|
Originally Posted by super_hill
|
|
|
|
|
12-20-2008, 03:21 PM
|
#13
|
|
Member
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 408
Original Poster
Rep:
|
[SOLVED] It is a Gnome thing on my system
Thanks for all of your responses. The one that I found useful was: System->Preferences->Hardware->Removable Devices
Then disable the first two lines in the Stoarge sections:Mount removable drives
Mount removable media Thanks again for your time.
|
|
|
|
06-16-2009, 08:38 PM
|
#14
|
|
Member
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 408
Original Poster
Rep:
|
I hate FC10, what a POS!
Quote:
Originally Posted by MrUmunhum
Thanks for all of your responses. The one that I found useful was: System->Preferences->Hardware->Removable Devices
Then disable the first two lines in the Stoarge sections:Mount removable drives
Mount removable media Thanks again for your time.
|
This option is not available in FC10, along with a lot of other stuff that used to be there!
|
|
|
|
06-26-2009, 08:34 PM
|
#15
|
|
Member
Registered: Jul 2003
Distribution: Currently Suse 11.1 but have RH7,8,9 / Fedora 7,8_64,9_64,&10_64
Posts: 634
Rep:
|
durned fedora 10
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:03 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.
|
Latest Threads
LQ News
|
|