LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-23-2017, 09:38 AM   #1
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Any way to remove usb without unmounting?


Hello
I was wondering if there is any way to make so that you don't have to unmount a usb drive before removing. Like a smartphone you can remove anytime(as long as you're not copying or something). I know unmounting is necessary if you don't want corrupted data. And supposedly sync wears out drives fast. So is there a way to safely remove without unmounting.
Thanks for suggestions.
 
Old 02-23-2017, 10:21 AM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Mill J
is there a way to safely remove without unmounting.
If you mount a horse is there a safe way to get off of that horse without unmounting it?

if one just falls off the horse. You still unmounted the horse. One way or another it gets unmounted.

what you are referring to is what is called hot plugging. If you manually mount a USB port, There is nothing preventing you from just unplugging it. It will not get registered within the system as no longer being there. But you know it is not, because you unplugged it.

Draw backs:
if the system is presently writing to it, data loss.
if the system tries to wite to it, data loss, and a possible error message. Device not present.

that is the reason behind Hot Plugging.

Last edited by BW-userx; 02-23-2017 at 10:39 AM.
 
Old 02-23-2017, 11:14 AM   #3
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,131

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
I think you answered you own question! If the device was accessed while mounted, then corruption is pretty likely.

Also, the filing system will still think the device is there, which can lead to problems. My computer is set up to mount the first usb device as /media/usb, and that is used in my backup script. If I'd accessed another earlier without unmounting it, the backup device would seem to be the second and get mounted under a different name, so the script would fail.
 
Old 02-23-2017, 12:26 PM   #4
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258

Original Poster
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Sorry guys. I should have mentioned my auto-mount will also remove/unmount the mount point AFTER the usb is removed so that is not a problem. So if I synced it would I still have to manually unmount?
 
Old 02-24-2017, 03:57 PM   #5
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,106
Blog Entries: 2

Rep: Reputation: 258Reputation: 258Reputation: 258
I'm not sure what you want to happen here. Your system will not know to unmount the drive until you tell it to.

Only thing I can thing of, is if you had an automated task of some sort, maybe a script that detects a specific usb drive, syncs specific data to it, then umounts drive when finished?
 
Old 02-24-2017, 04:38 PM   #6
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258

Original Poster
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Quote:
Originally Posted by replica9000 View Post
I'm not sure what you want to happen here. Your system will not know to unmount the drive until you tell it to.

Only thing I can thing of, is if you had an automated task of some sort, maybe a script that detects a specific usb drive, syncs specific data to it, then umounts drive when finished?
I use a udev rules script and usb activity triggers it. when I insert a usb it creates a mount point and mounts it. when I unplug the usb it unmounts and removes the mount point.
 
1 members found this post helpful.
Old 02-24-2017, 04:57 PM   #7
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,106
Blog Entries: 2

Rep: Reputation: 258Reputation: 258Reputation: 258
Quote:
Originally Posted by Mill J View Post
I use a udev rules script and usb activity triggers it. when I insert a usb it creates a mount point and mounts it. when I unplug the usb it unmounts and removes the mount point.
What filesystem? Something like vfat might not hold up to unpluging the usb without a proper umount.
 
Old 02-24-2017, 05:25 PM   #8
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Quote:
Originally Posted by Mill J View Post
I use a udev rules script and usb activity triggers it. when I insert a usb it creates a mount point and mounts it. when I unplug the usb it unmounts and removes the mount point.
So you fixed your problem, right?
But if things don't go as expected then the OS will get stuck with the not-unmounted device, right?
 
Old 02-24-2017, 06:28 PM   #9
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258

Original Poster
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Well obviously unmounting is still needed. I was just wondering if anyone knows if you can do something like that. For now we can only dream. On a regular Linux install it is not really a problem. but minimal.... So until someone comes up with a program to do it the answer is yes you can. But NOT recommended.

Thanks
 
Old 02-24-2017, 06:57 PM   #10
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Well, the thing is maybe that Linux is more server-driven, therefore anything that happens unexpectedly is bad and has to be reported but no auto-action has to be taken.

E.g. maybe Windows & OSx are more permissive and say "damn, the device is gone - well, if I lost connection with it then it's probably because the user ejected it", while Linux says "OMG what should I do now - I should probably freeze until the admin does something really clever that fixes the unexpected loss of connection/communication with the device".
 
Old 02-25-2017, 11:50 AM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
in my experience it is ok to just yank the usb stick out - if it isn't an actual rotating hard drive, and if i was only reading from it.
my system never complained, i guess those udev rules just take care of it.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
unmounting usb port Allanitto Newbee Linux - Newbie 5 11-19-2008 10:00 AM
Unmounting USB devices jiml8 Linux - Software 9 07-02-2007 10:27 AM
USB unmounting stork SUSE / openSUSE 1 10-17-2005 03:51 AM
unmounting usb camera matt3333 Slackware 3 10-15-2003 08:16 AM
unmounting my usb drive flinchumj Linux - General 6 05-29-2003 10:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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