Results 1 to 12 of 12

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Saving space by moving applications to /var

  1. #1
    Default Saving space by moving applications to /var
    Guys, I am posting this hoping that it might become of use for all of you. I have read a big deal on how to move applications from the root partition that only has up to 20 usable MB, to the /private/var parttition, which is soft linked as /var and has GBs of available space.

    After reading a lot of posts, I understood that the easiest trick was to move the whole /Applications folder to /var and then creating a soft link to /Applications for the /var/Applications directory; however after making this tidy movement, the Installer application would become unusable because of the 'main script execution error', which is pretty much unrepairable --or not easily at least.

    Not an application would complain for being in /var/Applications (and soft linked in /Applications) but Installer, which is pretty bad since I could no longer install, delete or update any application. I moved Installer and all the applications back from /var to /; however Installer wouldn't work any more. I had to restore mi iPhone in order to make the Installer work --no applications left after performing the restore though.

    So, I came up with this idea: what about moving all the applications but the Installer? I created a script that would do this by moving all the applications but the installer and then, after moving the applications, it would create a soft link to /Applications for each application located in /var/Applications. This would make all the applications accessible to the OS and Springboard as if they were never moved at all.

    The script has been working great, and now I have hundreds of applications and the Installer has been working flawlessly.

    If you feel like you need to install all the dictionaries, games, thesaurus, utilities, development and networking tools, etc, just as I do, this script is for you. You'll need to execute it after installing some applications or after each time you install a new application, is up to you. I used to install several applications and at the end I would simply run the script once; however I ended up installing a crontab that would run the script by my once a day =')

    Installing the script
    You need to have previously installed System/OpenSSH using Installer, for enabling SSH connections to your iPhone/iPod touch and System/BSD Subsystem so that all the commands and utilities needed can actually work.
    Connect to your phone using putty or SSH Secure Shell as root. Password for mine is default password, which is 'alpine'.
    After logging in, create the bin directory

    # mkdir -v bin

    Note that the '-v' will give you feedback on what is created.

    Using vi or nano (nano is easier), write a file inside the bin directory you just created called move-apps:

    # vi bin/move-apps #then insert the content or alternatively use nano:
    # nano bin/move-apps


    Insert the following content in the file you just opened for writing using vi or nano

    #!/bin/bash
    # space saver script for iphone
    # Gerardo Costilla <[email protected]>
    # version 1.01 - fixed the target of the soft links,
    # that was being set to . instead of /Applications

    find /Applications -maxdepth 1 -mindepth 1 ! -iname "installer.app" -exec cp -rf {} /var/Applications \; -exec rm -rf {} \; 2>&1 | grep -v "are identical"
    find /var/Applications -maxdepth 1 -mindepth 1 -name "*app" -exec ln -sv {} /Applications \; 2>&1 | grep -v "File exists"


    Now make the script executable

    chmod +x bin/move-apps


    Running the script
    Now login to your iPhone via SSH using SSH Secure Shell or Putty and execute the script by typing

    # move-apps #note that you might need to execute it as bin/move-apps, depending on your path configuration


    Running the script without using SSH Secure Shell nor Putty
    You might want to install System/Term vt1000 from Installer and issue the command as root after installing some applications. I can't switch to root using 'su -' so I log in as root using ssh from the Terminal and then I execute the move-apps script.

    To log in as root from terminal, using ssh, type from the prompt the following command. The password for my configuration is 'alpine'

    $ ssh [email protected]


    Automating the script
    In order to avoid executing the script at all, I installed a command to root's user crontab, that will execute the script everyday at 05:00 AM - I am allways sleeping at this time, so this is a great time for the iPhone to work on it. Since the script is incredibly efficient and fast, you could even configure it to run it every minute without any concerns, however since your iPhone/iPod touch runs in batteries, the most you can save will always pay back.

    Note that you need it to install it as root (if you are using Term vt100 to connect, you might be logged not as root [if your prompt is '$' instead of '#', then you ARE NOT logged as root]). Enter the 'whoami' command to ask the OS your user name, if you are not sure.


    # crontab -e # vi will be launched, insert the following
    00 05 * * * ~/bin/move-apps &> /var/move-app.log


    [CONS]
    There is also a great or not so good thing (its up to you) about relocating applications: whenever you delete an application using Installer, Installer ends up removing a soft link which will make it invisible for SpringBoard; however the application will remain in the big (/private/var) partition. After removing an application using Installer, if you want to absolutely delete it from the filesystem, you'll need to remove it by hand using 'rm -r'

    To delete AppFlow.app, after unstalling it using Installer, issue the following command after sshing as root to your iPhone:

    # rm -rv /var/AppFlow.app


    Note that the 'r' in -rv will delete a folder and the 'v' will give you beedback on what is being deleted.

    Short vi tutorial cheat sheet
    * press [esc] and [i] to start inserting text
    * only press the right, up, left and down keys AFTER pressing [esc]
    * press [esc] :wq to save the file and quit vi
    * press [esc] x to delete a character
    # press [esc] dd to delete a line
    Last edited by costicost; 2008-04-11 at 08:25 PM. Reason: fixed the target of the soft links that was being set to . instead of /Applications

  2. #2
    hmm~~great work, but too bad there are one app that do the exact samething....bosstool....

  3. #3
    Default What about Installer?
    Quote Originally Posted by phillipxenxciel View Post
    hmm~~great work, but too bad there are one app that do the exact samething....bosstool....
    The thing is... does BoossToool will render Installer unusable? I think it will.

  4. #4
    My iPhone is a Part of Me MattMac's Avatar
    Join Date
    Dec 2007
    Location
    Nar Nar Goon, Victoria, Australia
    Posts
    739
    Thanks
    82
    Thanked 88 Times in 71 Posts

    No it doent. I used to use bosstool, but I did have problems with it. By far, the best way to do this would be just to install Cydia. Cydia moves the Applications folder to the /var/stash directory at install... This allows you to use the larger of the two partitions to install more apps.

    Cydia is a great app, just like Installer but with some differences, and you can use Installer and Cydia together without any clashes.

    Cydia's repo is: http://apptapp.saurik.com/
    Last edited by MattMac; 2008-06-02 at 02:06 PM.
    16GB iPhone 3G
    2.2 Pwned
    Dedicated Cydia User

    2.2 GHz Intel MacBook

    Mac OS X 10.5.5
    Bootcamp w/ Windows XP

  5. The Following User Says Thank You to MattMac For This Useful Post:

    bdecorsey (2008-06-06)

  6. #5
    Retired Moderator bhz1's Avatar
    Join Date
    Sep 2007
    Location
    Southeastern Pennsylvania
    Posts
    2,528
    Thanks
    92
    Thanked 361 Times in 271 Posts

    What i have noticed since I used Cydia do move the applications to /var/stash, when I am in WINSCP, I no longer can click on /Applications and automatically move to the /var/stash/Applications directory. All my apps work and i know where to find them, it would just be nice if WinSCP cooperated.

  7. #6
    My iPhone is a Part of Me MattMac's Avatar
    Join Date
    Dec 2007
    Location
    Nar Nar Goon, Victoria, Australia
    Posts
    739
    Thanks
    82
    Thanked 88 Times in 71 Posts

    Quote Originally Posted by bhz1 View Post
    What i have noticed since I used Cydia do move the applications to /var/stash, when I am in WINSCP, I no longer can click on /Applications and automatically move to the /var/stash/Applications directory. All my apps work and i know where to find them, it would just be nice if WinSCP cooperated.
    I'm not sure why that happens... It creates a soft link so it shouldn't have any problems... It works fin on my computer, but I use a Mac and Cyberduck. Maybe its just WinSCP. Can you navigate to /var/stash? Lol, this is why I love Macs, Windows never co-operates.
    16GB iPhone 3G
    2.2 Pwned
    Dedicated Cydia User

    2.2 GHz Intel MacBook

    Mac OS X 10.5.5
    Bootcamp w/ Windows XP

  8. #7
    Retired Moderator bhz1's Avatar
    Join Date
    Sep 2007
    Location
    Southeastern Pennsylvania
    Posts
    2,528
    Thanks
    92
    Thanked 361 Times in 271 Posts

    Yes I van navigate to /vat/stash and do anything with the file I might want. I just have to figure out thats where everything was. The first time I actually restored my phone thinking something was messed up.

  9. #8
    Hey guys, I need some more room on my iPhone but I'm a bit scared off by BossTool. A few questions if I could:

    -If I move my installed applications to the other drive, will I still be able to use them in exactly the same fashion as I do now?

    -If I just move fonts and wallpaper, will this make any noticeable difference?

    Thanks in advance.

  10. #9
    Retired Moderator bhz1's Avatar
    Join Date
    Sep 2007
    Location
    Southeastern Pennsylvania
    Posts
    2,528
    Thanks
    92
    Thanked 361 Times in 271 Posts

    Ive used BossTool a bunch of times and as long as I moved everyhting with it, I never had a problem. This last time I restored, since I installed Cydia, it moves the apps when its installed.

    Moved apps work just like always with a couple of exceptions (easily fixable). Mainly you may need to see where things like Summerboard themes, Customize graphics, files are being stored. Sometimes they are in /root or sometimes in /mobile. You need to figure out where the app is looking for the files and perhaps move them. The lastest installs all semed to be in the correct places now though.

  11. #10
    My iPhone is a Part of Me MattMac's Avatar
    Join Date
    Dec 2007
    Location
    Nar Nar Goon, Victoria, Australia
    Posts
    739
    Thanks
    82
    Thanked 88 Times in 71 Posts

    Quote Originally Posted by bhz1 View Post
    Ive used BossTool a bunch of times and as long as I moved everyhting with it, I never had a problem. This last time I restored, since I installed Cydia, it moves the apps when its installed.

    Moved apps work just like always with a couple of exceptions (easily fixable). Mainly you may need to see where things like Summerboard themes, Customize graphics, files are being stored. Sometimes they are in /root or sometimes in /mobile. You need to figure out where the app is looking for the files and perhaps move them. The lastest installs all semed to be in the correct places now though.
    There root and mobile thing have nothing to do with boss tool but the application itself. 1.1.2 and earlier us /var/root as the main directory and 1.1.3 and above use var/mobile. var/mobile is more compatible with 1.1.3 and above. Some apps still aren't compatible with 1.1.3/4 and still install there files into var/root. The updated versions fix this but as long as other files (eg. SMB themes) install into the correct folder then there should be no problems.
    16GB iPhone 3G
    2.2 Pwned
    Dedicated Cydia User

    2.2 GHz Intel MacBook

    Mac OS X 10.5.5
    Bootcamp w/ Windows XP

  12. #11
    I installed Cydia AFTER installing a lot of apps using Installer.

    1. Does Cydia also move the old Installer installed apps to save space?

    2. Will continuing to use Installer place the new apps (installed using Installer) into the larger directory (since I have installed Cydia) ?

  13. #12
    My iPhone is a Part of Me MattMac's Avatar
    Join Date
    Dec 2007
    Location
    Nar Nar Goon, Victoria, Australia
    Posts
    739
    Thanks
    82
    Thanked 88 Times in 71 Posts

    @dbs, 1. Yes, Cydia moves all the apps to the second partition to save space on the first partition for the main file system and so you can install more apps.
    2. Yes, all new apps installed from Installer, Cydia, and manually installed will be automatically on the second partition, hence, saving you space on your main partition for better phone performance and larger number of apps installable.
    16GB iPhone 3G
    2.2 Pwned
    Dedicated Cydia User

    2.2 GHz Intel MacBook

    Mac OS X 10.5.5
    Bootcamp w/ Windows XP

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •