25

I use a microSD card in my macbook air for additional storage, using a flush adapter (homemade, similar to the nifty minidrive).

To save battery when I'm not using it, I disabled auto-mount using /etc/fstab. But sometimes, I accidentally eject it instead of unmounting (because that's what the finder gui does).

After it's ejected, the only way I know to remount is to take the card adapter out and put it back in. Since it's flush, I need a paperclip to take it out.

So I need a way to re-enable the card reader without having to re-insert.

In Windows, this is possible using the devcon command-line tool from microsoft, or going to device manager, disabling and enabling the card reader.

There has to be a way to do this, so please don't answer just saying it's not possible.

Thanks

3
  • 1
    I appreciate this isn't what you want to hear, but unfortunately, I don't think there is a way to remount once you've ejected a disk (either through Finder, Disk Utility or using diskutil). As you say, if you unmount this disk (rather than eject) using diskutil unmountDisk, for example, then you can simply remount it again afterwards with diskutil mountDisk. That said, take a look at this question which suggests and alternative app and (in the comments) a way to do it using unloading kexts
    – binarybob
    Commented Aug 31, 2012 at 9:13
  • 1
    Thanks for the kernel module unload/reload idea, that makes perfect sense. I don't know why I didn't remember about that, it is equivalent to the Windows way.
    – CoolkcaH
    Commented Sep 1, 2012 at 12:24
  • Does ejecting the SD card actually turn it off / save energy? I'm curious cause I added an entry in fstab to not auto mount it but I'm not sure if it's actually keeping the SD card turned off. Commented Jul 29 at 10:18

8 Answers 8

3

Mountain provides a feature called "Remount USB Storages" to do what you want.

This blog article tells you how to use Mountain to solve common issues with the Nifty MiniDrive like battery drain in sleep mode or how to reattach the SD card after it has been ejected.

Best thing is Mountain installs a privileged helper tool, so you don't have to enter your administrator password every time you want to remount the drive. Also, you can configure Mountain to do its job automatically in the background.

2
  • 3
    Links can break. Please provide a clear answer to ensure the longevity/integrity of your answer for future viewers.
    – 1''
    Commented Mar 8, 2016 at 7:35
  • 3
    Mountain has moved - appgineers.de/mountain Commented Mar 4, 2018 at 2:45
24

On Mountain Lion with built-in SD readers:

sudo kextunload -b com.apple.driver.AppleSDXC
sudo kextload -b com.apple.driver.AppleSDXC
3
  • Works perfectly in El Cap (10.11.4) with my Nifty drive. Very helpful when my laptop battery dies and it falls into hibernation mode, and I want to remount the drive after being plugged back in. (But without having to restart.)
    – Craig Otis
    Commented Mar 24, 2016 at 2:20
  • In HighSierra it says Kext com.apple.driver.AppleSDXC not found for unload request.
    – Necktwi
    Commented Apr 18, 2018 at 18:53
  • Works on my MBP 2012 with High Sierra. :)
    – coolaj86
    Commented Jan 16, 2020 at 11:10
6

Type this in terminal:

sudo kextunload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext; sudo kextload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext

This will unload and load the card reader kernel drivers, and it will appear in diskutil again.

Thanks to binarybob for the pointers.

3
  • It didn't work in HighSierra
    – Necktwi
    Commented Apr 18, 2018 at 18:54
  • Worked for me once, but running it now runs crashes and reboots my macbook :-/ (Mojave)
    – Cyberwiz
    Commented May 3, 2019 at 10:44
  • MacOS 10.14.6 (18G6020) Mojave: (kernel) Can't remove kext com.apple.driver.AppleUSBCardReader; services failed to terminate - 0xe00002c7. Failed to unload com.apple.driver.AppleUSBCardReader - (iokit/common) unsupported function. although kextstat reports no Refs.
    – Devon
    Commented Jul 23, 2020 at 20:07
5

I have built an AppleScript out of Coolkah's solution:

display dialog "Your Administrator Password:" default answer "" with hidden answer
set PWD to text returned of the result
do shell script "sudo kextunload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext; sudo kextload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext" user name "your name" password PWD with administrator privileges
3
  • Great, thanks! I found this page to be very useful in setting up the script. Also, naturally, you much change the "your name" part of the code to your computer's name, otherwise your password will be rejected (I know, I was stupid enough to try). daiya.mvps.org/applescript.htm
    – PatrickT
    Commented Oct 11, 2014 at 7:33
  • To clarify @PatrickT 's comment: "your name" should be your user account name, not your computer's name (I know, I was stupid enough to try ;) ).
    – Gilead
    Commented Dec 30, 2014 at 14:58
  • @Gilead, spot on, thanks for correcting! I was stupid enough to set my computer's name and user account to the same name...
    – PatrickT
    Commented Dec 30, 2014 at 15:02
3

Eject/Remount with a keyboard shortcut (prompts for password)

This is based on roadrunner, which was based on CoolkcaH, and based on the apple guide to using Automator.

How to Create a Workflow with Automator

  1. Launch Automator

  2. Select the "Service" template.

  3. Select "Utilities" from the Library and double-click "Run AppleScript".

  4. To create a service that is always available, select:

"Service receives [no input] in [any application]"

at the top of the Automator screen.

  1. Type the following AppleScript:

    on run {input, parameters}

    display dialog "Your Administrator Password:" default answer "" with hidden answer
    set PWD to text returned of the result
    do shell script "sudo kextunload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext; sudo kextload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext" user name "[UserName]" password PWD with administrator privileges
    
    return input
    

    end run

where the part [UserName] should be replaced by your machine's user name / login account.

  1. Save the service with a unique name. The service will be saved in:

~/Library/Services

  1. Add a keyboard shortcut. Open the Keyboard Shortcuts pane in the Keyboard panel in System Preferences. Click the + sign to add a new shortcut and find the name of the service. Add a shortcut by double-clicking on the right side of the service name. Example: command+option+F12 (you may want to avoid a key combination that could be accidentally pressed).
2
  • 1
    I'd like to add the following free advice, based on my 1-day experience of having an SD card: Go to Spotlight Preferences and add the SD card to the list of things NOT to be indexed: indexing with an SD card seems to be buggy: it goes on in an infinite loop, it copies a million invisible files with extension _. (or something like that), it causes freezes to the cursor every 2 minutes, it drains the battery and, in my experience, heats up so much that the SD card is force-dismounted and you need to reset SMC to get it back.
    – PatrickT
    Commented Oct 11, 2014 at 8:25
  • To prevent a mounted SD card from being indexed by Spotlight, I found the fourth method described in the comments at the bottom of this thread to "survive" unmounts (create a file named .metadata_never_index in the directory you want to exclude): tekrevue.com/tip/…
    – PatrickT
    Commented Oct 13, 2014 at 15:35
2

I am using TheMiniDrive with a microSD card (similar to the Nifty). Running Mavericks on a late 2012 13" MacBook with Retina and built-in SD Card Reader.

CoolkcaH's solution unloading/loading AppleUSBCardReader.kext didn't do anything in my tests.

However, Mark Aufflick's solution unloading/loading com.apple.driver.AppleSDXC did remount an ejected SD card, in one step, without having to go to Disk Utility. I used Automator, per PatrickT's solution, and simply replaced CoolkcaH's code with Mark Aufflick's. Here is the entire code that I used to replace Patrick's in Automator (again, make sure to replace [UserName] with your actual user name):

on run {input, parameters}

        display dialog "Your Administrator Password:" default answer "" with hidden answer
        set PWD to text returned of the result

        do shell script "sudo kextunload -b com.apple.driver.AppleSDXC; sudo kextload -b com.apple.driver.AppleSDXC" user name "[UserName]" password PWD with administrator privileges

    return input
end run
0

Locations moved around in High Sierra

This will reload the SDXC reader.

$ sudo kextunload /System/Library/Extensions/AppleSDXC.kext; sudo kextload /System/Library/Extensions/AppleSDXC.kext
-1

Probably the best solution I've seen on the web:

Unmounting an attached hard drive

diskutil unmount /dev/disk2s1

Volume VM Drive on disk2s1 unmounted

Note how we use the unmount command. We need to specify the location of the partition with its full path (i.e. /dev/disk2s1).

Mounting an attached hard drive. To mount the drive again, without having to take it out and plugging it in again, I can issue this command:

diskutil mount /dev/disk2s1

Volume VM Drive on /dev/disk2s1 mounted

credits

2
  • 1
    This does not work for SD cards, once they are ejected they need to be physically reinserted. (Unless you use another solution on this page) Commented Mar 16, 2018 at 15:08
  • Actually, in my case I don´t need to manually reejact the sd card, I just mount and unmount it with this code
    – Get Jet
    Commented Aug 8, 2018 at 8:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .