Tutorials Linux opt on loopback

From WebOS Internals
Revision as of 13:57, 3 August 2009 by 1lnxraider (talk | contribs)
Jump to navigation Jump to search

Introduction

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 filesystem in /usr/palm/applications. Downloaded apps and those installed with palm-install reside on the /var filesystem in /var/usr/palm/applications. Also for rooted Pre's the opt-ware linux-based apps are stored in /var/opt.

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

[url=http://www.linux.org/docs/ldp/howto/Cryptoloop-HOWTO/filebased.html]Linux Online - Using a file instead of a partition[/url]

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

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 be root to perform this process. It is assumed that you followed the procedure to install opt-ware 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

Do NOT do this if you want to connect your Pre to your computer in USB Drive or MediaSync mode.

The following commands will move all your optware to an ext3 1GB loopback image that resides on /media/internal. <source lang="bash"> dd if=/dev/zero of=/media/internal/optware.img bs=1024 count=1000k mkfs.ext3 -F /media/internal/optware.img mkdir /tmp/opt mount -o loop /media/internal/optware.img /tmp/opt rm -rf /tmp/opt/lost\+found mv /opt/* /tmp/opt/ umount /opt umount /var/opt mount -o loop /media/internal/optware.img /opt/ echo '/media/internal/optware.img /opt ext3 defaults,loop 0 0' >>/etc/fstab </source>

Caveats

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

To Do's

Create a method to safely unmount Virtual FileSystem when selecting USB Drive and Media Sync modes.

Credits

PuffTheMagic - Initial process

NetWhiz - USB Drive/Media Sync Warning

1lnxraider - Expanded and modified tutorial