OSX Snow Leopard – How to Create a Virtual Disk/Filesystem

filesystemsosx-snow-leopard

I'm testing an iPhone application and need to test its behaviour when storage space is low or the disk is full. This is fiddly to test on a device and ideally I'd like to be able to test with the simulator (an emulator) which runs on my Mac.

The simulator uses a directory on the local filesystem for storage, therefore I would think it possible to create a virtual disk somehow, and then symlink the storage directory to this disk.

How can I create such a virtual disk?

Best Answer

You can use the Disk Utility (from Finder: Applications -> Utilities -> Disk Utility) program to create a new Disk Image (a .dmg file), the size of your choosing, that you can mount (by double click on the .dmg file). Once mounted it shows up just like any other external disk on your Mac. You can point the emulator to this disk and tell it to store its "filesystem folder" on it.

Here are Apple's instructions for creating a disk image using Disk Utility.