Reformat Hidden Partitions on a Compact Flash disk on Mac osX

 by snotty
Here is one way to get rid of stubborn partitions. There are some kinds of partitions that Disk Utility in Mac osX won't show you because it's stupid.

Briefly a bit of background: I got an ipod 3rd generation for free because the battery was dead. I installed a new battery and somehow killed the ancient hard drive. I replaced the hard drive with a compact flash card (make sure it is ATA-compliant or you will enter a world of pain) using a 1.8 adapter.

Anyway, it seemed to work at first but something got a bit weird with the card and I couldn't reformat it with Disk Utility.

Before you read on, try putting the CF card in a digital camera and formatting it with that.

I don't have an appropriate camera and more sophisticated disk software cost money so I went oldschool and looked for command-line software. As it turns out there is a great program called diskutil included in the Terminal (aka the mac osX command prompt).

diskutil showed me the hidden partitions and helped me reformat them. And it was free.

Here is how I did it.

**** The iPod is still giving me some trouble so this may not work for you. It sort-of works for me but not every time. ****


Step 2: Format That Pesky Partition

Now that we know which partition we want to wipe clean, let's do it!

Still in the Terminal, type in: diskutil eraseVolume hfs+ woot disk1s1

diskutil is the program of course.
eraseVolume is the command for diskutil.
hfs+ is the file system or format that I chose arbitrarily. I think diskutil can write many formats.
woot is the new name of the partition.
disk1s1 is the identifier for the target partition. It took me a while to figure that one out.

And that's all folks.

Now to find what caused the partition to get all freaky in the first place...
MixMasterM says: Jul 20, 2010. 4:18 PM
Another idea that comes to mind is to use dd to wipe the entire card, and then format it in the camera.
snotty (author) in reply to MixMasterMJul 22, 2010. 3:02 AM
Sounds interesting. Can you tell me how to wipe a card using dd? All I can find about dd is that it's for copying. How do I erase with it?
MixMasterM in reply to snottyJul 22, 2010. 8:46 AM
Yep, dd basically is "data duplicator" - i.e. copy. But, the trick is what data do you copy? If you copy all zeroes onto something, you essentially erase it. Most modern Unixes, including OS X have a special "device" that generates an endless stream of zeros. From a commandline, you find it at /dev/zero There is also a random number generator at /dev/random Anyway, so what you do is tell dd to use /dev/zero as the input and then the output is your USB connected flash card. I don't have a flash reader here at work, so I can't tell you for sure, but from memory, the command would look something like: dd if=/dev/zero of=/dev/disk4 You need to find-out what disk# your flash card appears as and use that. You also need to be careful with dd because if you specify the wrong disk in the "of=" (output file) then it will happily pave your system disk or whatever else you specify. Anyway, that's the quick rundown from memory. It should be enough to help you get looking into dd if you want to.
Marble of Doom in reply to MixMasterMJul 24, 2010. 6:19 PM
I just tried dd if=/dev/zero of=/dev/disk1 on an old flashdrive but it says "Resource Busy" Any ideas?
MixMasterM in reply to Marble of DoomJul 25, 2010. 10:37 AM
Repost since the Reply didn't actually reply in the correct spot. Make sure the disk is not mounted on the desktop. Open Disk Utility and select the flash drive and hit unmount. Then retry the dd.
MixMasterM says: Jul 25, 2010. 7:41 AM
Make sure the disk is not mounted on the desktop. Open Disk Utility and select the flash drive and hit unmount. Then retry the dd.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!