How to clean up full /boot safely?

Colin Watson cjwatson at ubuntu.com
Mon Feb 12 11:14:55 UTC 2018


On Mon, Feb 12, 2018 at 10:29:35AM +0000, Colin Law wrote:
> I believe that later versions of grub will cope with LVM, though I
> have not tried it.

Indeed, it works fine.

> The only system that I have a separate boot (and it could do with
> being larger) is one that I installed on some time ago using LVM to
> give me a large virtual disk. The installer set up a /boot for me and
> I am nervous about trying to shrink the LVM partition (if that is the
> right word, probably not) in order to grow /boot. I don't want to risk
> losing the LVM data as it would be a pain to recover.

You should of course have backups first, but I don't think this is
particularly risky as LVM operations go.

If you have enough space in your root filesystem, and a suitable live
USB recovery image to hand, then you can remount /boot in a temporary
location, rsync all its data to /boot on your root filesystem, unmount
/boot and comment it out in /etc/fstab, run grub-install and update-grub
to point GRUB at the new /boot, and reboot.  If all goes well then you
can replace the old /boot partition with a new LVM physical volume
(using pvcreate) and add that to your volume group (using vgextend),
thus making more unallocated space that you can use freely for logical
volumes; if it doesn't go well then you can repair or revert using your
recovery image.

If you wanted to create a separate logical volume and filesystem for
/boot and you didn't have enough unallocated space in your volume group
for that, then it would be a slightly more complicated operation, though
still possible.  However, I don't recommend this.  Having a separate
/boot filesystem is only worth it if your boot loader can't read your
root filesystem for whatever reason; if it can (and why would you be
moving it into LVM otherwise?), then it's just more administrative
overhead.

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list