Free up rootfs space

Image:Ambox_notice.png
Some instructions here may cause serious problems. When unsure, see General precautions
Backing up your data is recommended. In case of trouble you might need to re-flash your device.


Here's a simple howto for those suffering from lack of space in rootfs. The first suggestion is more of a temporary matter, for example to get enough space to install an update, but it's also the fastest and easiest. The suggestions are in order of potential threat to operating system. Least dangerous first and the most dangerous last. The rest are more permanent (and thus more useful), but they require root access.


Contents

Listing rootfs space on your device

Use this command to determine how much rootfs space is allocated, used, and available on your device.

df -h /

If you want to see all filesystems, use only "df -h".

Disable Extras-testing, Extras-devel, and/or any other third party repositories

Simply check the disabled box and save in the Application Manager's catalogues menu. Wait for app manger to update the lists. This only helps if you actually had these repositories enabled.

Disabling extras-testing and extras-devel will (currently) give you an extra 5 MB in rootfs


Clear apt cache

Run following command (has to be done as root)

apt-get clean


Remove unused dependencies

Run following command (has to be done as root)

apt-get autoremove


List of big and rarely used files

You can't just delete these files, this is just a list with ideas! You have to know what you are going to do with them (optify, backup+remove, etc.).

  • /usr/lib/locale/locale-archive (28 MB)
  • /usr/share/locale (10 MB, but you have to keep at least the languages you use)
  • /usr/share/themes/alpha and /beta (they use 5-6 MB each, keep the one you use)
  • /usr/share/fonts/arabic and /chinese (2,5 MB less for people who don't speak those two languages)

Move apt cache outside of rootfs

If you run into a problem while using apt-get you can temporarily (for one command only) have the apt cache outside rootfs to be able to download larger deb files.

Create a download folder on the eMMC to be used for the downloaded packages instead of the default apt archive folder.

mkdir -p /home/user/MyDocs/apt-archive-cache/archives/partial

Now execute apt-get with the -o option as root:

apt-get -o dir::cache=/home/user/MyDocs/apt-archive-cache <command>

for <command> you can enter the command you normally would use after apt-get.

Examples:

apt-get -o dir::cache=/home/user/MyDocs/apt-archive-cache dist-upgrade

apt-get -o dir::cache=/home/user/MyDocs/apt-archive-cache install <package>

Optify Python

If you have installed python or a python program before it was optified, you can optify it with this method. First open a console, then type the following commands as root:

apt-get install pymaemo-optify
apt-get clean

When the program is installed, type df -h in the xterm to see if it worked. The output should now contain lines similar to this one:

/opt/pymaemo/usr/lib/python2.5
                      2064208    471712   1487640  24% /usr/lib/python2.5


Remove non-optified packages

If you have installed programs from extras-devel, third party repositories or rarely, but possible, extras-testing, the programs might not be properly optified. Removing these might help with rootfs space.

You can free space by uninstalling applications that you do not need. A problem is if you do not know how these applications are called. To find it out:

  • Open a console
  • Start the application that you do not need
  • In the Terminal/console, type:
ps -ef

You get a listing of all running processes, including the application you just started. To find out what package an application belongs to, enter

dpkg --search $(which processname)


Source: http://talk.maemo.org/showpost.php?p=468063&postcount=1


Custom scripts

Script to free up space on rootfs

This script will move some unnecessary files on rootfs to /home/opt/ to free up space on rootfs.

BEWARE: Icon Label Issue May Occur. http://talk.maemo.org/showthread.php?p=654384#post654384

First, create a file, move-to-opt.sh for example, containing this script:

#!/bin/sh
# Nokia N900 Maemo 5 Script to free up space on rootfs
# ignoring errors when creating dirs that may already exist
 
# Moving ?? icons to /home/opt
mkdir -p /home/opt/usr/share/icons 2> /dev/null
cp -r /usr/share/icons/* /home/opt/usr/share/icons
rm -r /usr/share/icons
ln -s /home/opt/usr/share/icons /usr/share/icons

# Moving video on start-up to /home/opt
mkdir -p /home/opt/usr/share/hildon-welcome 2> /dev/null
cp -r /usr/share/hildon-welcome/* /home/opt/usr/share/hildon-welcome
rm -r /usr/share/hildon-welcome
ln -s /home/opt/usr/share/hildon-welcome /usr/share/hildon-welcome

# ??
mkdir -p /home/opt/usr/share/pixmaps 2> /dev/null
cp -r /usr/share/pixmaps/* /home/opt/usr/share/pixmaps
rm -r /usr/share/pixmaps
ln -s /home/opt/usr/share/pixmaps /usr/share/pixmaps

# Moving 'apt cache' to /home/opt - Valid until Bug 5746 is fixed.
mkdir -p /home/opt/var/cache/apt 2> /dev/null
cp -r /var/cache/apt/* /home/opt/var/cache/apt
rm -r /var/cache/apt
ln -s /home/opt/var/cache/apt /var/cache/apt

# Moving locales Source
mv /usr/share/locale /opt
ln -s /opt/locale /usr/share/locale

Set the script's permission for executable:

chmod +x move-to-opt.sh

(note that this step will - without warning you in any way - not work on partitions which are only fat formatted, as maybe your micro sd card will initially be; in such a case, move the script somewhere else)

Run the script as root:

./move-to-opt.sh

Script to safely free space on rootfs

This script shows you how much space will be freed and automatically detects whether some directories have already been moved.

BEWARE: Icon Label Issue May Occur. http://talk.maemo.org/showthread.php?p=654384#post654384

Move some of the pre-installed applications into /opt

Some applications like Nokia Maps and the microb-engine are placed in /usr/share taking up valuable root space, moving these files will not affect the apps. Moving Nokia Maps (has to be done as root) will save 8.7 Mb:

mv /usr/share/nokia-maps /home/opt/
ln -s /home/opt/nokia-maps /usr/share/nokia-maps

Moving the microb-engine (has to be done as root) will save 13.9 Mb:

mv /usr/share/microb-engine /home/opt
ln -s /home/opt/microb-engine /usr/share/microb-engine

Moving the "Getting started" app/tutorial (has to be done as root):

mv /usr/share/tutorial-applet /home/opt
ln -s /home/opt/tutorial-applet /usr/share/tutorial-applet

Move themes

Image:Ambox_notice.png
This may cause problems when changing themes, and reversing it is NOT possible unless the device is reflashed

Add the following into the script above OR add into another script (with #!/bin/sh at the start)

# Moving themes to /home/opt
mkdir -p /home/opt/usr/share/themes 2> /dev/null
cp -r /usr/share/themes/* /home/opt/usr/share/themes
rm -r /usr/share/themes
ln -s /home/opt/usr/share/themes /usr/share/themes

See rootfs usage per package

This script [1] outputs a list of all packages in rootfs and their size therein. I can not vouch for its validity but it seemed decent enough. "python pkgsize.py checkpkgs | sort -n" gives you a sorted result in bytes. Most of these files are supposed to be there but it might help you find some non optified ones.

from [2]