[SOLVED] Any way to remove usb without unmounting?
Linux - SoftwareThis 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
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.
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.
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.
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.
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?
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'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.
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.
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?
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.
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".
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.