Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Restore a full-disk .dmg file to a raw block device Storage Devices
Like many others, I used Disk Utility to create a disk image (.dmg) from my full disk, with the expectation that I could restore this backup at a later date. Said date came all too soon, and I found myself accused by Disk Utility of offering it a corrupted image. Much investigation and much research followed: the image was not corrupt, but the graphical tools did not allow a multi-partition .dmg file to be restored, nor did they allow a full-disk .dmg file to be written to a raw disk or a block device.

Luckily for us all, this task is possible! I hope to spare you much of the suffering I experienced with this hint. For this occasional task, the hdid utility is your friend. You must use Terminal, as Disk Utility does not support this use.

First, mount the .dmg file as a block device only:
hdid -nomount "/Volumes/Diotallevi/Clean Checkpoints/WDC Image.dmg"
Second, determine the block device of the image and destination:
diskutil list
Third, use dd with an appropriate buffer size to copy over the whole block image, including partition table and boot sector. Note that it is extremely important on some hardware to use a large block size; you can expect a 20x speedup over the case without blocksize parameter.
dd if=/dev/disk3 of=/dev/disk2 bs=131072
Fourth, unmount everything and enjoy your copied disk. I get around two terabytes a day of transfer rate; I know of no way to skip sparse areas of the disk image, but could approximate it by dding the first few megabytes of the image, then using Apple System Restore to copy each volume individually.

Expect large speedups for sparse disks with this method. (This hint originally appeared on my site.)
  Post a comment  •  Comments (6)  
  • Currently 3.21 / 5
  You rated: 5 / 5 (14 votes cast)
[39,766 views]  View Printable Version
10.5: A fix for Back to my Mac and Time Capsule disk sharing Storage Devices
I had problems getting disk sharing using Time Capsule and Back to my Mac to work. I was able to see the Time Capsule in my Finder's sidebar and everything worked fine when I was on my network. However, when trying the same over the internet via Back to my Mac, I was able to see the Time Capsule in the Finder sidebar, but any attempts to connect to it would simply time out.

After searching the net and coming up empty, what I realized was that I had IPv6 Mode on the Time Capsule (Airport Utility » Manual Setup » Advanced » IPv6 tab » IPv6 Mode setting) set to Link-local Only. After changing that to Node and letting IPv6 be configured automatically, things just started working...

I couldn't find this documented anywhere, and hence the hint.
  Post a comment  •  Comments (3)  
  • Currently 1.78 / 5
  You rated: 4 / 5 (9 votes cast)
[12,107 views]  View Printable Version
Avoid Western Digital external drives' built-in spin down Storage Devices
A problem with some of the Western Digital's My Book external hard drives is that they have a spin-down functionality built into their firmware. Meaning that no matter what preferences are set in System Preferences, if 10 minutes of inactivity have passed, the hard drive will go to sleep. This is annoying, as even if you are browsing files in the Finder without looking at the ones on the hard drive, the Finder triggers a spin-up, and then bogging down the system until the hard drive has finished spinning up.

A workaround for this is to not let the hard drive be inactive for more than five minutes by constantly touching a hidden file on the hard drive. This is done by first building a small script in bash that touches the hidden file and that also checks if the hard drive is mounted, so as to not flood the system logs if the drive isn't connected. Here's that code:

# Used to not let a volume named MYBOOK sleep

volpresent=$(mount | grep MYBOOK | wc -c)

if [ $volpresent -gt 0 ]
    touch /Volumes/MYBOOK/.hiddenfile
This script should be made executable by running the following on the Terminal: chmod +x ./ Replace with whatever you named the script. The best way to run this script every five minutes is to use the launchd system built into Mac OS X, and a donationware app called Lingon is a great tool to manage it.

Install Lingon, then build a new Agent in the My Agents category, choose a unique name for it (such as com.username.agentname), input the location of the script, and tell it to run it every five minutes. Save it and restart your session. I've done this and the drive has remained sleepless since.

It can be argued that this may shorten the life of the HD, but from what I've read in various forums, having the HD spinning down and up constantly also causes severe strain on the HD, especially in situations like mine where the HD is constantly on. DISCLAIMER: This is not really my hint, but a variation of someone else's, but I don't remember where I got it from, sorry!
  Post a comment  •  Comments (31)  
  • Currently 2.54 / 5
  You rated: 3 / 5 (13 votes cast)
[52,885 views]  View Printable Version
Fix a Western Digital My Book drive formatting problem Storage Devices
Twice now I have had problems formatting a new Western Digital My Book external drive under 10.5.x. Disk Utility fails to format the drive as Max OS X Extended Journaled with a "Format failed..." message. The first time this happened, I found an obscure firmware update at Western Digital's forums. This time, I found a quicker solution in this thread over at macForums. Here's a short executive summary version:
  1. Open Disk Utility and select your drive.
  2. Go to the Partition tab, name the drive as you wish, and choose one partition. Partition the drive.
  3. Select the partition you just created. Go to Options (on the bottom of the dialog window) and select GUID Partition Table/OK, then click Apply.
That's it; you can now format the drive successfully.
  Post a comment  •  Comments (2)  
  • Currently 4.00 / 5
  You rated: 1 / 5 (15 votes cast)
[36,904 views]  View Printable Version
Create an HFS+/NTFS/FAT32 external drive Storage Devices
This hint (from way back in 2003) is still the best I have come across in terms of explaining how to partition HFS+ and FAT32 on the same external hard drive. In this hint, I'll explain how to add NTFS to the mix, and note some significant improvements upon the previous hint's awesome efforts. If needed, print this hint, and then go to the above link for more help (and there's another link further down that may be of some help).

To add NTFS to the mix from the previous hint, in the first step, just divide things up into three parts instead of two. Then, after step seven in the first hint, insert a similar-looking step -- put 2s3 at end of command instead. Finally, use a Windows machine to reformat the remaining VOLUME you formatted to FAT32 to NTFS instead. (Control Panel » Administration Tools » Computer Management » Disk Management.)

Here's my real contribution to improving the method in the previous hint. You can avoid the annoyance noted in step number nine (doesn't automatically mount the HFS+ partition) if you just format all three partitions (or two if you're not adding NTFS) to FAT32 first (since those automatically mount so great). Once it's all working, go back and use OS X's Disk Utility to reformat one of the FAT32 partitions to HFS+ (or extended journaled, if you prefer). Another thing to note is that the order of your partitions established in step one determine the order the partitions will be mounting when connecting your external hard drive to your computer.
read more (153 words)   Post a comment  •  Comments (7)  
  • Currently 3.14 / 5
  You rated: 3 / 5 (7 votes cast)
[148,335 views]  View Printable Version
How to create a fully-encrypted HFS+ hard drive Storage Devices
The free TrueCrypt 5 was recently released for Mac OS X (10.4 and 10.5 versions are available, as well as Windows and Linux versions). Some users, like me, may be frustrated trying to encrypt an entire drive or partition on the OSX version. TrueCrypt itself does not support HFS or HFS+ file systems so there is no obvious way to create a Mac-formatted, fully encrypted volume. Worse, if you use TrueCrypt to encrypt an entire (blank) drive and then use Disk Utility to create an HFS+ partition, the encryption gets overwritten.

After much trial and error and lengthy encryption processes, I have found a solution. Note that for this test I used a USB-attached 160GB hard drive, so speed was pretty slow to begin with. Be sure the drive to be encrypted is either already blank or has been fully backed up to another device. This process will completely delete any files you had on the drive.

Install and launch TrueCrypt. Select to create a new volume and select your options (ie. encryption format such as AES or Twofish) and select the drive you plan to encrypt. Note that the OS X drive selection window does show the volume names you have assigned to each of your connected drives, so it's fairly easy to choose the correct one. Finally, choose to create the volume as FAT formatted.

After a lengthy process (my 160GB USB drive took around three hours), you will have an encrypted drive with a single FAT-formatted volume. Now you can launch Disk Utility and use the Erase> option (do not use Partition, or you'll overwrite the encryption) to change the volume's filesystem to HFS+ as you normally would for a simple reformat.

That's it! You'll then have your HFS+ drive which requires launching TrueCrypt and entering your password in order to unlock and mount. Attempting to mount the drive directly in OS X without going through TrueCrypt will tell you the drive is unreadable (as it should, since OS X itself cannot read the encryption).
  Post a comment  •  Comments (13)  
  • Currently 3.29 / 5
  You rated: 4 / 5 (7 votes cast)
[56,527 views]  View Printable Version
Use newer 2.5" SATA disks in a MacBook or Mac mini Storage Devices
If you want to use some of the new 2.5" SATA hard disks in your MacBook (or Mac mini for that matter), you'll notice that they do not show up in Disk Utility, and that you cannot even format them. They will work externally as a USB device, but will not show up when used internally. That's because the newer drives are SATA II (or SATA 2) and their higher "transfer rates" are not compatible with the Intel ICH7-M AHCI (which only support up to 1.5 GHz) used in the MacBook and Mac mini.

To be able to use your new 250GB or even 320GB drive, you have to put a jumper on the two leftmost pins (when viewed from the front, meaning the other connector pins are on the right hand side). This worked for me on a Samsung 250GB drive, as well as a Toshiba MK3252GSX 320GB drive.
  Post a comment  •  Comments (17)  
  • Currently 2.86 / 5
  You rated: 3 / 5 (7 votes cast)
[68,941 views]  View Printable Version
Convert a drive from Apple Partition Map to GUID Storage Devices
While upgrading the laptop hard drive on my Macbook, I inadvertantly partitioned the new hard drive in the "Apple Partition Map" mode, which is reserved for PowerPCs. The normal partition type for a Intel Mac boot drive is GUID. My Intel Macbook still booted from this drive, but having my hard drive in Apple Partition Map mode had two severe drawbacks:
  1. I couldn't install Boot Camp.
  2. I couldn't upgrade to Leopard!
I read a couple guides online, and they involved simply copying your user folder and reformatting the drive, but I wanted a method that copied absolutely everything so that I wouldn't have to install my horde of apps. So, here's how I went from an Apple Partition Mapped drive to a GUID drive for Leopard, without losing any of my data, settings, or having to re-install my applications.
read more (425 words)   Post a comment  •  Comments (6)  
  • Currently 3.00 / 5
  You rated: 5 / 5 (10 votes cast)
[88,494 views]  View Printable Version
Use UFS for shared external drives Storage Devices
When formatting an external drive which will be shared by a number of users, it is worth considering whether to use UFS formatting or not. The usual recommendation is to use HFS+, but this has a serious disadvantage for shared drives as the drive is mounted as if the current user owns all the files.

As an example, consider a user named Fred, who creates a important file on the HFS+ drive and carefully uses Get Info (or chmod if he's a geek) to make the file only accessible to himself. Fred logs out. Along comes Sally, who logs in and has a look at the drive. She does a Get Info on the file Fred made, and finds it is owned by herself. So she proceeds to delete it, as she can't remember creating it. Result: misery. Another formatting choice is to use FAT32, which also allows the drive to be used on an MS Windows PC. However, the same permissions problems occur.

The solution is to use UFS, the Unix File System, which is the native UNIX disk format. This preserves the permissions as created, and Sally can't look at Fred's files (and vice versa); just like on the startup disk. There is one disadvantage in using UFS that I've stumbled across: it doesn't handle files over 4GB.

[robg adds: A bigger issue is that UFS won't handle resource forks -- and although resource forks aren't nearly as important now as they have been in the past, it may still be a big issue for some users.

As a workaround, though not perfect, Fred could use encrypted disk images and carefully named files, such as Fred's Important Paper -- assuming that Sally isn't malicious by nature, then this should work fine. Any other suggestions for file security on shared hard drives?]
  Post a comment  •  Comments (19)  
  • Currently 1.80 / 5
  You rated: 3 / 5 (5 votes cast)
[20,657 views]  View Printable Version
Remove the extra partition from U3 drives via Windows Storage Devices
For all those having problems with the useless extra partition used in U3-enabled USB flash keys (the second "CD" mounting full of Windows software), I've posted a detailed solution to the problem on my website. Here's an excerpt with the essential details:
All you need is a Windows machine (I found one which had Parallels Desktop installed and it worked fine) and the Drive Key Boot Utility from HP (45mb download, no registration required).

Just plug your dead USB key into a Windows XP machine (real or virtual), run the app, click through all the recommended options, and let the software pulverize the drive's U3 enhancements into oblivion. Don't worry if it takes several minutes (with no progress bar), or if the program stops responding; just wait until it's finished. Go back to the Mac OS Disk Utility, and do whatever you want with your new, fully-functional USB flash drive (which is what you wanted in the first place).
Credit goes to Mark Rushton for finding out about this little tool.
  Post a comment  •  Comments (15)  
  • Currently 2.00 / 5
  You rated: 2 / 5 (4 votes cast)
[53,093 views]  View Printable Version