LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 09-10-2014, 12:26 AM   #16
kewl_samurai
LQ Newbie
 
Registered: Sep 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled

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.
 
Old 09-10-2014, 10:35 AM   #17
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,960
Blog Entries: 46

Rep: Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188
Member Response

Hi,
Quote:
Originally Posted by kewl_samurai View Post
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.
 
Old 09-10-2014, 10:10 PM   #18
kewl_samurai
LQ Newbie
 
Registered: Sep 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
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.
 
Old 09-11-2014, 01:58 AM   #19
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,216

Rep: Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686Reputation: 7686
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.
 
Old 09-11-2014, 10:13 AM   #20
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,960
Blog Entries: 46

Rep: Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188
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.
 
Old 09-12-2014, 04:46 PM   #21
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,176

Rep: Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644Reputation: 3644
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
usb device detection, manual insertion card(smart card) reader problem, zapkhiel Linux - Hardware 4 07-17-2009 09:50 AM
MEPIS: how to mount a flash card in an usb card reader for n00b frenchn00b Linux - General 1 08-06-2008 06:26 PM
USB multi-card reader; only one card can be mounted in Slack 10. KidsWriter71 Linux - Hardware 6 09-11-2004 08:24 PM
Recognizing USB card reader when card is inserted hqo201 Fedora 0 08-02-2004 06:08 PM
USB Card Reader - Linux 2.6.1 matthurne Linux - Hardware 14 02-07-2004 04:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:09 AM.

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