Solved

Do I Really Need to “Eject” USB Drives?

Posted on 2016-12-01
10
60 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 92

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
 
LVL 28

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 92

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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 37

Expert Comment

by:Bing CISM / CISSP
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 28

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:Bing CISM / CISSP
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 28

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:Bing CISM / CISSP
ID: 41910383
> Macs are not really corporate environment (Windows infrastructure) ready.

+1

Macs are today's "personal"  computers.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will cover some tips for successfully installing the new update to OS X; 10.5.7. Although the information contained within could be used for any OS X point release.  Please note that this information applies to point releases to a parti…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
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 …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now