Onno Onno - 6 months ago 31
Linux Question

Why is the default Ubuntu boot partition so small? How can I increase it?

Recently I created a Ubuntu server. During install I accepted the default options. Installer creates a 236M

/boot
partition as shown below. After only a few months the partition is full. Is this partition not awfully small? How can I increase it?

$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 16G 4.0K 16G 1% /dev
tmpfs 3.2G 524K 3.2G 1% /run
/dev/mapper/ci--vg-root 95G 80G 11G 89% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 16G 0 16G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda1 236M 225M 0 100% /boot

Answer

You boot partition is probably running out of space as a result kernel updates leaving the old kernels. Just remove the old unused kernels using the following command:

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs sudo apt-get -y purge  

Take a look at this question on Ask Ubuntu for more information

If this command fails because of "unmet dependencies" you first have to correct these using apt-get -f install. But that will also fail because of disk space. What you can try is to physically move some of the initrd.img* files out of the /boot directory to free some space for example

sudo mv /boot/initrd.img-3.19.0-25-generic /tmp
sudo mv /boot/initrd...

You can find out current kernel versions using

uname -r