Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in the process of building a minimal linux boot image based on Ubuntu.

I started by using debootstrap and then installing the things I absolutely needed.

What general approach can I take to reduce this 3GB+ linux installation down to something much much smaller suitable for pxe booting?

What things does debootstrap install that I can look at removing?

For example, there seems to be a lot of stuff in /usr/share What can I safely remove?

share|improve this question
You can remove anything you don't need. You need to tell us what you don't need before we can tell you what you can remove. – womble Mar 29 '12 at 19:32
up vote 3 down vote accepted

See this document for ReducingDiskFootprint.

It includes instructions about how to disable apt caches, have any package installations skip installing the documentation or locales that don't apply to your system. It suggests how you can modify log rotation setups to minimize log storage.

My dpkg config file for small storage system looks like this. /etc/dpkg/dpkg.cfg.d/01_smalldisk.

# block documentation
path-exclude /usr/share/doc/*
# keep copyright files for legal reasons
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
# lintian stuff is small, but really unnecessary
path-exclude /usr/share/lintian/*
path-exclude /usr/share/linda/*
# block non-us locales
path-exclude /usr/share/locale/*
path-include /usr/share/locale/en*

Obviously you need to be very careful about the package you select. Avoid those huge meta-packages that include tons of crap. You may need to consider using equivs to make empty packages in some cases where a dependency is set, but you don't need the functionality the dependency makes possible.

share|improve this answer
Thanks, that is exactly what I was after. – Matt Mar 29 '12 at 20:14

For general slimness, Ubuntu is a little bit fat. If you can, grab Debian and install with no packages selected, then add what you need.

You should be able to PXE boot pretty quickly just from the kernel + initrd image. Let the initrd mount your remote filesystem and go from there. You'll only pass network traffic for files that are actually read in use, so even if you have a 100 gig install, if the boot only touches 10 MB of files, you'll only move 10 MB of traffic.

share|improve this answer
I agree, ubuntu is fat. I just removed nearly 1GB by removing /usr/share/doc. Thanks for the top on debian. Might use that as a better starting point – Matt Mar 29 '12 at 19:23
@Matt Also get familiar with the strip utility for your binary files. Make backups before you go wild with it. – Jeff Ferland Mar 29 '12 at 20:19

Well, ideally you shouldn't be removing anything manually. Start out by using Ubuntu Server install and installing no packages; that will be pretty slim.

For PXE boot though, you're better off compiling your own kernel and using busybox for most commands.

If you are dead-set on Ubuntu, then ask for further info on Ask Ubuntu.

share|improve this answer
Even ubuntu server is fat with only ssh installed. – Matt Mar 29 '12 at 19:36
You can go smaller by deleting stuff, it's true, but at that point I'm not sure you're really deriving any benefit from using Ubuntu per se. There are other distributions better suited to PXE boot -- used to be ones you could fit on a floppy, even -- or you can roll your own. – Andrew G. Mar 30 '12 at 5:45

You can do an Ubuntu JeOS VMbuilder installation from Ubuntu Server CD boot menu. The installation requires about 300-400 MB of disk.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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