Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Do I Really Need to “Eject” USB Drives?

Posted on 2016-12-01
10
77 Views
Last Modified: 2016-12-02
when i unplug my usb drives from mac, mac alerts me that it will damage the devices
0
Comment
Question by:Yicai Weng
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 41909096
'eject' flushes any cached data and directory entries to the drive.  May not be needed if you are only reading from the drive but it is a good idea if you have written anything to it.
3
 
LVL 88

Expert Comment

by:rindi
ID: 41909121
Just pulling out the drive doesn't damage it, but it can corrupt the file-system and files on it. Ejecting prevents that from happening.
0
 
LVL 93

Expert Comment

by:John Hurst
ID: 41909124
As noted, always Eject first. With Windows 10, the first eject may say "busy". Wait 10 seconds and eject again. That normally works.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 29

Expert Comment

by:serialband
ID: 41909160
I've never actually lost anything or corrupted anything when I just yanked the drive.  The main danger of corruption comes from voltage fluctuations on the data lines when power is disconnected, but USB is designed to disconnect the data lines before the power lines.  I have purposely tested it during a write and it just didn't finish writing the file.  The file data was probably partially written, but the actual file table does not get written until the data is complete.  However, it's not something you want to do continuously.  It's always best to just eject the device first to make sure you don't lose data.

Sometimes the system is stuck and can't eject or you don't want to spend time finding which of your open Terminal Windows has a current path set to the USB.  Sometimes it's spotlight.  I suggest you turn off spotlight on external USB storage if you're going to be unplugging the device frequently.

If spotlight is delaying your eject, you can force it to stop by shutting off mdutil on it first and you can then eject it.
mdutil -i off /Volumes/USBDrive

If you want all Macs to stop indexing your USBDrive, then do the following:
cd /Volumes/USBDrive
rm -rf .{,_.}{fseventsd,Spotlight-V*,Trashes}
mkdir .fseventsd
touch .fseventsd/no_log .metadata_never_index .Trashes
1
 
LVL 93

Expert Comment

by:John Hurst
ID: 41909165
I've never actually lost anything or corrupted anything when I just yanked the drive

I have, so I use care. Think twice, yank once and be careful
0
 
LVL 37

Expert Comment

by:bbao
ID: 41909412
> The file data was probably partially written, but the actual file table does not get written until the data is complete.

how about ejected just when writing the directory block, volume bitmap and file record after all file data is complete? you got a corrupt file system.

the shorter data lines in USB connector is for preventing physical damage from accidental operations, not for protecting file system.

so never do that, always eject before unplugging.

> If you want all Macs to stop indexing your USBDrive, then do the following

thanks for sharing the hint.

what do you mean by "all Macs"?
0
 
LVL 29

Expert Comment

by:serialband
ID: 41909578
what do you mean by "all Macs"?

It should cause any Mac you plug it into to see that file structure and tell it to not Spotlight index the USB storage.  This means you can't do spotlight searches on that external storage.

As for curruption:
I generally don't yank it during critical writing phases.  I've only yank it when the system is stuck and I know there shouldn't be any writes, just some command prompt or previous program has an open path to the system.  I've only ever purposely tested a removal of a large file during a write phase.  If you yank it while it's writing the File Table or Directory Block, then you can mess up the file table and cause corruption.  Just removing it during the data phase will cause it not to save the data.  If you have a file open, but not writing, you will basically lose unsaved data.  If you understand how the process works, you can easily avoid data corruption.  I haven't corrupted any external storage when I've forcibly removed them.  Sometimes you have to forcibly removed them and generally, those are backups of backups.  I don't use them as primary data stores.
1
 
LVL 37

Expert Comment

by:bbao
ID: 41910236
> This means you can't do spotlight searches on that external storage.

i love spotlight but i do hate the "shits" the indexing engine leaves on external drives.
0
 
LVL 29

Expert Comment

by:serialband
ID: 41910361
Unfortunately, Spotlight causes lots of issues on mounted drives, both USB external and Windows shares.  I have to turn it off for all users on external storage to reduce problems with user access and file and folder locking on windows shares.  It's designed for permanent storage with single user access in mind.  It's a little less troublesome to just teach them to run ls with regular expressions or find in terminal to find things on mounted Windows shares.  Macs are not really corporate environment (Windows infrastructure) ready.
1
 
LVL 37

Expert Comment

by:bbao
ID: 41910383
> Macs are not really corporate environment (Windows infrastructure) ready.

+1

Macs are today's "personal"  computers.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you new to OS X?  This helpful advice could get you quickly up to speed if you are making the transition from windows or totally new to OS X. Finder gives you the visual connection between you and the files located on the hard drive of your A…
If you are using Mac OS X and have a large number of login items set up in accounts, under system preferences, you may find that your computer is sluggish and unresponsive during startup until everything is done launching. Another problem that a…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question