PDA

View Full Version : Find out which packages use space in rootfs?


phedders
2010-02-25, 22:36
Want to see which packages are using the most space in your root filesystem?


for q in $(dpkg -l|grep ^.i|awk '{print $2}'); do x=0; for w in $(dpkg -L "$q"); do [ -f "$w" ] && df "$w"|grep -q " /$" && x=$(($x + $(du -x "$w" | awk '{print $1}') )); done; echo $x $q; done | tee packages
sort -n packages


I'm sure there are better ways but this way does not use any intermediary files...

Of course it would then be interesting to extract out the packges that are part of the firmware install...

I did a "DOH" when I saw:

90336 git-core

for example...

OranAgra
2010-02-25, 22:43
thanks.
i'm interested to know whitch applications / packedges came from extras-devel / extras-testing. since i don't remember what i took from where.
is that even possible?

b666m
2010-02-25, 22:44
post it here:
http://talk.maemo.org/showthread.php?t=39177&page=14

:)

phedders
2010-02-25, 22:45
Of course my obvious mistake is to be counting hardlinked files multiple times. ERM... That needs a tweak!

phedders
2010-02-25, 22:46
thanks.
i'm interested to know whitch applications / packedges came from extras-devel / extras-testing. since i don't remember what i took from where.
is that even possible?


Sure!

Nokia-N900-02-8:/home/opt/root# apt-cache policy git-core
git-core:
Installed: 1:1.6.6-1maemo1
Candidate: 1:1.6.6-1maemo1
Version table:
*** 1:1.6.6-1maemo1 0
500 http://repository.maemo.org fremantle/free Packages
100 /var/lib/dpkg/status
1:1.6.6-1maemo0 0
500 http://repository.maemo.org fremantle/free Packages

phedders
2010-02-25, 23:21
Ok - version two... now eliminates hard links - well counts just one:

#!/bin/sh

for q in $(dpkg -l|grep ^.i|awk '{print $2}'); do
x=0
for e in $( for w in $(dpkg -L "$q"); do [ -f "$w" ] && df "$w"|grep -q " /$" && stat -t "$w"; done | awk '{print $2, $8}'|sort -u|awk '{print $1}'); do
x=$(($x + $e ))
done
echo $x $q
done

11602348 git-core

11mb is still a lot! Needs to get optified....

phedders
2010-02-25, 23:50
I just happened to have a dpkg -l from a fresh install (ie just firmware packages) and so to find the packages I've installed hogging root:

cat /opt/root/packages2 |while read a b; do grep -q $b /home/user/fresh.2010/dpkg-l || echo $a $b; done|sort -n

So heres my "hall of shame"!

407364 xournal
426263 libliqbase1
432631 libgcrypt11
502843 telepathy-salut
528114 libgnomecanvas2-common
536468 foreca-weather-applet
601220 libtheora0
684425 iproute
709576 gstreamer0.10-plugins-bad-extra
769560 libclutter-1.0-0
774209 bash
788259 libgnutls26
795956 gstreamer0.10-plugins-good-extra
822329 maemo-mapper
987553 libvorbisenc2
989273 openssh-client
1028890 python2.5-minimal
1200273 python2.5
1373208 wget
1388455 x11vnc
1487167 libpoppler2
1817061 midori
3386753 libgucharmap7
11602348 git-core

Rob1n
2010-02-26, 08:55
Sure!

Nokia-N900-02-8:/home/opt/root# apt-cache policy git-core
git-core:
Installed: 1:1.6.6-1maemo1
Candidate: 1:1.6.6-1maemo1
Version table:
*** 1:1.6.6-1maemo1 0
500 http://repository.maemo.org fremantle/free Packages
100 /var/lib/dpkg/status
1:1.6.6-1maemo0 0
500 http://repository.maemo.org fremantle/free Packages

And how does that tell you whether it's from extras, extras-devel or extras-testing?