Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a 64GB SanDisk SDXC memory card which I would like to use with my MacBook Pro and its SD card slot. However, I am having some trouble formatting/partitioning my SD card and I can't figure out what's going on.

  • When I insert the SD card into the slot, I get the following from Lion: The disk you inserted was not readable by this computer. Initialize... Ingore or Eject

  • If I open up Disk Utility, I see the disk listed as Apple SDXC Reader Media and when I try to format from "Erase" tab (as exFAT or any other format), I get the following error: Disk Erase failed with the error: Unable to write to the last block of the device.

A little background: the SDXC card was working fine when I first purchased it. But then I started using sabnzbd http://sabnzbd.org/ to download and write files directly to the SD card. Something happened (I can't remember what the error was!) and since then I've been unable to write to my card. I've been trying to format it to solve the problem, but it looks like the issue runs pretty deep.

What is the best way to format the card to exFAT via terminal? That may be the next thing I try.

Do you have any suggestions for formatting/fixing this SD card?

share|improve this question
    
How old is the card? If it is old, it might just have a bad block that you can't use anymore. If you want to try through terminal, check out diskutil. –  ughoavgfhw Feb 1 '12 at 16:59
    
I bought it in 2011, so it's relatively new. Also, I believe SDXC is relatively new. I've checked out diskutil, but I get the same error –  Patrick DeVivo Feb 1 '12 at 19:20

1 Answer 1

The following procedure should format your SD card to make it usable again and cause bad sectors on the card to be remapped if that is part of your problem. Warning, erasing the wrong drive could make you cry so make sure that you know what you are doing.

  1. Before inserting the SD card into your Mac, make sure that the write protect (lock) switch is turned off
  2. Open a Terminal window and type diskutil list
  3. Insert card
  4. If an OS X messages pops up asking you to "Initialize... Ingore or Eject", choose "Ignore"
  5. From the Terminal windows, type diskutil list once again
  6. Examine the difference between the two Terminal outputs to determine the disk number for your SD card. You should be looking in the left most column for something like /dev/disk3 or 4 or 5 etc.
  7. Now type diskutil unmountDisk /dev/disk# where # is the number you determined earlier
  8. Here is where you must be VERY CAREFUL. Enter the following sudo dd if=/dev/zero of=/dev/rdisk# bs=64k and be sure to replace the # with the previous disk number. Note the 'r' in front of the rdisk in case you are typing this by hand instead of copy/pasting the text. You should be prompted for your password to run this command because it is dangerous
  9. Be patient until it finishes. You can estimate time by opening the "Activity Monitor" application in Utilities and clicking on the "Disk" tab. At the bottom you should see the Data written/sec in red. It should be some number in MB like 5. (64 x 1000 / n) / 60 = minutes until it finishes where n is the rate in MB that you just determined or 5 in my example
  10. Once the previous command completes, the card should be completely erased and ready for formatting. At this point you can close your Terminal and open the Disk Utility application to create an exFAT partition like you were trying to do earlier.
share|improve this answer
    
Michael Yasumoto - I just tried to do your method, and I got this Input/Output error: > dd: /dev/rdisk1: Input/output error > > 16385+0 records in > > 16384+0 records out > > 1073741824 bytes transferred in 68.214149 secs (15740749 bytes/sec) Any thoughts on that? –  CyriouslyDylan May 7 at 19:24
    
That message is not an issue. It is because the math doesn't add up. For speed purposes we write 64kB to the card at a time but the size of the card was not evenly divisible by 64kB so the last chunk of 64kB wasn't written to the drive. Basically you tried to erase 1.01GB on a card that only has 1.00GB of space and it is complaining that there are left over 0's it couldn't write. If this helped you, please +1 the answer. Thanks. –  Michael Yasumoto May 7 at 23:31
    
For step 8, you need to be logged in with an Administrator account in order to run sudo –  patrix Jul 15 at 10:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.