Moving Applications to Media Partition

Alright, so I've seen a few people asking about this, and I got curious because I had never thought about it before. Basically it involves moving the /Applications directory to the Media partition to give you more space to install apps and themes from Installer, and creating a symlink in the root directory, much like you do during the jailbreak process. This is for version 1.1.1, I'm not sure if it'll work for 1.0.2, but you don't need to on 1.0.2 because it gives you over 100 megabytes which is more than enough. This will allow you to jump from around 30 megabytes to over 50 or so, which still isn't as much as 1.0.2, but it definitely helps!

Note that I'm on Windows XP, but the process is exactly the same for Macs, you'll just have to use your ssh program. Also note that should anything happen to botch up your iPhone, I'm not responsible. I've followed and re-followed this guide to the letter to make sure I didn't word anything badly, and it's not given me any problems. If you have any questions, ask before trying. I'll be more than happy to try to help.

I've seen a couple of different methods so far, but this is the one that I followed, and I figured I'd type it up and provide screenshots to those that need them, as well as provide instructions for those of you who don't have ssh, the process is exactly the same: http://www.modmyiphone.com/forums/showthread.php?t=9678

NOTE: If you did this on 1.1.1 and then upgraded to 1.1.2, you may notice as you are looking through your ssh program that the symlink is no longer there. You have to be logged in through an SCP session, not an SFTP session(you can do this by installing OpenSSH through Installer.app), and you can recreate this. Delete the ROOT_Applications directory you created, and then follow the steps again. You will have to reinstall all your apps from Installer, but this is the safest way to do this. You won't have to reinstall themes and the like, only the actual applications themselves.

EDIT (12/14/07): I've noticed a lot of people are having trouble with this. To answer some of your questions, yes you CAN do this all on a 1.1.2 phone. Doing this on 1.1.1 then upgrading is NOT recommended, as upgrading with the symlink installed WILL erase your symlink and reinstall the default /Applications folder. You should remove this before upgrading to any new version of firmware and redo it. I just double checked myself by removing and redoing the instructions with my 1.1.2 phone and it works.

NOTE(take two): I noticed after finally getting a chance to look back through the forum that a lot of folks are questioning whether you can use this on any firmware version. As far as I know, yes. I've been using this method since version 1.0.2, and I have used it on each version of firmware since, so I know it does work. Just follow the guide exactly and you'll get it.

NOTE(take three): If you are on firmware version 1.1.3 or higher, make sure to substitute mobile anywhere you see root. For example, instead of putting /private/var/root in the command in step two, put /private/var/mobile. It won't hurt anything to use root instead of mobile, but as of 1.1.3 the /private/var/mobile directory is where Apple is keeping everything instead of /private/var/root like in versions prior to 1.1.3, and it may end up being that the /private/var/root directory is removed altogether eventually.


Requirements

1. an iPhone with any version of firmware(yes, ANY version will work)

2. an SSH program of some sort(I'm using WinSCP, but these directions should work with any SSH program)

3. and, of course, you need to have SSH installed on your phone, along with the BSD World and Extra Subsystem(not sure if you need both but you might as well have them all)

If you followed the 1.1.1 jailbreak guide on this site, you will already have SSH and the BSD Subsystems installed. If not, the guide is located here: http://modmyiphone.com/wiki/index.php/Dev_Team_Installing_SSH_1.1.1_Windows


Step 1

Now that we have that taken care of, we have to make sure that the noexec command is not set in the /etc/fstab file. If you followed the guide here on jailbreaking 1.1.1 you may remember looking at this file to make sure that there were no "ro"s in it. Now we are going to check it and make sure that it doesn't say noexec, and if it does, delete it. So, connect via SSH however you'd like, and navigate to your /etc directory. If you are using WinSCP you can double-click the file and view it straight from WinSCP and edit it. I would recommend dragging a copy onto your computer before editing, just in case something goes wrong.

Image:rianbattleAppsToMedia1.jpg

If you are using a command-line ssh program, such as Putty, you'll need to pull it from the iPhone and look at it, then put it back. Simply run this command to get it:

getfile /etc/fstab fstab

Then look in the directory where the putty program is stored, and you'll see the fstab file. Make a copy of it first, just in case, then open up the original with Notepad.

Image:rianbattleAppsToMedia2.jpg

Either way, you should be looking at the open fstab file. See where it says noexec in the red circle? If this is anywhere in the fstab file, delete it. Make sure to remove any commas before or after it as well(mine had one right before it).

Image:rianbattleAppsToMedia3.jpg

Now, simply save it. If you're on WinSCP, your changes will be saved directly to the phone and you should be ok. If you're using putty or something similar, you'll have to run this command

putfile /etc/fstab

Step 2

Now that we are able to run the commands that we need to run, we are going to make a copy of the /Applications directory, and the copy is going to be stored in /var/root which is the Media partition...the place where you see the 7+ gigabytes in iTunes. In WinSCP hit Ctrl+T to bring up the terminal window(I'm not sure what the command is in other programs). Using a command-line terminal you won't need to do this step, obviously

Now type this command and hit Execute:

cp -R /Applications /var/root/ROOT_Applications

Image:rianbattleAppsToMedia8.jpg

Note that, for some reason, after running this command WinSCP reported a connection lost error. If something similar happens to you, simply wait a minute or so, and if it doesn't reconnect, hit abort and reconnect yourself and you should be ok. If you take a look at your /var/root directory, either in WinSCP by navigating there or in putty by typing ls /var/root/

Image:rianbattleAppsToMedia5.jpg

You'll see a new folder, called ROOT_Applications, which should contain a copy of all the apps currently on your iPhone! Check to make sure they are all there. A better way to check and make sure it got copied(especially if it got disconnected) is to right-click on the new ROOT_Applications folder, click on Properties, and click on the Calculate button next to where it says Size, to get the size of the folder. Remember this number, and do the same for the /Applications folder, the original one, and make sure they are the same. If not, delete the /ROOT_Applications folder and try again.


Step 3

OK...we've got a copy of the /Applications directory, and it's stored in it's new home under /var/root. Now, we are going to delete the /Applications directory and create a symlink much like you do during the 1.1.1 jailbreak process outlined in the guide on this site. This symlink will trick the iPhone into thinking the /Applications directory is still there, but really it will be a shortcut to the /var/root/ROOT_Applications directory we just created. Bring your command line back up and type this command:

rm -rf /Applications && ln -s /var/root/ROOT_Applications /Applications

Image:rianbattleAppsToMedia9.jpg

This command does two things in one. The first part of the command, before the &&, removes the /Application directory. The && tells the iPhone to also execute the second half of the command right after removing the directory, and the second half creates the symlink for us. Now, if you look in your root directory, you will see that the Applications directory appears to still be there, except it now has a shortcut arrow. If you open it up, you'll still see all your apps, except you are actually looking in the /var/root/ROOT_Applications directory.

Image:rianbattleAppsToMedia7.jpg

Now just restart your iPhone and you will be good to go! You won't notice any changes unless you happen to have an older version of Installer(the new one doesn't show how much space you have yet, I believe). It should have jumped from around 30 megabytes to 50 or so. This is enough to install most everything in Installer!


Removing the symlink

Now, if you should ever need to remove the symlink, or if something got screwed up and your iPhone is acting wacky now, go back to your terminal in your SSH program and type the following three commands:

rm /Applications
cp -R /var/root/ROOT_Applications /Applications
rm -rf /var/root/ROOT_Applications

The first one removes the symlink, the second one copies the /var/root/ROOT_Applications directory back to the root directory, and the third one removes the /var/root/ROOT_Applications directory. Restart your iPhone and you should be back to normal.



0 comments:

 
 iPhone © 2012 | Designed by LogosDatabase.com, in collaboration with Credit Card Machines, Corporate Headquarters and Motivational Quotes