[SOLVED] "unmount volume" or "eject volume" to safely remove a flash drive?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
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.
"unmount volume" or "eject volume" to safely remove a flash drive?
When I right click on a flash drive icon on my desktop I get the option to "unmount volume" or "eject volume." I've always just chosen "eject volume" and then removed the flash drive. But now I read somewhere that I should choose "unmount volume" before I can safely remove the flash drive. And some people say I need to click "unmount volume" and then "eject volume" to safely remove it. And some people say "eject volume" is for CDs and DVDs and not flash drives. I just want to know how to safely remove my flash drive. And I might as well ask how it applies to CDs and DVDs too. (I haven't used them yet but will.) Thanks very much!
Eject will dismount - but you have to wait for the buffers to finish flushing before you remove it.
Most flash drives have an activity light for that...
As for CDs/DVDs, it depends... if it is a read only device, no problem.
If you have been writing to a device... you have to wait for buffers to flush to the disk, or you get a coaster...
So if I "unmount" it's safe to remove the flash drive? And then there's no need to "eject," right? And can I safely remove a flash drive from the computer when it's off? And can I safely insert a flash drive when the computer is off?
Last edited by Gregg Bell; 04-27-2014 at 12:08 AM.
Reason: add
So if I "unmount" it's safe to remove the flash drive? And then there's no need to "eject," right? And can I safely remove a flash drive from the computer when it's off? And can I safely insert a flash drive when the computer is off?
Remove only after the dismount/eject and it is off.
umount will only unmount one single partition, eject will unmount all the mounted partitions of that usb drive. umount is ok, you do not need eject, for CD/DVD it will not only umount but open the tray too.
Thank jpollard and pan64 but I still have a few questions:
1)When I have a flash drive mounted, and I want to take it out, is it best to click on "unmount" or "eject"? (If I click on
"unmount" it removes the "eject" option.) (And if I click on the "eject" option, the icon for the flashdrive disappears from the desktop.)
2)So the flash drive should only be removed when unmount or eject is selected and the computer is off?
3)If I forget to hit eject or unmount and turn the computer off, is it okay to remove the flash drive then?
4)Is it okay to insert the flash drive when the computer is off?
5)This statement was confusing: umount will only unmount one single partition, eject will unmount all the mounted partitions of that usb drive. umount is ok, you do not need eject This sounds like "eject" would be better than "unmount" (it would be unmounting the usb drive entirely, so why would unmount be ok and I not need eject?)
Last edited by Gregg Bell; 04-27-2014 at 07:56 PM.
Reason: adding something
DESCRIPTION
Eject allows removable media (typically a CD-ROM, floppy disk, tape, or
JAZ or ZIP disk) to be ejected under software control. The command can
also control some multi-disc CD-ROM changers, the auto-eject feature
supported by some devices, and close the disc tray of some CD-ROM
drives.
The device corresponding to <name> is ejected. The name can be a device
file or mount point, either a full path or with the leading "/dev",
"/media" or "/mnt" omitted. If no name is specified, the default name
"cdrom" is used.
There are four different methods of ejecting, depending on whether the
device is a CD-ROM, SCSI device, removable floppy, or tape. By default
eject tries all four methods in order until it succeeds.
If the device is currently mounted, it is unmounted before ejecting.
1) Either one works. Clearly "unmount" should be used most of the time, unless you also want to eject a DVD/CD.
2) The flash drive should be removed when the LED on it stops blinking i.e. when it finishes writing and then unmounts it. When you give it the command to unmount, it waits for all I/O to be finished and then unmounts, make sure you wait for it to do that.
3) Yes. The shutdown procedure unmounts all mounted filesystems first.
4) Yes.
5) Not really, because you usually mount only one partition at a time and thus only need to unmount one partition.
My understanding (and I just made up all the facts to come to my understanding!) is that "unmount" removes OS access to the data and "eject" physically opens the door and kicks the thing out (like a CD drive opening). To eject something, the OS first unmounts it. So feel free to eject something knowing that the required unmount happens automatically.
However, to unmount something does not require it to be ejected. On things like USB thumbdrives, those aren't physically ejected, so in that case "eject" degenerates into the equivalent of "unmount". So the best the computer can do with devices like this is unmount them, even if you specified eject. YOU are the ejection step - reach in there, grab the thing, and yank it out (AFTER unmounting it, that is).
1) Either one works. Clearly "unmount" should be used most of the time, unless you also want to eject a DVD/CD.
2) The flash drive should be removed when the LED on it stops blinking i.e. when it finishes writing and then unmounts it. When you give it the command to unmount, it waits for all I/O to be finished and then unmounts, make sure you wait for it to do that.
3) Yes. The shutdown procedure unmounts all mounted filesystems first.
4) Yes.
5) Not really, because you usually mount only one partition at a time and thus only need to unmount one partition.
Thanks very much for the great answers, metaschima. Just one little point eludes me. The notion that only one partition is mounted. When the flash drive is mounted just one partition of it is mounted? I'm just not grasping that. And you wrote you "usually" only mount one partition at a time. Well, I'm a newbie, all I know is I'm putting a flash drive in. And one last question (I feel like "Columbo"): I just bought a flash drive that has no led light on it. (I have some that do have lights but this one doesn't.) I mean, when I click on "unmount volume" my computer tells me that the flash drive is unmounted. Just wait a few seconds after that? Thx!
My understanding (and I just made up all the facts to come to my understanding!) is that "unmount" removes OS access to the data and "eject" physically opens the door and kicks the thing out (like a CD drive opening). To eject something, the OS first unmounts it. So feel free to eject something knowing that the required unmount happens automatically.
However, to unmount something does not require it to be ejected. On things like USB thumbdrives, those aren't physically ejected, so in that case "eject" degenerates into the equivalent of "unmount". So the best the computer can do with devices like this is unmount them, even if you specified eject. YOU are the ejection step - reach in there, grab the thing, and yank it out (AFTER unmounting it, that is).
Thanks haertig. Good explanation. Esp. about things unmounted not necessarily being ejected. And thanks for the laugh about me being the ejection step. I guess the only difference I can see (besides what you guys have taught me, that is) between the two is that when I click on unmount the thumb drive icon stays on the desktop. When I click on eject it disappears.
If the computer tells you the volume is unmounted (or the icon disappears), then it's usually safe to assume that it's finished unmounting so there's no need to wait any longer - though it might depend* on the software you happen to be using and the method it chooses to unmount.
Personally, being somewhat old-fashioned and paranoid, I often open a terminal and type
Code:
sync
to make sure - the command prompt doesn't return until all cached data have been written to disc, then I know it's safe to unmount. This is a bit of overkill though, since as others have mentioned, the unmounter will have to* sync the relevant filesystem before it can unmount it.
*There is such a thing as a lazy unmount, which essentially makes the filesystem appear to be unmounted but doesn't necessarily close all open files, so in theory you could unmount a device before everything's finished writing - but I doubt any UI designer would be daft enough to use that method, especially for a removable device.
Last edited by Pastychomper; 04-29-2014 at 06:12 AM.
Thanks very much for the great answers, metaschima. Just one little point eludes me. The notion that only one partition is mounted. When the flash drive is mounted just one partition of it is mounted? I'm just not grasping that. And you wrote you "usually" only mount one partition at a time. Well, I'm a newbie, all I know is I'm putting a flash drive in. And one last question (I feel like "Columbo"): I just bought a flash drive that has no led light on it. (I have some that do have lights but this one doesn't.) I mean, when I click on "unmount volume" my computer tells me that the flash drive is unmounted. Just wait a few seconds after that? Thx!
Well, you can check how many partitions are mounted automatically. Another question would be if clicking "unmount" is unmounting only one partition. As this is part of the GUI it is probably unmounting all partitions on that device. I can't know for sure, but you could experiment and see.
If it tells you that "the drive is unmounted" then it is safe to remove the device, and it likely also implies that it has unmounted all partitions on the device.
If the computer tells you the volume is unmounted (or the icon disappears), then it's usually safe to assume that it's finished unmounting so there's no need to wait any longer - though it might depend* on the software you happen to be using and the method it chooses to unmount.
Personally, being somewhat old-fashioned and paranoid, I often open a terminal and type
Code:
sync
to make sure - the command prompt doesn't return until all cached data have been written to disc, then I know it's safe to unmount. This is a bit of overkill though, since as others have mentioned, the unmounter will have to* sync the relevant filesystem before it can unmount it.
*There is such a thing as a lazy unmount, which essentially makes the filesystem appear to be unmounted but doesn't necessarily close all open files, so in theory you could unmount a device before everything's finished writing - but I doubt any UI designer would be daft enough to use that method, especially for a removable device.
Thanks pastychomper. I think I'm borderline paranoid about this stuff too. Your typing "sync" in the terminal may come in handy, especially since I've got a flash drive without an LED light. Appreciate the feedback.
Well, you can check how many partitions are mounted automatically. Another question would be if clicking "unmount" is unmounting only one partition. As this is part of the GUI it is probably unmounting all partitions on that device. I can't know for sure, but you could experiment and see.
If it tells you that "the drive is unmounted" then it is safe to remove the device, and it likely also implies that it has unmounted all partitions on the device.
Thanks metaschima. Yeah, I'm not that technical (re: partitions). Kind of like, if the darn flash drive works, I'm satisfied. And now I know if the computer says it's unmounted, it's unmounted. Don't make myself crazy worrying about stuff I shouldn't be worrying about. Thanks for all the help.
5) Not really, because you usually mount only one partition at a time and thus only need to unmount one partition.
Not really, if you have more partitions probably they all will be mounted automativally (not only the one you need). Therefore you need to unmount all of them - to be on the safe side.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.