Remove unneeded packages, folders, and files
# dselect can help you see dependencies of packages and then delete them.
It is hard to know sometimes what is needed and what is not. After you dselect the packages you don’t think are needed, try rebooting and see if everything still works.
The next step is to delete the following:
/var/lib/ remove kernel folder your not using
/var/lib/apt
/var/lib/asterisk remove any mp3’s your not using
/var/lib/dpkg
/usr/share/doc
/usr/share/locale
/usr/share/man
/usr/share/zoneinfo
/boot/ remove any kernel files not used
/usr/src/*
/lib/modules/2.6.8-2-XXX/ remove modules for hardware that is not used.
From here your sort of on your own. If your not sure what can be deleted and what must stay you will have to use the internet to find out what the individual files do.
# df –h gives you the total size of the partition.
# du –sh /* gives the size of individual folders and helps find the big ones.
Delete a bit at a time and reboot to test if everything still works. If you break something and you know what file did it you can just copy it over from partition #2.
# mkdir /mnt/hda2
# mount /dev/hda2 /mnt/hda2
Now you have access to partition #2 in /mnt/hda2 and you can copy the missing files over.