Tutorials Linux opt on loopback

= Background & Purpose =

The Palm Pre's 8GB HD is configured with three partitions:

1) /dev/mmcblk0p1 defined as a Linux/PA-RISC boot partition is only 4MB 2) /dev/mmcblk0p2 defined as a Linux partition and is 32MB mounted as /boot 3) /dev/mmcblk0p3 defined as a Linux LVM partition is 7.62GB

The /dev/mmcblk0p3 partition is a Linux Volume Group that is sliced into six Logical Volumes:

/dev/store/root mounted on / (root) 456 MB /dev/store/var mounted on /var 256MB /dev/store/update mounts on /var/lib/update 56MB (not mounted) /dev/store/log/ mounted on /var/log 40MB /dev/store/media mounted /media/internal 6.69GB /dev/store/swap Linux swap 128MB

It has been observed that if /var or / (root) usage is greater than or equal to 90% than the FAILED_NOT_ENOUGH_INSTALL_SPACE error is generated. "Builtin" applications reside on the root file system in /usr/palm/applications. Downloaded apps and those installed with palm-install reside on the /var file system in /var/usr/palm/applications. Also for so-called "rooted" Pre's the Optware Linux-based apps are stored in /var/opt.

One fix for a rooted Pre is to create a virtual Linux file system using a portion of the space allocated to /media/internal using a procedure similar to this one:

Linux Online - Using a file instead of a partition

Then mount the virtual file system on /opt vs binding /var/opt to /opt. Then relocating the files/directories under /var/opt to the new virtual file system.

NOTE: The /dev/store/update is mounted when you run the Update process. It would seem that the updates are stored here (at least some of them) prior to installation.

= Requirements =

You must have access to the Linux shell to perform this process. It is assumed that you followed the procedure to install Optware apps in /var/opt and linked /var/opt to /opt with the "mount -o bind /var/opt /opt" command and there is an equivalent entry in the /etc/fstab file.

=Procedure for Creating a Linux Virtual File System=

Do NOT do this if you want to connect your Pre to your computer in the USB Drive or Media Sync modes.

The following commands will move all of your Optware packages to an ext3 1GB loopback image that resides on /media/internal.

= Caveats =

Currently this procedure will disable USB Drive and Media Sync modes.

A method to safely unmount Virtual file system when selecting USB Drive and Media Sync modes is under development.

See the start/stop script below for now. The script needs to be run from a non-ssh terminal (ie novaproxy or novaterm). In the future this should be wrapped inside a homebrew GUI.

Caveat Workaround: Mount/Unmount Script
This script will start/stop (mount/unmount) the virtual file system, thus functioning as a work-a-round to allow using the Palm Pre's USB Drive and Media Sync modes. It is a work in progress and needs to be bullet-proofed. Ideally it should be wrapped around a WebOS GUI app—we are working on this. This script should be saved to a file (i.e. /home/root/vfs), made executable (i.e. chmod 750 /home/root/vfs and then run (i.e. with /home/root/vfs on or /home/root/vfs off). Do not save the script to an /opt path. Make sure you're running the script to toggle the virtual file system on or off when /media/internal is not mounted as a USB drive and the Media Sync mode is not enabled, otherwise the script will fail.

Note: We need this put in a Java service
''This means we need to translate it to Java the Pre can understand! This will be for front-end GUI to toggle the VFS. Please look into this if you have the knowledge, on Gitorious. The source is there.''

The Script Itself
= Credits =

PuffTheMagic - Devised the initial process 1lnxraider  - Expanded, modified, & published tutorial - Helped ultraBlack troubleshoot toggle script - Confirmed caveat ultraBlack  - Found & had confirmed the major caveat which disables Media Sync & USB modes - Devised plan for front-end 'Toggle VFS' GUI, envisioning it as a way to also easily create it rwhitby     - Provided skeleton & basic methods for front-end GUI's Opt Loop Service NetWhiz     - Gave additional warning that this process disables Media Sync and USB modes