expand /boot partition help please

Latest response

Here is my lsblk

sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 349.5M 0 part
├─sda2 8:2 0 5G 0 part
├─sda3 8:3 0 200M 0 part /boot
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 1.8T 0 part
├─VolGroup00-LogVol01 253:0 0 11.7G 0 lvm [SWAP]
├─VolGroup00-LogVol00 253:1 0 101G 0 lvm /
├─VolGroup00-LogVol02 253:2 0 20G 0 lvm /usr
├─VolGroup00-LogVol05 253:3 0 102G 0 lvm /home
├─VolGroup00-LogVol04 253:4 0 16G 0 lvm /var
└─VolGroup00-LogVol03 253:5 0 512M 0 lvm /tmp
sdb 8:16 0 19.3G 0 disk
sr0 11:0 1 1024M 0 rom

I need to expand the size of my /boot partition due to a kernel upgrade.

I have resized the LVMs using command line but I'm not sure how to resize /dev/sda3 which is /boot

or remove unused files:
boot]# ll
total 158020
-rw-r--r--. 1 root root 122059 May 5 2014 config-3.10.0-123.el7.x86_64
-rw-r--r-- 1 root root 137701 Feb 19 23:48 config-3.10.0-514.10.2.el7.x86_64
-rw-r--r-- 1 root root 137701 Mar 10 10:30 config-3.10.0-514.16.1.el7.x86_64
drwx------. 6 root root 4096 Apr 12 16:54 grub2
-rw-r--r--. 1 root root 15723655 Apr 1 2015 initramfs-0-rescue-95830f31d3db445aaf0ade5cde6bd352.img
-rw------- 1 root root 24194692 Mar 15 09:12 initramfs-3.10.0-123.el7.x86_64.img
-rw------- 1 root root 25201972 Mar 15 09:13 initramfs-3.10.0-514.10.2.el7.x86_64.img
-rw------- 1 root root 18507746 Mar 15 15:06 initramfs-3.10.0-514.10.2.el7.x86_64kdump.img
-rw------- 1 root root 24374722 Apr 12 16:54 initramfs-3.10.0-514.16.1.el7.x86_64.img
-rw------- 1 root root 18504904 Apr 29 09:22 initramfs-3.10.0-514.16.1.el7.x86_64kdump.img
-rw-r--r--. 1 root root 4438970 Mar 15 09:12 initrd-plymouth.img
-rw-r--r--. 1 root root 228562 May 5 2014 symvers-3.10.0-123.el7.x86_64.gz
-rw-r--r-- 1 root root 277969 Feb 19 23:51 symvers-3.10.0-514.10.2.el7.x86_64.gz
-rw-r--r-- 1 root root 277943 Mar 10 10:35 symvers-3.10.0-514.16.1.el7.x86_64.gz
-rw-------. 1 root root 2840084 May 5 2014 System.map-3.10.0-123.el7.x86_64
-rw------- 1 root root 3112473 Feb 19 23:48 System.map-3.10.0-514.10.2.el7.x86_64
-rw------- 1 root root 3113648 Mar 10 10:30 System.map-3.10.0-514.16.1.el7.x86_64
-rwxr-xr-x. 1 root root 4902000 Apr 1 2015 vmlinuz-0-rescue-95830f31d3db445aaf0ade5cde6bd352
-rwxr-xr-x. 1 root root 4902000 May 5 2014 vmlinuz-3.10.0-123.el7.x86_64
-rwxr-xr-x 1 root root 5391456 Feb 19 23:48 vmlinuz-3.10.0-514.10.2.el7.x86_64
-rwxr-xr-x 1 root root 5394272 Mar 10 10:30 vmlinuz-3.10.0-514.16.1.el7.x86_64



It's technically possible, but there is NO supported method to do this, and the unsupported method is very risky and can create instability in the disk. This is because in order to resize the boot partition, you need to move the other partitions further away from the boot partition on the disk, so that the boot partition has room to expand. You can do this with something like gparted, but I do not recommend it and, again, it is NOT SUPPORTED.

What I'd recommend instead would be taking a backup of your system and configuring a larger boot partition as you do a fresh install. Much, much safer. Just make sure you test that your backup works before you wipe anything. :)

I removed the old kernels. package-cleanup --oldkernels --count=1 and I was able to perform an update.

"What I'd recommend instead would be taking a backup of your system and configuring a larger boot partition as you do a fresh install."

Personally I would prefer a standard old school xfs install /boot swap / /home the use my second drive for a back.

If I install a fresh system will I be able to use my existing registration?

Thanks for the post.

That looks okay, still your /boot file system size is very small. Red Hat recommends at least 1GB of space for /boot. https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-disk-partitioning-setup-x86.html

Yes, you may need to delete old profile and re-register it, check out this KB https://access.redhat.com/solutions/8036

Thank you! That's what I am going to do. Reinstall Redhat es7 with the the following: /dev/sda /boot 2gb xfs or ext4 swap 40gb ( I have 24gb installed) / 400gib xfs /home 500gb xfs /dev/sdb /data xfs

I plan on mirroring debiab 8

Yes, re-sizing partitions is highly risky and sophisticated. Again, could be resized from the partition end not from the beginning provided there is empty space in the specified partition layout.

Check out this KB https://access.redhat.com/solutions/356753

But I notice that there is /dev/sda2 with size of 5GB which I guess un-used, why don't you make this as boot device if this not targed to be used for anything else.

I had tested this by moving boot partition from /dev/sda1 to /dev/sda2 which worked fine on my virtual machine running with RHEL 6.5, but ran into some error initially "file not found" which I was able to replicate later properly without much hiccups. If you wish to get this done then you may refer the below steps (risky and Red Hat would not recommend this...)

- Make a backup of boot and it's partition layouts. 

- Create a new file system on /dev/sda2.

    #mkfs.ext4 /dev/sda2

- Copy all files from /dev/sda3 to /dev/sda2 

    #mount /dev/sda2 /test
    #cp -arv /boot/. /test/

- Edit /etc/fstab and add new entry of /dev/sda2 and comment out old boot entry.

- Install the required boot files (stage2..) on /dev/sda2

 #grub --device-map=/test/grub/device.map

  Now, inside grub prompt run the below commands:

  grub> root (hd0,1)                      

  grub> setup (hd0)             ------> this would setup bootloader on the required partition

- Once this is successful quit from grub prompt.

- Edit grub.conf file on the /dev/sda2 partition so that it points to correct splash image and root directory as shown below:


  root (hd0,1)

- After this toggle the boot flag so that /dev/sda2 would be marked as bootable and mask boot flag on /dev/sda3 using fdisk command.

- Reboot the system and check if system boots up fine & /boot is on /dev/sda2 partition, if so then you are all set & done. Now, you can install new kernel packages as required. 

On my test systems, I had formatted /dev/sda1 by creating new file system layout (mkfs.ex4 /dev/sda1). Rebooted the system again and tested that it boots fine from /dev/sda2 and rest of file systems being LVMs.

All the best...

Incidentally, you can GROW an XFS file system (LVM), but you can --not-- shrink an XFS file system. so if you had to rob from one partition to go to the other, you'd find you can't shrink XFS through it's failures to shrink. Recommend what Laura Bailey said above.

It's overkill, but just today I found myself making /boot 2GB instead of my usual 1GB. Overkill? yes.

help full comments.