How do I resize my /boot partition?
There are 2 parts to this:
Open a terminal and run ls /boot If boot is full of old kernels you can go remove happy on them, I recommend keeping the original, the latest and the one before latest. the lowest number is normally the shipping kernel, the highest number will be the latest.
To grow boot you first need to shrink another partition so you have free space. I would suggest using the gparted tool on the live cd to do this. First decrease the size of/ or /home depending on your setup. Then increase the size of boot.
I assume this Linux machine is a VM.
Expand the SCSI device by 1GB on VM sphere centre or AWS, etc, so /dev/sda
gets an additional 1GB of space.
Reboot the server to single user mode. Use fdisk -l /dev/sda
to confirm the new size with additional 1GB.
Use fdisk /dev/sda
to create an sda3 partition with 1GB. Save the partition table. Ubuntu will require partprobe to update the partition table. Now run:
mkfs.ext4 /dev/sda3
umount /boot
dd if=/dev/sda1 of=/dev/sda3
e2fsck -y /dev/sda3
resize2fs /dev/sda3
e2fsck -y /dev/sda3
Now update /etc/fstab
(be sure to make a backup copy, just in case need to boot from CDROM/DVD to recover), update the line to mount /dev/sda3
on /boot
(and comment the line for /dev/sda1
)
Mount /boot
df -k
should see /boot
is 1GB now, but you need to make it the default boot device.
Use fdisk /dev/sda
, and press p
to print the partition table. You will see /dev/sda1
is the default boot device.
Use the a
command in fdisk
to disable /dev/sda1
as default boot device and again to enable /dev/sda3
as default boot device. p
to show partition table.
Device Boot Start End Blocks Id System
/dev/sda1 2048 411647 204800 83 Linux
/dev/sda2 411648 20971519 10279936 5 Extended
/dev/sda3 * 20971520 23068671 1048576 83 Linux
/dev/sda5 413696 20971519 10278912 8e Linux LVM
Reboot
After you've been online for sometime, if you feel you want to utilize the 200MB of /dev/sda1
, just recreate /dev/sda1
and put into any VG you want.