Difference between revisions of "Solution to App Catalog Installation Limit"

From WebOS Internals
Jump to navigation Jump to search
 
(112 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Based on rwhitby's findings that temporarily moving /var/usr/palm/applications will allow installing apps from the App Catalog, here's a permanent way to keep the apps on (much larger) /media/internal by using links. This will permanently save space on /var.
+
== Overview ==
 +
The 'mvapp' method is a Linux command that allows moving your Pre apps and email to the (much larger) media drive by using symbolic links. This will save space on internal system storage (/var) and allow more App Catalog apps to be installed, up to media drive limit (gigabytes) rather than the 64MB limit.
 +
 
 +
This method involves creating a (hidden) directory /media/internal/.apps, moving selected applications to the newly created directory, and then creating a symbolic link in the /var/usr/palm/applications directory pointing to the new location.  mvapp v0.3.0 and higher now also moves email and attachments to /media/internal/.data. This frees up the disk space from the relatively limited internal system volume (/var) to the much larger media drive (/media/internal). The 'mvapp' command (available on PreWare) will move the files and create the appropriate link.
 +
 
 +
== Solution (symbolic link method) ==
  
It's unfortunate that Palm has not resolved the issue in the 1.2 update. This is a workaround that could work long term, also saving space on /var, but this needs support by the homebrew community to add in the homebrew installer apps.
+
'''Install mvapp''':<br>
 +
Now on PreWare in the Linux Applications category. In PreWare Preferences, need to have 'show available types' turned on.
  
== Overview ==
+
<pre>
This solution involves creating a (hidden) directory in the /media/internal area, moving selected applications to the newly created directory, and then creating a symbolic link in the /var/usr/palm/applications directory pointing to the new location. This frees up the disk space from the relatively limited /var volume to the larger /media/internal. The included script (which must be created) will move the files and create the appropriate link. It will also provide information on the size of the applications stored in the /var/usr/palm/applications directory.
+
Quick Start Guide
 +
- Launch PreWare
 +
- In PreWare Preferences, need to have 'Show All Package Types' turned on
 +
- Install 'mvapp' from PreWare in the Available Other -> Linux Application category
 +
- Install Terminal app from PreWare (if not already installed)
 +
- Open Terminal from Launcher, then type...
  
== Solution (symbolic link method) ==
+
mvapp doctor
 +
mvapp bulkmv
 +
</pre>
  
Create a script to move apps to new home and create link.  You can use an editor or use the following cat command to paste the code, for those not familiar with editors.
+
== Prepping for webOS 1.3.5 Update ==
 +
There's a pretty good chance the next webOS update will address the app limit storage issues, which will mean 'mvapp' will likely not be needed from that point on.
  
<code>mount -o remount,rw /
+
Best Case Scenario:
 +
There is the possibility that mvapp will be compatible with 1.3.5. It may be able to maintain the links with the new app storage method. If the case, you can do nothing or 'mvapp restoreall' after the update. I'll likely able to answer this before 1.3.5 is released.
  
cat >/usr/bin/mvapp </code>
+
Otherwise...
  
(paste the code below, press ctrl-c on keyboard to exit after pasting the code.)
+
Pre Update Option:
 +
In preparation, just before upgrading to webOS 1.3.5, you can perform a 'mvapp restoreall' to restore apps and 'mvapp unlinkemail' to restore email back to the /var location.
  
(set command to be executable)
+
However if you have accumulated dozens of apps and/or a large amount of email, you may not be able to restore fully and have enough room for the upgrade. You may need to do some cleanup by removing apps that you do not use. After the update, you should be able to reinstall your deleted apps. If willing, you may also consider deleting your email accounts and reinstalling before performing 'mvapp unlinkemail'. Though I suspect that linked email will be compatible with 1.3.5.
<code> chmod 777 /usr/bin/mvapp </code>
 
  
----
+
Post Update Option:
code:
+
I'm planning to have a secondary recovery option for those who perform an OS update before getting a chance to restore mvapp links, but it won't be released until the day of the update. Hopefully 1.3.5 will be compatible with existing mvapp links and no preparation will be needed.
<pre>
 
#!/bin/sh
 
  
# This code is open for re-use with no restrictions.  xorg
+
Follow this section for more details.
# This is a working proof of concept script. 
 
# Intent is for someone to port to a webOS app.
 
  
#-------------------------------------------------------------------------#
+
== Precautions ==
# versions:
 
# 0.1.0 - original (xorg)
 
# 0.1.1 - added unlink and clean functions (daventx)
 
# 0.1.2 - added bulkmv function, allows moving many apps (xorg)
 
# 0.1.3 - added option for tar backups (xorg)
 
#-------------------------------------------------------------------------#
 
  
#-------------------------------------------------------------------------#
+
So far, no one has reported issues with apps or email due to linking.  These are best practices to avoid issues.
# variables: these are globally available to all functions
 
#-------------------------------------------------------------------------#
 
COMMAND=$1
 
APP=$2
 
MEDIA=/media/internal/.apps
 
VAR=/var/usr/palm/applications
 
  
# Option to do tar based backups. Keeps file attributes but uses more space.
+
- Version 0.3.0 and higher now can move email and attachments to media drive. It is unknown how a future webOS release will deal with the storage issues. It's possible a future webOS release could break the email link to the media drive. While I'd likely have a new mvapp release out before next webOS release, losing email on the phone is a possibility and you may have to resetup email accounts. Moving email is not recommended if you rely on email for your job unless you don't mind possibly losing all email on the phone. Your email will still exist at the original source (gmail, yahoo, hotmail, etc), so linking email is not likely to have much of an impact for most of us.
BACKUP=1  # set to 1 for tar backups, 0 to disable
 
BACKUPDIR=/media/internal/.appbackups
 
  
 +
- If Palm releases a new webOS that resolves the overall issue, you _may_ (but not likely) need to completely restore your apps back to /var before performing the upgrade - mvapp restoreall. For email - mvapp unlinkemail. If a future webOS update is applied before you get a chance to restore, it's possible it could break this method, so moving apps that store important information to you is not recommended. Since it would likely be a significant architectural change for Palm to fix this issue, storage issues may not be officially resolved until webOS 2.0, but who knows. webOS 1.3.1 does not have any issues with mvapp.
  
#-------------------------------------------------------------------------#
+
- This is a workaround script not approved by PalmThe usual disclaimers apply.
# function: usage - show command usage options
 
#-------------------------------------------------------------------------#
 
usage () {
 
  echo "Usage: mvapp link domain.appname    - move app to media and link"
 
  echo "Usage: mvapp unlink domain.appname - restore app to var and remove link"
 
  echo "Usage: mvapp clean domain.appname  - remove app dir and links"
 
  echo "Usage: mvapp list                  - list all apps sorted by size"
 
  echo "Usage: mvapp bulkmv                - move/link bulk apps"
 
  exit 1
 
}
 
# end of usage function
 
  
#-------------------------------------------------------------------------#
+
== Commands ==
# function: cleanapp - removes symbolic links and folder in media and var
+
'''To run diagnostics on /var and get recommendations'''
#-------------------------------------------------------------------------#
 
cleanapp () {
 
  
mount -o remount,rw /
+
<code>mvapp diag<br>
+
(or shortcut)<br>
# exit to usage if no app name supplied
+
m d<br>
if [ ! $APP ]
+
m d m (includes media apps, slower)</code>
then
 
  usage
 
fi
 
  
# Optional
+
This reports the usage of applications, email and attachments on /varIt also recommends actions based on the results.
echo "This will remove $APP from both $VAR and $MEDIA."
 
  echo "You should first attempt to remove the app using the official Pre methods."
 
echo "Are you sure you want to remove $APP? [y/N]: "
 
read answer
 
case $answer in
 
  [Yy]*) continue;;
 
      *) exit;;
 
esac
 
  
if [ -d $VAR/$APP ]
 
then
 
  echo "Removing all traces of $APP."
 
else
 
  echo "$APP does not exist..."
 
  usage
 
fi
 
  
echo "Size of $VAR before cleanup... "
+
'''To find the largest apps in /var/usr/palm/applications'''
du -sh $VAR
 
  
if [ -d $MEDIA/$APP ]
+
<code>mvapp list<br>
then
+
(or shortcut)<br>
      rm -r $MEDIA/$APP
+
m ls</code>
      echo "Removed directory" $MEDIA/$APP
 
fi
 
if [ -d $VAR/$APP ]
 
then
 
      rm -r $VAR/$APP
 
      echo "Removed directory" $VAR/$APP
 
fi
 
if [ -L $VAR/$APP ]
 
then
 
      rm -r $VAR/$APP
 
      echo "Removed link" $VAR/$APP
 
fi
 
if [ -f $BACKUPDIR/$APP.tgz ]
 
then
 
      rm -r $BACKUPDIR/$APP.tgz
 
      echo "Removed tar backup" $BACKUPDIR/$APP.tgz
 
fi
 
  
 +
The first number is size of app in KB, largest shown last. IE....<br>
 +
<code>
 +
8352 com.apnews.webos<br>
 +
8512 com.fandango.app.fandango<br>
 +
8672 com.palm.app.musicplayerremix<br>
 +
10304 com.shortcovers.palm.pre<br>
 +
10432 com.fusioncreativestudios.deadman<br>
 +
10656 com.ulocate.app.where<br>
 +
</code>
  
# rescan luna in case it's needed
 
luna-send -n 1 palm://com.palm.applicationManager/rescan {} >/dev/null 2>&1
 
  
echo "$APP directories and links removed."
+
'''To move and link an app to /media'''
echo "Size of $VAR after cleanup... "
 
du -sh $VAR
 
exit 0
 
}
 
# end of cleanup function
 
  
 +
<code>mvapp link domain.appname<br>
 +
(or shortcut)<br>
 +
m ln domain.appname</code>
  
#-------------------------------------------------------------------------#
+
Example: mvapp link com.ulocate.app.where
# function: listapps - list the size of each app, sort showing largest last
 
#-------------------------------------------------------------------------#
 
listapps () {
 
du -s $VAR/* | sort -n
 
exit 0
 
}
 
# end of listapps function
 
  
 +
The app should now work in the new location thanks to the link. Test each app to make sure it works before doing another.
  
#-------------------------------------------------------------------------#
+
Continue moving apps until it reports the 'var used' is below 100MB.  If 'var used' is 95MB, you could add 5MB more apps.
# function: linkapp - move the app to media and create symbolic link
 
#-------------------------------------------------------------------------#
 
linkapp () {
 
  
if [ ! -d $MEDIA ]
 
then
 
      mkdir $MEDIA
 
fi
 
  
if [ -h $VAR/$APP ]
+
'''To move and link many apps'''
then
 
      echo "Link already exists for... ${APP}"
 
      exit 1
 
fi
 
  
mount -o remount,rw /
+
<code>mvapp bulkmv<br>
 +
(or shortcut)<br>
 +
m bm</code>
  
# Backup using tar if enabled
+
This will show largest app first, ask if you want to move/link and then moves on to the next largest app. If you answer no to an app, it will skip to the next. Answer 'q' to quit. Is easiest to use this method directly on the phone using the Terminal app, available in Homebrew.
if [ $BACKUP ]
 
then
 
  if [ ! -d $BACKUPDIR ]
 
  then
 
    mkdir $BACKUPDIR
 
  fi
 
  echo "Backing up $APP to $BACKUPDIR..."
 
  tar czf $BACKUPDIR/${APP}.tgz $VAR/$APP
 
fi
 
  
if [ -d $VAR/$APP ]
+
'''To search for apps by partial app name'''
then
 
  echo "Moving $APP to $MEDIA..."
 
else
 
  echo "$APP does not exist..."
 
  usage
 
fi
 
  
mount -o remount,rw /
+
<code>mvapp search<br>
 +
(or shortcut)<br>
 +
m s</code>
  
  echo "Size of $VAR before move... "
+
This is an easier way to link/unlink/clean apps from the Terminal app. You only need to supply a partial app package name. It will show any matches then ask what you'd like to do with it.
du -sh $VAR
 
  
# move over to USB drive
+
'''To restore the app to original location and delete the link'''
cp -r  $VAR/$APP $MEDIA
 
if [ $? != 0 ]
 
then
 
  echo "Copy failed. Leaving app in $VAR."
 
  exit 3
 
fi
 
  
rm -r $VAR/$APP
+
<code>mvapp unlink domain.appname<br>
if [ $? != 0 ]
+
(or shortcut)<br>
then
+
m ul domain.appname</code>
  echo "Remove failed. Leaving app in $VAR."
 
  rm -r $MEDIA/$APP
 
  exit 4
 
fi
 
  
  # create the symbolic link
+
The application will be moved back to the original directory. If you have issues with an app after unlinking, see the Contingency Plan section below.
ln -s $MEDIA/$APP $VAR/$APP
 
  
# rescan luna in case it's needed
 
luna-send -n 1 palm://com.palm.applicationManager/rescan {} >/dev/null 2>&1
 
  
echo "$APP moved and linked."
+
'''To list apps that have been moved and linked...'''
echo "Size of $VAR after move... "
 
du -sh $VAR
 
}
 
# end of linkapp function
 
  
 +
<code>mvapp listmoved<br>
 +
(or shortcut)<br>
 +
m lm</code>
  
#-------------------------------------------------------------------------#
+
This shows a list of apps that have been moved and linked to /media.  
# function: unlinkapp - restore the app to var and remove symbolic link
 
#-------------------------------------------------------------------------#
 
unlinkapp () {
 
  
mount -o remount,rw /
 
  
if [ -d $MEDIA/$APP ]
+
'''To restore all moved apps back to original location'''
then
 
  echo "Restoring $APP..."
 
else
 
  echo "$APP does not exist..."
 
  usage
 
fi
 
  
echo "Size of $VAR before move... "
+
<code>mvapp restoreall<br>
du -sh $VAR
+
(or shortcut)<br>
 +
m ra</code>
  
  # remove the old symbolic link
+
This will restore ALL applications that have been moved/linked, back to the original location in /var. This may take several minutes to complete.  It will show each application progress.  Beware that if you have moved a very large number of apps over a period of time, they may not all fit on /var.  You may need to remove some/many unused apps before restoring all.
rm -r $VAR/$APP
 
  
# move to original location or restore from tar if it exists
 
if [ -f $BACKUPDIR/$APP.tgz ]
 
then
 
  cd /
 
  tar xzf $BACKUPDIR/$APP.tgz
 
  if [ $? != 0 ]
 
  then
 
  echo "Tar restore failed. Remove and restore app using official webOS/Pre methods."
 
  exit 3
 
  else
 
  rm -r $BACKUPDIR/$APP.tgz
 
  fi
 
else
 
  cp -r  $MEDIA/$APP $VAR
 
  if [ $? != 0 ]
 
  then
 
  echo "Copy failed. Leaving app in $MEDIA."
 
  exit 3
 
  fi
 
fi
 
  
rm -r $MEDIA/$APP
+
'''To cleanup and remove directories and symlinks'''
if [ $? != 0 ]
 
then
 
  echo "Remove failed. Leaving app in $MEDIA."
 
  rm -r $VAR/$APP
 
  exit 4
 
fi
 
  
# rescan luna in case it's needed
+
<code>mvapp clean domain.appname<br>
luna-send -n 1 palm://com.palm.applicationManager/rescan {} >/dev/null 2>&1
+
(or shortcut)<br>
 +
m c domain.appname</code>
  
  echo "$APP moved and unlinked."
+
If you have any issues, first attempt to remove the app from Launcher, the App Catalog or Homebrew app installer. It's very important you remove from the phone first before using the clean command.  Then issue the 'clean' command to remove the applications directories at both locations and also the symlinkYou can then reinstall the app from the App Catalog or any Homebrew App installer.
  echo "Size of $VAR after move... "
 
du -sh $VAR
 
}
 
# end of unlinkapp function
 
  
#-------------------------------------------------------------------------#
 
# function: bulkvm -  move/link many apps
 
#-------------------------------------------------------------------------#
 
bulkmv() {
 
echo
 
echo
 
echo "This allows moving many apps, asking which you'd like to move."
 
echo "Starting with the largest apps."
 
echo
 
  
 +
'''To move and link email and attachments'''
  
mount -o remount,rw /
+
<code>mvapp linkemail<br>
cd $VAR
+
(or shortcut)<br>
 +
m le</code>
  
for i in `du -s * | sort -nr |cut -f 2`
+
This will move all of your email from /var to /media/internal/.data/emails. This will close the email application so if you are writing a new email, be sure to send the email before using this commend.  Also see the Precautions section above.
do
 
    export APP=$i
 
    SIZE=`du -sh $APP |cut -f 1`
 
    echo "Size of $APP is $SIZE."
 
    echo "Would you like to move and link $APP ? [y/N/q]: "
 
    read answer
 
    case $answer in
 
    [Yy]*) linkapp;;
 
    [Qq]*) exit 0;;
 
        *) echo "$APP not moved."
 
          continue;;
 
    esac
 
  
    echo
+
'''To restore and unlink email and attachments'''
done
 
}
 
# end of bulkmv function
 
  
 +
<code>mvapp unlinkemail<br>
 +
(or shortcut)<br>
 +
m ue</code>
  
 +
This will restore all of your email from /media back to /var.  This will close the email application so if you are writing a new email, be sure to send the email before using this commend.
  
#-------------------------------------------------------------------------#
+
== Hidden Commands ==
# main - begins here
 
#-------------------------------------------------------------------------#
 
  
case $COMMAND in
+
These commands are not documented in the Usage display.
"clean")
 
  cleanapp
 
  ;;
 
"list")
 
  listapps
 
  ;;
 
"link")
 
  linkapp
 
  ;;
 
"unlink")
 
  unlinkapp
 
  ;;
 
"bulkmv")
 
  bulkmv
 
  ;;
 
*)
 
  usage
 
  ;;
 
esac
 
</pre>
 
  
----
+
'''Check Links'''
  
 +
<code>mvapp checklinks<br>
 +
(or shortcut)<br>
 +
m cl</code>
  
 +
Checks if apps in /media have a link.  If not, you have the option to remove the app from media, which is recommended.  This can occur if the app was not fully removed when you removed from Launcher or homebrew installer.
  
<code>chmod 777 /usr/bin/mvapp</code>
+
'''Check if Fair Dinkum is installed'''
  
== Commands ==
+
<code>mvapp checkfd<br>
 +
(or shortcut)<br>
 +
m cfd</code>
  
'''To find the largest apps in /var/usr/palm/applications'''
+
Checks if Fair Dinkum is/isn't installed and enabled.  Also shows current version of PreWare and Package Manager Service installed.
  
<code>mvapp list</code>
+
'''Update PreWare'''
  
It shows the largest apps last... IE....<br>
+
<code>mvapp upw<br>
<code>
 
8352 com.apnews.webos<br>
 
8512 com.fandango.app.fandango<br>
 
8672 com.palm.app.musicplayerremix<br>
 
10304 com.shortcovers.palm.pre<br>
 
10432 com.fusioncreativestudios.deadman<br>
 
10656 com.ulocate.app.where<br>
 
 
</code>
 
</code>
  
'''To move and link com.ulocate.app.where'''
+
Updates PreWare and Package Manager Services to most recent version. You need to confirm install of each by answering 'y' for yes.
  
<code>mvapp link com.ulocate.app.where</code>
 
  
The app should now work in the new location thanks to the link. Test each app to make sure it works before doing another. I don't recommend looping the script to do every app in the dir or to link the entire app dir. File attributes are lost on the move, which some apps may need. You need to test each app after a move.
+
'''Update Terminal App'''
  
There is an option to turn on/off tar-based backups.  See the BACKUP variable in the script.  If set to 1, it will perform a tar backup.  This takes up more space on /media but if you need to restore, it puts it back with full file attributes.
+
<code>mvapp upt<br>
 +
</code>
  
'''To move and link many apps''' (added in 0.1.1)
+
Updates the Terminal app to most recent version. You should not run this within the Terminal app.  Use it when accessing Linux through a computer.
  
<code>mvapp bulkmv</code>
+
'''To force tar restore'''
  
This will show largest app first, ask if you want to move/link and then moves on to the next largest app.  If you answer no to an app, it will skip to the next.  Answer 'q' to quit.  Is easiest to use this method directly on a device using the Terminal app.
+
<code>mvapp ftr domman.appname</code>
  
'''To revert the move and delete the link command, use this script'''
+
This is a hidden function not shown in usage.  It is for those who used an older version of mvapp and had tar backups.  If you need to restore an app from tar, use this command.  Or just remove the app from Launcher and reinstall if necessary.
  
<code>mvapp unlink com.ulocate.app.where</code>
 
  
The application will then be placed back to the original directory. File attributes are lost on the move if tar backup is turned off, which some apps may need. You need to test each app after a move.  If tar backup is turned on (see BACKUP variable in script), file attributes will be restored. 
+
'''To remove tar backups'''
  
'''To cleanup and remove directories and symlinks'''
+
<code>mvapp rtb</code>
 +
 
 +
This is a hidden function not shown in usage.  Tar backups have been disabled by default since mvapp 0.2.4.  Tar backup has been turned off because it wastes space on /media and has potential issues with restoring older versions of an app. Its purpose was to restore special file attributes not supported by FAT filesystem. The script no longer moves apps that FAT fs cannot support, so tar is no longer needed.  If you no longer need old tar backups, use this command to remove the entire backup directory.
  
If you have any issues, issuing the following command will remove the applications directories at both locations and also the symlink. While this may not solve all the problems, it does give you a fresh start.  You can then reinstall the app from the App Catalog or any Homebrew App installer.
+
== Contingency Plan==
  
<code>mvapp clean com.ulocate.app.where</code>
+
If you have problems with an application, follow these steps...<br>
 +
-- Close the application if open<br>
 +
-- mvapp unlink domain.appname<br>
 +
-- Try using the App<br>
  
== Contingency Plan==
+
If the application still does now work correctly...<br>
If you have issues with an app, remove it completely and reinstall through the respective app catalog or homebrew installer app.
+
-- Remove the App using official methods (remove from Launcher or Homebrew installer)<br>
 +
-- mvapp clean domain.appname<br>
 +
-- Reinstall through the App Catalog or Homebrew installer app<br>
  
If not completely removed, use the command...
+
If you have issues with email, follow these steps...<br>
mvapp clean com.appname
+
-- mvapp unlinkemail
  
 
== Proposal to Dev Community ==
 
== Proposal to Dev Community ==
Line 388: Line 225:
 
This is a formal proposal to the Dev Community suggesting that PreWare, WebOS Quick Install and other Pre installer apps provide an option to move any app in /var to the /media fs and create a link similar to the code above.   
 
This is a formal proposal to the Dev Community suggesting that PreWare, WebOS Quick Install and other Pre installer apps provide an option to move any app in /var to the /media fs and create a link similar to the code above.   
  
The Homebrew Community somewhat created part of the storage problem so needs to come up with their own solution. We propose that Homebrew apps be moved with a link to /media/internal by default and physically use /var only if needed (per conditions stated below). The developer would put a flag in the package (or some other method during submission) to state their app is able to run linked to /media or if it specifically needs to physically be on /var.  Will propose additions to Packing Standards to support /media links.  The homebrew installer apps could then automatically do the move/link if the package is flagged for it.
+
The Homebrew Community somewhat created part of the storage problem so needs to come up with their own solution. The symbolic link proponents propose that Homebrew apps be moved with a link to /media/internal by default and physically use /var only if needed (per conditions stated below). The developer would put a flag in the package (or some other method during submission) to state their app is able to run linked to /media or if it specifically needs to physically be on /var.  Will propose additions to Packaging Standards to support /media links.  The homebrew installer apps could then automatically do the move/link if the package is flagged for it.
  
 
Candidate apps for moving to /media<br>
 
Candidate apps for moving to /media<br>
- apps that do not depend on file attributes (such as executable bit)<br>
+
- apps that do not depend on file attributes not supported by FAT (such as sticky bit or internal links) - The script (post 0.2.0 now deals with this).<br>
 
- apps that do not perform data operations to home app directory when device is USB mounted<br>
 
- apps that do not perform data operations to home app directory when device is USB mounted<br>
  
 
Exceptions for maintaining apps on /var<br>
 
Exceptions for maintaining apps on /var<br>
- apps that depend on file attributes<br>
+
- apps that depend on file attributes not supported by FAT - The script (post 0.2.0 now deals with this).<br>
 
- apps that won't work well when device is USB mounted, such as performing data or DB operations in home app directory<br>
 
- apps that won't work well when device is USB mounted, such as performing data or DB operations in home app directory<br>
  
Line 401: Line 238:
  
 
== Benefits over other methods ==
 
== Benefits over other methods ==
 +
 +
'' Fair Dinkum method''<br>
 +
Rod Whitby's FD method works up to a point but if /var usage is over 100MB, the FD method no longer works.  The symlink method not only saves space on /var, it can reduce it significantly when many apps and email are moved to media drive.
  
 
''Resizing /var''  <br>
 
''Resizing /var''  <br>
One challenge with resizing /var is that it will still have a fixed static limit - how do you decide how much to increase it? Many will still probably hit the limit or waste space if setting too high.  The link method allows to dynamically use the /media partition, so there is no need to set a specific size dedicated to apps. If the USB drive is filled, users can decide if they use the space for media or apps on the fly.
+
One challenge with resizing /var is that it will still have a fixed static limit - how do you decide how much to increase it? Many will still probably hit the limit or waste space if setting too high.  There is also the warning from Palm that resizing var may interfere with future updates.  The link method allows to dynamically use the /media partition, so there is no need to set a specific size dedicated to apps. If the USB drive is filled, users can decide if they use the space for media or apps on the fly.
  
 
''AppPath in /etc/luna.conf'' <br>
 
''AppPath in /etc/luna.conf'' <br>
I proposed a while back adding an AppPath to luna.conf and moving the apps to /media.  Some apps would not work because some apparently reference /var.  IE, the vampire/mafia/quest series could not access graphics.  The symbolic link fixed this because apps think they are in /var.
+
I proposed a while back adding an AppPath to luna.conf to include apps stored on /media.  Some apps would not work because some apparently reference /var.  IE, the vampire/mafia/quest series could not access graphics.  The symbolic link fixed this because apps think they are in /var.
  
 
''Link/mount [[all]] of /var/usr/palm/applications/ to /media/internal'' <BR>
 
''Link/mount [[all]] of /var/usr/palm/applications/ to /media/internal'' <BR>
If some apps rely on file attributes this won't work since file attributes are lost when moved to FAT fs.  Probably isn't wise to force all /var apps to /media.  Moving apps one at a time is less risky.
+
If some apps rely on file attributes this won't work since file attributes are lost when moved to FAT fs.  While this is rare, it probably isn't wise to force all /var apps to /media.  Selectively moving apps one at a time is less risky.  Update:  Have found that "PDF View" app does not allow to be linked, so it appears that selectively moving apps is necessary.
  
 
''Creating a loopback filesystem to a virtual file located on /media/internal'' <br>
 
''Creating a loopback filesystem to a virtual file located on /media/internal'' <br>
This has been worked on [http://www.webos-internals.org/wiki/Tutorials_Linux_opt_on_loopback here] and still has potential.  Unfortunately it locks out USB mount and media sync altogether.  If a workaround can be found with low risk, this may be the most ideal solution.
+
This has been worked on [http://www.webos-internals.org/wiki/Tutorials_Linux_opt_on_loopback here] and still has potential.  Unfortunately it locks out USB mount and media sync altogether.  If a workaround can be found with low risk, this may be the most ideal solution. 
 +
 
 +
Suggestion to Palm... consider virtually mounting /media so that both the kernel and USB can use /media simultaneously.  This would allow the loopback fs to work and would probably also allow phone calls while USB mounted.  This could become the strategic solution.
  
 
== Risks, Issues, Dependencies ==
 
== Risks, Issues, Dependencies ==
  
- File attributes of linux fs are not copied over to fat fs.  May not work with apps that rely on file attributes.  In general, javascript apps will likely work fine located on /media.
+
- Some file attributes of linux fs are not possible on FAT fs (USB drive)The 0.2.0 version (and higher) now deals with any apps that cannot copy attributes/permissions properlyThe script will not move apps that have special attributes or conditions that FAT fs can't deal with.  In general, this has been resolved.  No known issues with apps since version 0.2.0 or later.
  
- Some apps may not behave well if USB drive is mounted to computer, though I've tested several that behaved fine. Linux type background services probably would not work well so probably should not be moved.  Apps that do IO to the home directory of the app while USB mounted may have issues when located on /media.
+
- Some apps may not behave well if USB drive is mounted to computer, though I've tested several that behaved fine. Linux type background services probably would not work well so probably should not be moved.  Apps that do IO to the home directory of the app while USB mounted may have issues when located on /media.  I'm not aware of any apps that write to their own home directory, so this may not be a risk in general, but is still a possibility.  If you run into issues with an app, see the Contingency Plan.
  
- Jason Robitaille has indicated that a future version of WebOS Quick Install will include a routine to resize the /var partition. He has also indicated that doing so will wipe the /media/internal area, so any applications stored there would need to be backed up first. It might be good to be able to reverse the process of this solution. This could be done either by adding to this <code>mvapp</code> script, or creating a new one.
+
 
 +
== Confirmed Apps ==
 +
=== Apps Confirmed ''Not'' to Work ===
 +
com.palm.app.pdfviewer  (script v0.2.0 and higher properly handles this, won't allow it to move)
  
 
== Discuss ==
 
== Discuss ==
Line 426: Line 271:
  
 
http://forums.precentral.net/web-os-development/205649-resolution-app-catalog-install-limit-proposal.html
 
http://forums.precentral.net/web-os-development/205649-resolution-app-catalog-install-limit-proposal.html
 +
 +
== Source ==
 +
 +
The source has been moved to gitorious...
 +
 +
http://gitorious.org/webos-internals/mvapp
  
 
== Credits ==
 
== Credits ==
xorg - initially developed script and proposal.  maintainer of this page.<br>
+
<pre>
daventx - added unlink and clean functions.
+
xorg - initially developed script and proposal.  maintainer of this page.
 +
daventx - added unlink and clean functions, other suggestions<br>
 +
nt4cats - found Fair Dinkum breaks mvapp, gave solution to use explicit path.
 +
SirWill, hparsons, bclancy, navinag, dhcalva, chodaboy - testing, usable suggestions and feedback
 +
emoney22 - pointed out hidden directory in /media hides images from Photo app
 +
greg_roll - provided info to capture running apps
 +
rwhitby - setup webosinternals repository for homebrew distro
 +
 
 +
And thanks to the many testers who gave feedback on the PreCentral thread.
 +
</pre>

Latest revision as of 22:15, 10 December 2009

Overview

The 'mvapp' method is a Linux command that allows moving your Pre apps and email to the (much larger) media drive by using symbolic links. This will save space on internal system storage (/var) and allow more App Catalog apps to be installed, up to media drive limit (gigabytes) rather than the 64MB limit.

This method involves creating a (hidden) directory /media/internal/.apps, moving selected applications to the newly created directory, and then creating a symbolic link in the /var/usr/palm/applications directory pointing to the new location. mvapp v0.3.0 and higher now also moves email and attachments to /media/internal/.data. This frees up the disk space from the relatively limited internal system volume (/var) to the much larger media drive (/media/internal). The 'mvapp' command (available on PreWare) will move the files and create the appropriate link.

Solution (symbolic link method)

Install mvapp:
Now on PreWare in the Linux Applications category. In PreWare Preferences, need to have 'show available types' turned on.

Quick Start Guide
- Launch PreWare
- In PreWare Preferences, need to have 'Show All Package Types' turned on
- Install 'mvapp' from PreWare in the Available Other -> Linux Application category
- Install Terminal app from PreWare (if not already installed)
- Open Terminal from Launcher, then type...

mvapp doctor
mvapp bulkmv

Prepping for webOS 1.3.5 Update

There's a pretty good chance the next webOS update will address the app limit storage issues, which will mean 'mvapp' will likely not be needed from that point on.

Best Case Scenario: There is the possibility that mvapp will be compatible with 1.3.5. It may be able to maintain the links with the new app storage method. If the case, you can do nothing or 'mvapp restoreall' after the update. I'll likely able to answer this before 1.3.5 is released.

Otherwise...

Pre Update Option: In preparation, just before upgrading to webOS 1.3.5, you can perform a 'mvapp restoreall' to restore apps and 'mvapp unlinkemail' to restore email back to the /var location.

However if you have accumulated dozens of apps and/or a large amount of email, you may not be able to restore fully and have enough room for the upgrade. You may need to do some cleanup by removing apps that you do not use. After the update, you should be able to reinstall your deleted apps. If willing, you may also consider deleting your email accounts and reinstalling before performing 'mvapp unlinkemail'. Though I suspect that linked email will be compatible with 1.3.5.

Post Update Option: I'm planning to have a secondary recovery option for those who perform an OS update before getting a chance to restore mvapp links, but it won't be released until the day of the update. Hopefully 1.3.5 will be compatible with existing mvapp links and no preparation will be needed.

Follow this section for more details.

Precautions

So far, no one has reported issues with apps or email due to linking. These are best practices to avoid issues.

- Version 0.3.0 and higher now can move email and attachments to media drive. It is unknown how a future webOS release will deal with the storage issues. It's possible a future webOS release could break the email link to the media drive. While I'd likely have a new mvapp release out before next webOS release, losing email on the phone is a possibility and you may have to resetup email accounts. Moving email is not recommended if you rely on email for your job unless you don't mind possibly losing all email on the phone. Your email will still exist at the original source (gmail, yahoo, hotmail, etc), so linking email is not likely to have much of an impact for most of us.

- If Palm releases a new webOS that resolves the overall issue, you _may_ (but not likely) need to completely restore your apps back to /var before performing the upgrade - mvapp restoreall. For email - mvapp unlinkemail. If a future webOS update is applied before you get a chance to restore, it's possible it could break this method, so moving apps that store important information to you is not recommended. Since it would likely be a significant architectural change for Palm to fix this issue, storage issues may not be officially resolved until webOS 2.0, but who knows. webOS 1.3.1 does not have any issues with mvapp.

- This is a workaround script not approved by Palm. The usual disclaimers apply.

Commands

To run diagnostics on /var and get recommendations

mvapp diag
(or shortcut)
m d
m d m (includes media apps, slower)

This reports the usage of applications, email and attachments on /var. It also recommends actions based on the results.


To find the largest apps in /var/usr/palm/applications

mvapp list
(or shortcut)
m ls

The first number is size of app in KB, largest shown last. IE....
8352 com.apnews.webos
8512 com.fandango.app.fandango
8672 com.palm.app.musicplayerremix
10304 com.shortcovers.palm.pre
10432 com.fusioncreativestudios.deadman
10656 com.ulocate.app.where


To move and link an app to /media

mvapp link domain.appname
(or shortcut)
m ln domain.appname

Example: mvapp link com.ulocate.app.where

The app should now work in the new location thanks to the link. Test each app to make sure it works before doing another.

Continue moving apps until it reports the 'var used' is below 100MB. If 'var used' is 95MB, you could add 5MB more apps.


To move and link many apps

mvapp bulkmv
(or shortcut)
m bm

This will show largest app first, ask if you want to move/link and then moves on to the next largest app. If you answer no to an app, it will skip to the next. Answer 'q' to quit. Is easiest to use this method directly on the phone using the Terminal app, available in Homebrew.

To search for apps by partial app name

mvapp search
(or shortcut)
m s

This is an easier way to link/unlink/clean apps from the Terminal app. You only need to supply a partial app package name. It will show any matches then ask what you'd like to do with it.

To restore the app to original location and delete the link

mvapp unlink domain.appname
(or shortcut)
m ul domain.appname

The application will be moved back to the original directory. If you have issues with an app after unlinking, see the Contingency Plan section below.


To list apps that have been moved and linked...

mvapp listmoved
(or shortcut)
m lm

This shows a list of apps that have been moved and linked to /media.


To restore all moved apps back to original location

mvapp restoreall
(or shortcut)
m ra

This will restore ALL applications that have been moved/linked, back to the original location in /var. This may take several minutes to complete. It will show each application progress. Beware that if you have moved a very large number of apps over a period of time, they may not all fit on /var. You may need to remove some/many unused apps before restoring all.


To cleanup and remove directories and symlinks

mvapp clean domain.appname
(or shortcut)
m c domain.appname

If you have any issues, first attempt to remove the app from Launcher, the App Catalog or Homebrew app installer. It's very important you remove from the phone first before using the clean command. Then issue the 'clean' command to remove the applications directories at both locations and also the symlink. You can then reinstall the app from the App Catalog or any Homebrew App installer.


To move and link email and attachments

mvapp linkemail
(or shortcut)
m le

This will move all of your email from /var to /media/internal/.data/emails. This will close the email application so if you are writing a new email, be sure to send the email before using this commend. Also see the Precautions section above.

To restore and unlink email and attachments

mvapp unlinkemail
(or shortcut)
m ue

This will restore all of your email from /media back to /var. This will close the email application so if you are writing a new email, be sure to send the email before using this commend.

Hidden Commands

These commands are not documented in the Usage display.

Check Links

mvapp checklinks
(or shortcut)
m cl

Checks if apps in /media have a link. If not, you have the option to remove the app from media, which is recommended. This can occur if the app was not fully removed when you removed from Launcher or homebrew installer.

Check if Fair Dinkum is installed

mvapp checkfd
(or shortcut)
m cfd

Checks if Fair Dinkum is/isn't installed and enabled. Also shows current version of PreWare and Package Manager Service installed.

Update PreWare

mvapp upw

Updates PreWare and Package Manager Services to most recent version. You need to confirm install of each by answering 'y' for yes.


Update Terminal App

mvapp upt

Updates the Terminal app to most recent version. You should not run this within the Terminal app. Use it when accessing Linux through a computer.

To force tar restore

mvapp ftr domman.appname

This is a hidden function not shown in usage. It is for those who used an older version of mvapp and had tar backups. If you need to restore an app from tar, use this command. Or just remove the app from Launcher and reinstall if necessary.


To remove tar backups

mvapp rtb

This is a hidden function not shown in usage. Tar backups have been disabled by default since mvapp 0.2.4. Tar backup has been turned off because it wastes space on /media and has potential issues with restoring older versions of an app. Its purpose was to restore special file attributes not supported by FAT filesystem. The script no longer moves apps that FAT fs cannot support, so tar is no longer needed. If you no longer need old tar backups, use this command to remove the entire backup directory.

Contingency Plan

If you have problems with an application, follow these steps...
-- Close the application if open
-- mvapp unlink domain.appname
-- Try using the App

If the application still does now work correctly...
-- Remove the App using official methods (remove from Launcher or Homebrew installer)
-- mvapp clean domain.appname
-- Reinstall through the App Catalog or Homebrew installer app

If you have issues with email, follow these steps...
-- mvapp unlinkemail

Proposal to Dev Community

This is a formal proposal to the Dev Community suggesting that PreWare, WebOS Quick Install and other Pre installer apps provide an option to move any app in /var to the /media fs and create a link similar to the code above.

The Homebrew Community somewhat created part of the storage problem so needs to come up with their own solution. The symbolic link proponents propose that Homebrew apps be moved with a link to /media/internal by default and physically use /var only if needed (per conditions stated below). The developer would put a flag in the package (or some other method during submission) to state their app is able to run linked to /media or if it specifically needs to physically be on /var. Will propose additions to Packaging Standards to support /media links. The homebrew installer apps could then automatically do the move/link if the package is flagged for it.

Candidate apps for moving to /media
- apps that do not depend on file attributes not supported by FAT (such as sticky bit or internal links) - The script (post 0.2.0 now deals with this).
- apps that do not perform data operations to home app directory when device is USB mounted

Exceptions for maintaining apps on /var
- apps that depend on file attributes not supported by FAT - The script (post 0.2.0 now deals with this).
- apps that won't work well when device is USB mounted, such as performing data or DB operations in home app directory

(Please update with other known candidates/exceptions)

Benefits over other methods

Fair Dinkum method
Rod Whitby's FD method works up to a point but if /var usage is over 100MB, the FD method no longer works. The symlink method not only saves space on /var, it can reduce it significantly when many apps and email are moved to media drive.

Resizing /var
One challenge with resizing /var is that it will still have a fixed static limit - how do you decide how much to increase it? Many will still probably hit the limit or waste space if setting too high. There is also the warning from Palm that resizing var may interfere with future updates. The link method allows to dynamically use the /media partition, so there is no need to set a specific size dedicated to apps. If the USB drive is filled, users can decide if they use the space for media or apps on the fly.

AppPath in /etc/luna.conf
I proposed a while back adding an AppPath to luna.conf to include apps stored on /media. Some apps would not work because some apparently reference /var. IE, the vampire/mafia/quest series could not access graphics. The symbolic link fixed this because apps think they are in /var.

Link/mount all of /var/usr/palm/applications/ to /media/internal
If some apps rely on file attributes this won't work since file attributes are lost when moved to FAT fs. While this is rare, it probably isn't wise to force all /var apps to /media. Selectively moving apps one at a time is less risky. Update: Have found that "PDF View" app does not allow to be linked, so it appears that selectively moving apps is necessary.

Creating a loopback filesystem to a virtual file located on /media/internal
This has been worked on here and still has potential. Unfortunately it locks out USB mount and media sync altogether. If a workaround can be found with low risk, this may be the most ideal solution.

Suggestion to Palm... consider virtually mounting /media so that both the kernel and USB can use /media simultaneously. This would allow the loopback fs to work and would probably also allow phone calls while USB mounted. This could become the strategic solution.

Risks, Issues, Dependencies

- Some file attributes of linux fs are not possible on FAT fs (USB drive). The 0.2.0 version (and higher) now deals with any apps that cannot copy attributes/permissions properly. The script will not move apps that have special attributes or conditions that FAT fs can't deal with. In general, this has been resolved. No known issues with apps since version 0.2.0 or later.

- Some apps may not behave well if USB drive is mounted to computer, though I've tested several that behaved fine. Linux type background services probably would not work well so probably should not be moved. Apps that do IO to the home directory of the app while USB mounted may have issues when located on /media. I'm not aware of any apps that write to their own home directory, so this may not be a risk in general, but is still a possibility. If you run into issues with an app, see the Contingency Plan.


Confirmed Apps

Apps Confirmed Not to Work

com.palm.app.pdfviewer (script v0.2.0 and higher properly handles this, won't allow it to move)

Discuss

Discuss in the Discussion tab or PreCentral...

http://forums.precentral.net/web-os-development/205649-resolution-app-catalog-install-limit-proposal.html

Source

The source has been moved to gitorious...

http://gitorious.org/webos-internals/mvapp

Credits

xorg - initially developed script and proposal.  maintainer of this page.
daventx - added unlink and clean functions, other suggestions<br>
nt4cats - found Fair Dinkum breaks mvapp, gave solution to use explicit path.
SirWill, hparsons, bclancy, navinag, dhcalva, chodaboy - testing, usable suggestions and feedback
emoney22 - pointed out hidden directory in /media hides images from Photo app
greg_roll - provided info to capture running apps
rwhitby - setup webosinternals repository for homebrew distro

And thanks to the many testers who gave feedback on the PreCentral thread.