Skip navigation.
Home
Now Shipping Version 7.0

Safely remove USB drive


Posts: 147

I'm very curious to know what is the difference between a simple "umount" and click on "Safely remove" for USB drive?... Because "umount" is not stopping USB drive, but "Safely remove" does! and you really removing it safely without an brutal power off noise. So, which command(s) is/are hidden under "Safely remove"?...

Thanks for any lights! Smiling
Rgds,
-dim

m_pav's picture

there is a difference

Unmount should do just what it says. The icon on your desktop should change to an icon only with no arrows to show it is no longer mounted.

The safely remove should monitor the drives usage and finish any tasks that are running before dismounting the drive and showing the basic icon without any arrows.

Safely remove is best choice, unmounting a drive while it is in use can result in unreadable data on the drive.

Mike P

--------------------
Life may not be the party we thought, but while we're here, we may as well dance.
Break M$'s shackles from your feet and free yourself with Mepis

Ringan's picture

But what if it's mounted using ntfs-3g?

Mike, thanks for the clarification.

But if the drive (formatted as NTFS) had been mounted with ntfs-3g, what does 'safely remove' do?!
Surely you have to unmount using the fusermount command no matter what?

I'm getting nervous about the 100% safe way to remove a NTFS formatted USB drive!

What I see is: - simple

What I see is:
- simple "umount" just flush your data to USB disk and yes disk is ready to be removed, the only problem is the disk drive is not put in 'sleep' or 'stop' mode, so when you remove USB cable you just do a brutal power off on disk drive and with time (doing it tens time per day) you'll simply kill your disk much more early!...

- "Safely remove" is doing both: umount and sleep-alike command, so when you remove your USB cable there is no brutal movement on disk heads!

And what I want to know is what exacly command is used for "Safely remove" beacuse sometime it's present but sometime no... (probably bug, ex: connect 2 USB drives, since you plug the 2nd, the first one has no more this option), but well, it may happen for any reason - but I just want to know how to do the same action via shell command manually Smiling

Rgds,
-dim

Jon Du Quesne's picture

Some Shell Commands

Dim, good questions. I cannot tell you the exact commands used by the "safely remove", but I can give you some shell commands that might do the trick (what are you wanting to do BTW?)

Since you are doing "system stuff" you will want to do these commands as user root (the leading "#" is the root shell prompt; do not enter it)

# flush     # will flush any data in memory to drives
# umount /dev/yourusbdrive

Now, if you can figure out a command to spit the USB drive out of the socket, that would be sweet! Smiling

Jon

No computer is magic, no operating system is magic, no website is magic. They all require human interaction, thought, and responsibility to work.

Probably found!

Jon, I probably found one of possible solutions (or workaround):

*) flush operation is done by 'umount' command itself, but, well, paranoid solution may be to execute 'sync' several times to be sure all data flushed from memory

*) use 'pumount' as it doesn't need root permissions

*) use 'sdparm' to address SCSI specific commands

So well, in my case when my USB disk is seen as '/dev/sda1' by system and mounted as '/media/sda1':

  $ sync; sync; sync
  $ pumount -l sda1
  $ sdparm -C stop /dev/sda1

Works just fine!!! Smiling

Bottom line:
*) I did not have 'sdparm' on my system before (set via apt-get), so "Safely remove" doesn't use it

*) Auto-mount doesn't work anymore, and I need to execute 'pmount sda1' manually now (probably until next reboot, but I don't like reboots)

Well, it's still better than nothing and at least now if I don't see "Safely remove" option within icon menu - I know what I need to do! Smiling

Rgds,
-dim

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.