Categories
Apple Programming

Iphone out of disk space ? Move your application directory to /var !

[I notice in my logs that lots of people still visit this link – you should no longer need to do this. Simply BlackRa1n your iPhone and install Cydia or Rock. They normally do this for you – I certainly no longer muck about with version 3.x of the iPhone OS. Plus with the fact that there is a virus out there for jailbroken iPhones… Be Carefull !!]

Any user who has logged into his iPhone via ssh (and has installed the bsd subsystem) or has used the installer.app terminal application can do the “df -h” command to get a human-readable output of his iphone partition setup.

It’s basically set up in two partitions : one root (/) partition and one /private/var partition which is mounted afterwards and tacked on to the root partition. It’s actually this /private/var/ partition that contains (under another subfolder ‘root’) all your music, videos and other media.

The root partition contains your installed applications (under the folder ‘Applications’, and since Apple locked the phone down and didn’t think anybody else would add stuff to it, it only provided a minimum of space for the root partition – 300 Megabytes or so. And your /private/var partition has close to 7+ Gigabytes !

With all the applications that I installed via Installer.App, I’ve recently gotten the message that the iPhone has low disk space on its root partition. I’ve got about 13 Megs free, and I dread adding other applications for fear of running out of disk space. Lots of bad things happen when your root partition runs out of diskspace…

So I’ve stumbled over another link that documents how to move your Applications folder to the /var folder so you can install all that you want.

You basically need to do the same thing that you do when you need space on another unix/linux machine :

  • modify your fstab file (which contains the list of partitions to boot) and remove the noexec option from the media partition so that it can execute programs. You can edit the file by copying it over to your computer and editing it there and saving it back (ALWAYS MAKE A BACKUP !) or by editing it directly via the Editor program you can install via installer.app.
  • move over your /Applications folder to /private/var/root
  • and then delete /Applications and create a symlink to the /private/var/root/Applications residing on the media partitition.

I haven’t tried this out yet, but my guess is that you can be much more selective by doing this one level deeper : installer.app for example, should be able to add all the new programs to the the /private/var/root/Applications partition, and then put a symlink to it in the original /Applications folder.

The advantage would be that

  1. you don’t mess with moving the Apple programs and applications
  2. your installer.app applications get backed up (I’ll need to verify if that’s actually true or not)
  3. your root partition will be able to function, even without a media partition (this won’t normally happen, but then I’m paranoid about things like this)

I’ll probably give it a test for installing python on the media partition, I’ll let you know.

(Visited 972 times, 1 visits today)

One reply on “Iphone out of disk space ? Move your application directory to /var !”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.