Reformat Hidden Partitions on a Compact Flash Disk on Mac OsX

30K29

Intro: Reformat Hidden Partitions on a Compact Flash Disk on Mac OsX

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 1: When Disk Utility Won't Cut It Use Diskutil

Yes, diskutil.

Materials:
a compact flash card reader (a USB one in my case)
a mac runnning osX (version 10.6 in my case)

Open up your Terminal: Applications/Utilities/Terminal

Type in: diskutil list

This will tell diskutil to show you all the partitions on all the drives on your computer, including the CF card in your card reader.

I think there is even one more little partition that diskutil neglected to show me...

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...

9 Comments

suggest:
1. $ sudo su
2. $ umount -f /Volumes/rei ("rei" being the partition given in the example)
3. $ diskutil eraseVolume hfs+ woot disk1s1

Getting Error - "Error: -69874: Couldn't modify partition map"

Might be incorrect file system name. Please help me to convert these partition to normal partititon.

Another idea that comes to mind is to use dd to wipe the entire card, and then format it in the camera.
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?
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.
I just tried dd if=/dev/zero of=/dev/disk1 on an old flashdrive but it says "Resource Busy" Any ideas?
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.
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.