25

I frequently eject an usb stick, and then realize I still need it.

If I unmount the drive in Disk Utility, I can just remount it, but if I eject, it's gone.

  • Not showed in Finder
  • Not showed in diskutil
  • Not showed in ls /dev
  • Is still showed in System Information under USB.

How can I mount the disk without unplugging and inserting it?

quack quixote
  • 42,186
  • 14
  • 105
  • 129
Pepijn
  • 555
  • 1
  • 6
  • 12
  • 1
    Had a similar question pop up here for Windows. A way to make that work was to disable the USB root hub the device was connected to and re-enable it, which then initialized the usb stick. A similar methodology may work for this issue, I just am not familiar with the OS in question to guide you through a similar process. – DHayes Feb 19 '10 at 14:00
  • @DHayes @Pepijn - indeed, there are a couple of q's on StackOverflow on the same issue, but they seem to be about Windows. http://stackoverflow.com/questions/916296/how-can-i-cycle-a-usb-device-from-c/919836#919836 .. http://stackoverflow.com/questions/138394/how-to-programatically-unplug-replug-an-arbitrary-usb-device – quack quixote Feb 19 '10 at 15:15
  • the reason the "disable/enable USB root hub" works is because initiating a USB slave device happens when the *slave* detects it's plugged in, not from the host side. but when you do it to the hub, it forces all the connected devices to disconnect/reconnect. now what you need is a way to identify the hub, disable it, then re-enable it. note this will reset all other devices on that hub. – quack quixote Feb 19 '10 at 15:20

5 Answers5

10

Terminal Command was off by a little. The real command is:

diskutil mountDisk <<diskx>>*

where you replace <<diskx>> with the disk number you found using

diskutil list

Eample:

diskutil mountDisk disk3

will mount the disk with the id of disk3

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
buffasaur
  • 101
  • 1
  • 2
  • 2
    You can also specify the name of the disk like `diskutil mountDisk "Western Digital"`. – Lri Jun 12 '12 at 04:23
8

You can remount an ejected hd using "hdiutil attach" and the appropriate /dev/ device (the BSD name under System Information). As you said, this does not work for flash drives (the /dev/ device will disappear).

kextunload IOUSBMassStorageClass.kext;
kextload /System/Library/Extensions/IOUSBMassStorageClass.kext

Will unmount and remount all USB storage devices...

quadruplebucky
  • 529
  • 2
  • 7
  • Where do I find the BSD name under System Information? Do you mean system profiler? – AndyL Apr 15 '10 at 23:53
  • http://hints.macworld.com/article.php?story=20070712062603762 suggests `system_profiler SPFireWireDataType | grep "BSD Name: disk.$"` but I get no output at all from that -- `system_profiler SPFireWireDataType` just lists my FireWire speed, nothing else. Maybe the cable is faulty or something... – tripleee Oct 08 '14 at 16:33
8

If you are using a Mac, one solution is to simply put your computer to sleep and then wake it up again. It's a great solution if you're feeling lazy, but it will obviously be faster to just unplug and re-insert your drive.

  • 3
    Perfect. I was lazy, and as my laptop is 10 feet away from me, and unplugging would involve standing up, this would be my accepted solution! – maxwellb May 28 '13 at 06:01
1

I've had the same problem with external USB & Firewire drives; you eject them using 'disk utility' (perhaps by mistake) only to have to physically disconnect/reconnect the drive in order to get Mac OS X to see them again; despite them being visible under 'System Profiler'.

This is more than an inconvenience if using a daisy-chain of Firewire HDDs...

Here's what worked for me; try this from within Terminal. (1st make sure you have 'diskutil' installed - see note below.)

cmd line:

diskutil list

diskutil mountDisk /dev/diskx

where diskx correlates to the physical device reference as displayed under the "list" command e.g. disk2

NB: try MacPorts for http://www.macports.org/

Lri
  • 40,894
  • 7
  • 119
  • 157
0

I recently released an app exactly for this purpose called Mountain. Mountain can unmount external drives as well as remount them later.

Oliver Salzburg
  • 86,445
  • 63
  • 260
  • 306
  • 1
    It's great that you wrote an application that solves this issue, but it would be preferable if you would also explain **how** to use it to solve the issue. – Oliver Salzburg Sep 26 '12 at 11:38
  • Hi Oliver, you can download a trial version of Mountain from http://appgineers.de/mountain It is nearly self explaining. Simply use Mountain to unmount your USB drive. Afterwards Mountain will allow you to remount the drive again. – Jan Linxweiler Oct 09 '12 at 15:26
  • I have no use for the application myself. I just wanted to remind you that we prefer answers that go into detail about solutions. Given that you wrote this application, you have every option to give it a proper presentation. You may want to have a look at http://meta.superuser.com/questions/5329/how-do-i-recommend-software-in-my-answers – Oliver Salzburg Oct 09 '12 at 15:36
  • Does it also shuts of USB fan automatically when the Mac goes to sleep? Please see (https://apple.stackexchange.com/questions/157826/how-do-i-shut-off-a-usb-fan-automatically-when-the-mac-goes-to-sleep) @JanLinxweiler – alper Jul 20 '20 at 00:28