söndag, juni 03, 2007

Solving mounting problem on MacOS X

This is a highly specific post, but I thought I'd write about this so that if someone else have the same problem, they can try to solve it my way.

I got a new computer, Intel-based MBP last week. I upgraded it to latest OSX version (10.4.9 I believe), and immediately installed everything I needed. While ending my last job and returning the laptop associated with that post, I made backups to a 500GB USB LACIE hard drive. Very nice indeed, and half my life is now on that hard drive. (I have most of it on other places too, but not so easily accessible).

The first thing I managed to do was to shut off the hard drive without unmounting it correctly from OSX. I got the warning et all, but well, done is done. It was stupid, I know. Starting out with messing up everything. So what happened? Well, the next time I tried to get OSX to find my hard drive, by inputing the USB connection and switching on the power. Nothing happened. The drive would spin up, but no mount points or nice icons on the desktop. After some investigation I found that the Disk Manager HANGS when the LACIE is turned on and connected. I also found that when I switched the power off, my console says something about not being able to repair disk /dev/disk2s1. Interesting. After a few hours investigation on the Internet I despaired, and decided to try my own ingenuity instead.

I won't tell you about everything I did to find this solution. It would get severely boring very fast. So, here is the solution:

1. Attach the device and turn on the power.
2. Open up a terminal and create a new directory in /Volumes, (eg sudo mkdir /Volumes/LACIE2).
3. Mount the drive explicitly on this mount point (sudo mount -t msdos /dev/disk2s1 /Volumes/LACIE2).
4. Delete ALL .DS_Store files on the disk (cd /Volumes/LACIE2; find . -name 'DS_Store' -exec rm -rf \{\} \;).
5. Wait for a while. At this point you should have two LACIE drives on your Desktop, one fake and one real. Unmount the real one by dragging it to the trash can.
6. Turn of the external hard drive, or detach it.
7. Reboot.
8. Attach/Turn on the external hard drive.

This is a process that works for me, and my drive is now back to working mode. It seems that OSX stores some information in the DS_Store files somewhere on the disk that got corrupted for me. Hopefully this information can help someone else with the same problem.

4 kommentarer:

Amr Malik sa...

It has happened to me a couple time, sort of unintentionally as well. The power went out but the MBP kept humming while the drive died.

One time it wouldn't recognize it, but if I remember correctly, I had to just shut my MBP down and then bring it up without any USB/FW etc peripherals hooked up, when everything came up, I powered on the drive and hooked up the USB and off we went.

Your procedure is way less voodoo than mine ;) so that's good to know ! thanks!

MC sa...

Instead of -exec, a much more performant way (and less vooddo quoting!)

find . -name 'whatever' -print0 | xargs -0 rm -rf

This assumes a gnu-ish find and xargs; if you don't have that and are pretty sure you're safe from whitespace in filenames:

find . -name 'foo' -print | xargs rm -rf

Daniel Spiewak sa...

Something probably worth noting is that you shouldn't leave your external hard-drive FAT32 formatted (or any HD for that matter). I mean, obviously it's cool and all that MacOS X (along with any *nix platform) can interact with such primitive filesystems natively, but it's still not optimal. In fact, I would guess that the formatting is what caused your problem in the first place.

If I were you, I'd shuffle the data around to clear the drive, then reformat the whole thing as ext3. You could do HFS (the MacOS X native file system), but that's less compatible with other systems like Linux (though still supported). Though, if you know that you won't need that external hard-drive on *anything* but Mac from now on, then you should probably go the HFS route, seeing as it'll be quite a bit faster and more "Mac-y" (as in Uppercase/Lowercase drive labels, etc) Just a thought...

Ola Bini sa...

@mc: true enough, both xargs versions are more readable. thanks.

@daniel: yeah, I know about the formatting woes (but I've heard of this kind of problems happening on HFS drives too, so I can't think that's the cause). I would do it EXT3 in a heart beat, except I actually need it to be MS compatible to be read by my "media machine", which runs Windows XP.