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.
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.
|
|
|
09-10-2014, 12:26 AM
|
#16
|
LQ Newbie
Registered: Sep 2014
Posts: 7
Original Poster
Rep:
|
like i said, manual option is always available. but thats not what i want to do. i want to happen it automatically and i dont care if umount command fails. But i should be able to trigger umount command automatically.
I agree that one should syn, umount and then remove sd card. Thats normal, but what about abnormal scenarios. Thats what i am trying to implement. So please help in that direction.
|
|
|
09-10-2014, 10:35 AM
|
#17
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,960
|
Member Response
Hi,
Quote:
Originally Posted by kewl_samurai
like i said, manual option is always available. but thats not what i want to do. i want to happen it automatically and i dont care if umount command fails. But i should be able to trigger umount command automatically.
I agree that one should syn, umount and then remove sd card. Thats normal, but what about abnormal scenarios. Thats what i am trying to implement. So please help in that direction.
|
What exactly do you mean by "Thats normal, but what about abnormal scenarios"? What do you consider as abnormal scenario?
If you are using KDE then by opening 'Dolphin' file manager you can right click on the device (left side of panel) then select to 'Remove Device safely <device to remove label>' action.
You really need to explain or define the scenario you have in mind. No system will have a 'embed mind interface', just like LQ we need you to provide a detailed explanation of action. You must provide the same to any event within a system to get the desired result. To see if your actions are indeed doing something allowed by the system, you need to discern your action to allowable event on the system. A whimsical desired action may not be allowed nor serviceable.
|
|
|
09-10-2014, 10:10 PM
|
#18
|
LQ Newbie
Registered: Sep 2014
Posts: 7
Original Poster
Rep:
|
Hi,
Abnormal scenario: Someone plugs out sd card from usb card reader without safe removal.
As explained, i want to handle this scenario, where i want the mounted filesystem to go away as card is removed.
One way is to umount when card is plugged out.
So here is steps which might help you to understand what i wrote
1. SD Card is inserted in usb card reader
2. Usb card reader is connected to linux system
3. udev rule automatically mounts the card to /media/usb-sdxxxx
4. Anyone who has access to linux system can browse the card now
5. Someone comes and removes sd card (not card reader), only sd card
CURRENTLY 6. mounted file system remains, i can see in list /media/usb-sdxxx if i run command mount
EXPECTED:6. udev rule or some module will handle sd card removal and unmount or remove mounted file system so that i dont see /media/usb-sdxxx when i run command mount
I hope its clear now what i expect.
Another note: As i am new to this forum, i want to know if i have to write reply from beginning or just reply and expect the other member will read my earlier post in this forum ?
Currently i am just replying expecting others will read my earlier post, so i reply to post to my question only. Assuming my original post and other reply still valid. if you read only one post other than main post then its confusing.
|
|
|
09-11-2014, 01:58 AM
|
#19
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,216
|
anyone can read all of your posts, so you do not need to repeat yourself. If someone interested he can look for your previous posts.
To the question: probably you missed a very important point of this process. What you expect is not the normal behaviour of the system, therefore usually that will not happen.
The main problem is that after removing the card (your point #5) the system has no chance to properly umount that card. Actually the state of the system (i/o subsystem) cannot be determined and therefore that event cannot be processed properly. Your wish looks like a very convenient way to handle that situation, but also it looks like noone could implement this solution until now.
|
|
|
09-11-2014, 10:13 AM
|
#20
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,960
|
Member Response
Hi,
I did read the thread and requested the OP to clarify his perspective. OP response is clear that he wants to remove a stale mount point of device file when someone has removed the device without dismount. You should be able to use 'rm' to remove the stale <device file>. Do a 'man rm' to understand;
Quote:
NAME
rm - remove files or directories
SYNOPSIS
rm [OPTION]... FILE...
DESCRIPTION
This manual page documents the GNU version of rm. rm removes each specified file. By default, it does not remove directories.
If the -I or --interactive=once option is given, and there are more than three files or the -r, -R, or --recursive are given, then rm prompts the
user for whether to proceed with the entire operation. If the response is not affirmative, the entire command is aborted.
Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not given, or the -i or --interactive=always option
is given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped.
|
From 'cli', proper order would be to sync the filesystem then provide the umount or GUI use a file manager <safely remove> for the device to provide a secure dismount of the device file.
Hope this helps.
|
|
|
09-12-2014, 04:46 PM
|
#21
|
Moderator
Registered: Mar 2008
Posts: 22,176
|
I think it needs to be mounted as a portable drive much like windows does. So that it is in sync at all times. Most sd cards connect like an ide drive so you may have to change something by uuid to fix this.
|
|
|
All times are GMT -5. The time now is 10:09 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
|
|