[CentOS] /boot partition too small

Wed Oct 11 18:13:04 UTC 2017
Lamar Owen <lowen at pari.edu>

On 10/10/2017 09:20 PM, Robert Nichols wrote:
> For you, there really is no way around the messy and delicate process 
> of shrinking and relocating a filesystem and the LVM volumes to make 
> space for a larger /boot partition. Frankly, I would hesitate to do 
> that in place on my own system, and I have quite a bit of experience 
> with doing unspeakable things with LVM volumes. You really need to do 
> that resizing in the context of moving everything to another disk.

Agreed.  If / and /home are on xfs you can't shrink anyway.  I'm not 
sure if ext4 can be shrunk while mounted (I seem to remember that it can't).

> If it's a server that you don't want to take down for the time it 
> takes for that procedure, you can do amazing things with pvmove while 
> your system continues to run, but you still need another disk to hold 
> those volumes temporarily.
As long as there is enough slack space in the volume group you can do 
this.  If there is no slack space you have real problems, especially 
with XFS (one reason I still use ext4 for many things, and one reason I 
never fill the volume group to 100%).

I have done the pvmove and filesystem resize dance before, live, with 
the second hard disk attached via iSCSI.  The least fun piece is then 
resizing the /boot partition and its filesystem.  But I had enough slack 
space in the volume group.  What can be done here is unmounting /home, 
shrinking /home the appropriate amount, and then you have enough slack 
space to do the shrink and move (not fully live, but semi-live, and you 
can't have any logged-in users with open files in /home).  Shrinking 
from the end of the filesystem and pv is easy; shrinking from the 
beginning is hard and prone to errors.  (gparted and similar do the move 
of the end of a partition fine; moving the start is much much harder).

However, if you can shrink enough from the end you can put /boot on the 
last partition on the disk instead of the first, although you will have 
to do some grub stanza editing to get rid of /dev/sda1 and replace with 
the appropriate device for the new /boot.  So you could shrink /home, 
shrink the pv, shrink the partition holding the pv (this is the risky 
part), then add a partition to the end of the disk for the new /boot.  
If you've never done this sort of thing before you may want to get 
someone who has done this sort of thing to do it.

Otherwise, if you feel at all uncomfortable doing this it may just be 
easier to pull a backup and reinstall.