I run a couple of different backups to FireWire drives during the night, but I don't want to see the FireWire drives during the day, since they clutter my desktop and slow down Open/Save dialogs. So I created the following two scripts to automatically mount and unmount all FireWire drives, then scheduled them to run at the right times:
The mount script, which I named mntfw:
I was perplexed to find that my new digital camera said that my 1GB Memory Stick Pro Duo was only able to hold about 60 pictures at 8.0MP resolution. Exploring the memory card via the Finder, I wasn't able to find any obvious culprit.
Then I decided to Show Hidden Files. Immediately, a folder called .Trashes made itself known. Inside that folder was a folder called 501. That folder contained all the images that I had deleted from my memory card via the Finder the last time I imported photos. I was able to delete the photos by dragging them to the Trash and then emptying it.
Moral of the story? Always delete your photos from your camera, not through the Finder.
If you have lost an encrypted image, such as after a power shortage or system hang, you are probably familiar with the "corrupt image" message that displays when you try and mount the disk image. Yet you might be able to recover it. I spent some time researching how these files are created and was able to recover mine.
kirkmc adds: I haven't tested this. Make sure you make a copy of the corrupted disk image before trying out the above procedure. It's worth noting that DiskWarrior can repair some corrupted disk images; I'm not sure whether it works with encrypted disk images, but when I recently reviewed the program for Macworld, I tested it on normal corrupted disk images, and it repaired all the problems I was able to create. Your mileage may, of course, vary, depending on the type of corruption.
I have several external hard drives connected to my iBook. One of them I use as scratch space, so I throw away lots of files on there. Since Mac OS X doesn't automatically empty the trash, the disk can get full quite fast. The problem is, I don't want to empty the trash on all of my disks - just that one. I've been cding into the trashes folder on the drive to empty it, but that's too time-consuming for general use. The command I've been using is this one:
rm -r /Volumes/Vingilot/.Trashes/510/*
Where Vingilot is the drive name, and 510 is your user number. (Every user account has a number associated with it - root is 0, and the account you make when you first start Mac OS X is 501. You can see all the numbers for your accounts in Terminal by typing ls -ln /Users.)
This was already submitted as a hint (Automated backup of flash drives), but that script wasn't quite what I needed. I have several small thumb drives which I'd like to back up, and some of them I don't need to maintain archives for; I only need a backup in case I lose the drive. Therefore I have modified the script a fair amount, and then using the hint to trigger backups on connect without launchd, create a modified version of Apple's backup script, which now enables me to do the following:
Add a copy of the sync script to any thumb drive I wish to keep a backup of
Specify in the sync script whether or not to keep an archived copy of the backup, on a per-thumb-drive basis
Automatically backup any number of thumb drives on any number of machines with minimal setup
The folder action script scans the root of the mounted drive for the specific backup app, and executes it if found. This is a really pain-free way to maintain constant backups of all my critical work (that resides on thumb drives). And I'm fairly certain that the backup will be OK as the script is using the rsync UN*X command with instructions to mirror the drive contents, and tar -cz to do the archive (if required).
Additionally, I was experiencing some permission problems when using the original script because the .Trashes and .Spotlight folders weren't readable by the backup script. I circumvented this problem by having two options:
Default is to exclude the .Spotlight and .Trashes folders from the rsync backup
Optionally, the script can run the backup as an administrator, which has the side effect of asking for the administrator password every time the specific thumb drive is mounted, which might be annoying or desirable, depending on the person
The modified scripts and full instructions are located here.
[robg adds: In case the above-linked post isn't available at some point in the future, I've mirrored the two scripts here on macosxhints.com...]
I recently needed to format a USB hard drive to get rid of multiple partitions. Disk Utility kept crashing without finishing up its job, leaving me with an unusable disk. Multiple attempts in Disk Utility failed. To make a long story short, I'm cheap and didn't want to shell out for more software, so I tried diskutil in Terminal:
diskutil eraseDisk HFS+ newdisk disk1
Where diskutil is the program being run, eraseDisk is the operand, HFS+ is the format of the new disk, newdisk is the name of the new disk, and disk1 is the mount point for the disk to be formatted. You can easily find the mount point in Disk Utility by Control-clicking on the offending disk and picking Information from the pop-up menu, then looking at the Disk Identifier entry.
Somewhat surprisingly, diskutil worked for me where Disk Utility failed, so perhaps it will help you out with a similar troublesome disk.
I recently ran into a problem where I couldn't find my 512MB USB flash drive. Since I didn't regularly make backups of it, I thought I was toast. Valuable work information, portableFirefox, projects, etc., all gone. Luckily I did find it, and it prompted me to devise an easy way to back it up constantly. No way am I digging through the trash bin at 2AM ever again.
First, I installed Do Something When; it's a great little utility that has been featured before, and does exactly what its name implies. Next I set up a rule to run an AppleScript (saved as an application) whenever I mount my USB drive. All the Applescript says is:
The word USBdrivename should be replaced with the name of your USB drive (and remember to quote it if it includes spaces). Copy and paste into Script Editor, modify to suit your needs, and save it as an application. I am not an AppleScript expert, and I'm sure this can be done better, but it was simple and works for me.
I had thought about changing the dialog to ask which way to sync (USB » Mac or Mac » USB), but this works so I left it. Now, every time I plug in my USB drive, the contents are backed up -- "just in case." It also benefits me in those times when I leave the drive at home.
I completely lost my LaCie hard drive last night. It wasn't appearing on the desktop, and when I checked in System Profiler, it wasn't appearing either. After the tightening in my chest and tingling sensation went from my arm, I found an article which suggested I unplug the drive and zap the PRAM, and then once it was rebooted, reconnect the drive. I tried this, but it didn't work.
Then I read that I should unplug the drive, turn off and unplug the computer, leave it for 10 minutes, then turn the computer back on and reconnect the drive. I tried this for 30 minutes, and still nothing. So I turned it all off and unplugged it at the wall and went to bed, thinking I had lost all the work which was on my storage device. When I woke up, I plugged the computer back in with the drive still connected to the computer, and amazingly, there it was on the desktop!
Now, the desktop did have problems (the menubar icons were missing from the top right corner of the screen, and everything was running strangely), but once I had unmounted the drive properly and done a restart and connected the drive again, it all worked fine.
Don't give up. Try my approach if you lose your drive. Sleep on it!
[robg adds: Offered as One Last Hope for those who may have a hard drive that seems beyond recovery...and yet another great reason to ask yourself that key question: "Have I backed up lately?"]
This is probably obvious to many, but it might be useful anyway: You can use a Windows XP installation in Parallels Desktop VM to get around the read-only limitation of Mac OS X's NTFS file system support.
I had to copy some data from my Mac to an external portable hard disk which is usually used on a Windows machine, and which is formatted using the NTFS filesystem. Mac OS X has read-only NTFS support, so copying from the disk to my Mac is not a problem, but writing is not possible.
Using my Windows XP installation in Parallels VM and its shared folder support, I was able to copy my data from the Mac to the disk. The hard disk was connected via USB and thus visible to Windows in Parallels. It's not as fast as it could be, but at least I was able to transfer my data.
I have a 200GB 7200RPM DiamondMax 10 Maxtor hard drive (Model 6L200R0) in an IDE-to-FireWire external enclosure (some generic one, model ME-320 IDE). This enclosure's status lights are green and red. Green for power and that everything appears "good," and red for read/write and if there is an error. The Maxtor HD one day caused the enclosure to have a solid red light upon powering it up (when this happened before, it was a faulty IDE cable, which has since been replaced), and the drive would not mount, nor would a utility see it. Other drives work in this enclosure.
The fix was simple enough. Naturally the hard drive was set to a "Master" device, as it is the only device on that IDE bus. I changed the jumper to "Cable Select" and voila, the red light went away and the hard drive mounted! The drive seems to be fine, no bad noises or anything, but I still promptly copied off the data to another drive because of paranoia.
[robg adds: I can't test this one myself, obviously, and it doesn't make much logical sense to me. But if it helps someone else...]