1

I don't have control over the installation of debian, it's a pre-built debian 7 image provisioned by the VPS provider. It consumes about 6.5GB of disk space 'out of the box.'

Do you think it's possible to get this install down below 500MB of disk space? It's on an OpenVZ host. Very few services are needed (pretty much SSH only).

There is a discussion about removing components from debian, but it isn't clear what the net change in disk space will be: https://wiki.debian.org/ReduceDebian

The VPS provider also has CentOS and Ubuntu images. I haven't tried them; I'd assume their disk space utilization is similar.

It's a grandfathered, very cheap VPS plan. As such, attempting to reduce the OS's consumed disk space for my application might be worthwhile (instead of buying a more expensive tier with more storage).

Thank you for your insight.

0
1

500 MB is about the minimum you can get, at least without resorting to the localepurge package or worse hacks. For example, a rather bare but running wheezy system of mine consumes 585 MB. It was installed by plain debootstrap and added a couple of packages (a linux kernel, python, vim, locales, openssh-server, tcpdump, etc.) afterwards.

Emdebian could get you even lower, but it got discontinued.

0

I don't know about 500MB but at 6.5GB there's a lot of extra packages beyond the debian minimal base system that can be purged.

Start by making sure that whoever made that VM image didn't forget to clean out the apt cache (which stores any downloaded .deb packages): apt-get clean

Then list all packages with dpkg -l and apt-get purge packages you don't need. Don't bother with lib packages for now, you can get rid of unneeded ones later that were only auto-installed as deps of other packages with apt-get --purge autoremove)

I find it convenient to redirect output of dpkg -l | awk '/^.i/ && $2 !~ /^lib/' to a file, then edit that file in vim (or whatever) to delete lines containing packages I want to keep.

(at this point, the file contains the package names as well as the descriptions to make it easier to decide whether to keep or delete packages)

Again, don't leave any lib packages listed in this file, unless you are absolutely certain that you don't need them (autoremove is a better way of dealing with them that doesn't risk breaking some wanted package). The awk script above removes all lib* packages for you.

This results in a a file that lists all the packages I want to purge. The second field of dpkg -l's output is the package name, so once the file is edited you can extract the package names with: awk '{print $2}'

For example:

dpkg -l | awk '/^.i/ && $2 !~ /^lib/' > /tmp/packages.list 
vi packages.list
apt-get purge $(awk '{print $2}' packages.list)
apt-get --purge autoremove

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.