If you have installed Cydia on your iPhone or iPod Touch running 3.X firmware there is a good chance that after instaling a bunch of applications you could get to a point that you are running out of disk space on the root partition. By default the root partition is going to only be 500MB and so far I have not found a great way to resize this so it is much easier to resolve using the below method. Cydia does a pretty good job of relocating a lot of the folders from the root (mounted at /) partition to larger var partition (mounted at /private/var).
First you should find out how much disk space you have total and how much disk space you have left on the root partition of your iPhone or iPod Touch. You can do this by opening a terminal window on your iDevice or by connecting via SSH. Once you have connected either by terminal or SSH use the “df” command as shown below to list information about your disk space.
Find Out How Much Disk Space You Have On iPhone With Cydia:
- narfTouch:~ root# df -kh
- Filesystem Size Used Avail Use% Mounted on
- /dev/disk0s1 500M 409M 87M 83% /
- devfs 19K 19K 0 100% /dev
- /dev/disk0s2 30G 1.5G 29G 5% /private/var
As you can see in the above example I have roughly 17% space left in the root partition and 95% left in the /private/var partition.
When I first installed Cydia and installed many of the core Linux applications I got down to only have 3% disk space left on the iPod Touch so I wanted to free some up. I found the best way to do this was by moving the system fonts to the larger hard drive and then linking a folder on / to the new location. You can do all of this by issuing the below command from the jailbroken iPhone or Touch.
Free Disk Space By Moving Fonts On iPhone With Cydia Installed:
- mv /System/Library/Fonts /private/var/; ln -s /private/var/Fonts /System/Library/Fonts
After this command completes you can see the symbolic link in the /System/Library directory by using the below command.
View Fonts Directory New Symbolic Link:
- narfTouch:/System/Library root# ls -alh | grep Fonts
- lrwxr-xr-x 1 root wheel 18 Oct 11 01:02 Fonts -> /private/var/Fonts/
This will free up 87MB of disk space on the root partition which is about 17.5% of the total disk space available. As mentioned above Cydia actually moves a lot of this stuff by default which you can see by checking out the root partition as shown below.
List Files & Directories On iPhone Root Partition:
- narfTouch:/ root# ls -alh
- total 21K
- drwxrwxr-t 15 root admin 748 Oct 11 13:48 ./
- drwxrwxr-t 15 root admin 748 Oct 11 13:48 ../
- drwx------ 2 _unknown _unknown 204 May 22 04:08 .fseventsd/
- lrwxr-xr-x 1 root admin 27 Oct 8 17:15 Applications -> /var/stash/Applications.pwn/
- drwxrwxr-x 2 root admin 68 May 14 03:47 Developer/
- drwxr-xr-t 16 root admin 782 Oct 9 01:34 Library/
- drwxr-xr-x 3 root wheel 102 Jun 22 09:54 System/
- lrwxr-xr-x 1 root admin 11 Oct 11 13:48 User -> /var/mobile/
- drwxr-xr-x 2 root wheel 2.1K Oct 11 08:28 bin/
- drwxr-xr-x 2 root wheel 68 Oct 28 2006 boot/
- drwxrwxr-t 2 root admin 68 May 14 00:47 cores/
- dr-xr-xr-x 3 root wheel 750 Oct 11 13:48 dev/
- lrwxrwxrwx 1 root wheel 12 Oct 8 17:15 etc -> private/etc//
- drwxr-xr-x 2 root wheel 68 Oct 28 2006 lib/
- drwxr-xr-x 2 root wheel 68 Oct 28 2006 mnt/
- drwxr-xr-x 4 root wheel 136 Jun 22 16:36 private/
- drwxr-xr-x 2 root wheel 1.6K Oct 9 02:08 sbin/
- lrwxrwxrwx 1 root wheel 16 Oct 8 17:15 tmp -> private/var/tmp//
- drwxr-xr-x 10 root wheel 442 Oct 11 07:30 usr/
- lrwxrwxrwx 1 root wheel 12 Oct 8 17:15 var -> private/var//
After you have moved the Fonts directory you should not have any further disk space issues with the root partition because most items such as applications are already going to be installed on the larger partition.