1

During several months before every update system action I need to clean up /boot directory because it is full. I had removed old kernels as described here (How to free up space on RHEL6 /boot safely?).

But every time after update - /boot is full again.
Today even after removing previous kernel is NOT enough space for yum update.

root@CentOS-70-64-minimal:/boot ============================================ [18:05:08]
> l
total 429M
dr-xr-xr-x.  5 root root 5.0K Jan 12 18:04 ./
drwxr-xr-x. 19 root root 4.0K Jan 12 03:16 ../
-rw-r--r--.  1 root root 121K Nov  3 20:18 config-3.10.0-229.20.1.el7.x86_64
drwxr-xr-x.  2 root root 1.0K Nov  1 23:50 grub/
drwxr-xr-x.  6 root root 1.0K Jan 12 18:04 grub2/
-rw-------.  1 root root  39M Nov  1 23:52 initramfs-0-rescue-36bcd6a9e7104f21b1fffdc70a2410ad.img
-rw-------.  1 root root  39M Jun 25  2015 initramfs-0-rescue-3f69b67d93ab47efad188530c7620ce7.img
-rw-------.  1 root root  36M Dec  6  2014 initramfs-0-rescue-5ada9d2ff7154b7d992458e573f12812.img
-rw-------.  1 root root  38M Mar 31  2015 initramfs-0-rescue-6cb1c41831054f7d8c5f96f86852974a.img
-rw-------.  1 root root  39M Aug  8 10:18 initramfs-0-rescue-6d4eff407451426bb985a283f8a50b73.img
-rw-r--r--.  1 root root  25M Jul 10  2014 initramfs-0-rescue-74f877a555c841639922c44507d67b89.img
-rw-------.  1 root root  39M May 13  2015 initramfs-0-rescue-9dcee4fd9cc94410990561ec753679d4.img
-rw-------.  1 root root  18M Nov 14 19:42 initramfs-0-rescue-c3547f9231df4524867357ebcfa979e8.img
-rw-------.  1 root root  36M Dec 16  2014 initramfs-0-rescue-cddab3440a1f487dad750c2d85b023a9.img
-rw-------.  1 root root  36M Feb  2  2015 initramfs-0-rescue-dcfb8dbba18442ce83382fe302f8e256.img
-rw-------.  1 root root  38M Nov 14 19:41 initramfs-3.10.0-229.20.1.el7.x86_64.img
-rw-------.  1 root root    0 Nov 15 03:16 initramfs-3.10.0-229.20.1.el7.x86_64kdump.img
-rw-r--r--.  1 root root 576K Mar 31  2015 initrd-plymouth.img
drwx------.  2 root root  12K Dec  6  2014 lost+found/
-rw-r--r--.  1 root root 235K Nov  3 20:21 symvers-3.10.0-229.20.1.el7.x86_64.gz
-rw-------.  1 root root 2.8M Nov  3 20:18 System.map-3.10.0-229.20.1.el7.x86_64
-rwxr-xr-x.  1 root root 4.8M Nov  1 23:52 vmlinuz-0-rescue-36bcd6a9e7104f21b1fffdc70a2410ad*
-rwxr-xr-x.  1 root root 4.8M Jun 25  2015 vmlinuz-0-rescue-3f69b67d93ab47efad188530c7620ce7*
-rwxr-xr-x.  1 root root 4.7M Dec  6  2014 vmlinuz-0-rescue-5ada9d2ff7154b7d992458e573f12812*
-rwxr-xr-x.  1 root root 4.8M Mar 31  2015 vmlinuz-0-rescue-6cb1c41831054f7d8c5f96f86852974a*
-rwxr-xr-x.  1 root root 4.8M Aug  8 10:18 vmlinuz-0-rescue-6d4eff407451426bb985a283f8a50b73*
-rwxr-xr-x.  1 root root 4.7M Jul 10  2014 vmlinuz-0-rescue-74f877a555c841639922c44507d67b89*
-rwxr-xr-x.  1 root root 4.8M May 13  2015 vmlinuz-0-rescue-9dcee4fd9cc94410990561ec753679d4*
-rwxr-xr-x.  1 root root    0 Nov 14 19:42 vmlinuz-0-rescue-c3547f9231df4524867357ebcfa979e8*
-rwxr-xr-x.  1 root root 4.7M Dec 16  2014 vmlinuz-0-rescue-cddab3440a1f487dad750c2d85b023a9*
-rwxr-xr-x.  1 root root 4.7M Feb  2  2015 vmlinuz-0-rescue-dcfb8dbba18442ce83382fe302f8e256*
-rwxr-xr-x.  1 root root 4.8M Nov  3 20:18 vmlinuz-3.10.0-229.20.1.el7.x86_64*
-rw-r--r--.  1 root root  171 Nov  3 20:18 .vmlinuz-3.10.0-229.20.1.el7.x86_64.hmac

root@CentOS-70-64-minimal:/boot ============================================ [18:05:11]
> df
Filesystem      Size  Used Avail Use% Mounted on
/dev/md2       1008G   96G  862G  10% /
devtmpfs        7.6G     0  7.6G   0% /dev
tmpfs           7.7G     0  7.7G   0% /dev/shm
tmpfs           7.7G   17M  7.6G   1% /run
tmpfs           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/md1        488M  439M   25M  95% /boot
/dev/md3        1.7T  1.7T     0 100% /home
Sergey Serov
  • 397
  • 3
  • 7
  • 14
  • That's a lot of rescue kernels. Where did they all come from?! There should only be one... – Michael Hampton Jan 12 '16 at 17:29
  • Yes, here a lot of `initramfs-0-rescue-*` and `vmlinuz-0-rescue-*` files. I don't know where they are from.... and certainly afraid just remove files with old timestamp... – Sergey Serov Jan 12 '16 at 17:33

2 Answers2

1

If your machine boots correctly now, I'd move the rescue kernels out of /boot into your home directory (or any other place really) and reboot, make sure it works and then remove them and then rerun yum update. You shouldn't need that many rescue kernels or any if your machine boots correctly

Edit:

Now, the fun part is if it doesn't boot correctly after moving the rescue kernels. Boot it into a live environment and then move each rescue kernel back into place one by one until you find the one that is being used.

Logan
  • 136
  • 3
  • But what I will do if machine will not boot correctly after moving rescue files? :) – Sergey Serov Jan 12 '16 at 17:38
  • @SergeySerov You shouldn't be booting from a rescue kernel, unless your machine doesn't boot correctly! – Michael Hampton Jan 12 '16 at 17:41
  • Updated the answer, basically you put them back one by one. If you run uname -a it'll show which kernel you're currently using – Logan Jan 12 '16 at 17:42
  • @Logan Seems this is rather danger action. What do You mean 'Boot it into a live environment'? – Sergey Serov Jan 12 '16 at 17:59
  • @MichaelHampton 'unless your machine doesn't boot correctly' - is it possible to check it safely? – Sergey Serov Jan 12 '16 at 17:59
  • You'd take a live cd and boot into it. Then you'd mount the drive that contains your /boot and your / and move the rescue kernels back into place. Once you've done it, reboot, if it doesn't boot then you'll want to move that one back out of /boot and move a different one back in. With that said, you almost certainly aren't booted into a rescue kernel now and will probably have no issues at all. When in doubt or learning, test it in a disposable VM. There is no way I know of to test a kernel without a reboot or a VM – Logan Jan 12 '16 at 18:04
  • @Logan Thank You very much for advice. How do You think - is it possible to track which files system is really using during boot? How to find when was last handle to file? – Sergey Serov Jan 12 '16 at 18:15
  • /etc/fstab lists the filesystems that are mounted on boot. It will always be at least root (/) and sometimes /boot if it's a seperate filesystem. – Logan Jan 12 '16 at 18:19
  • Thank You very much! I had move old rescue files from /boot directory, run `yum update` and after it restart server - everything is well! – Sergey Serov Jan 13 '16 at 17:06
  • I'm glad to hear it – Logan Jan 13 '16 at 21:31
-1

disable the rescue kernel creation by this solution:

short summary:

$vim /usr/lib/dracut/dracut.conf.d/02-rescue.conf

change "yes" to "no"

dracut_rescue_image="no"

http://tech.donghao.org/2015/12/17/how-to-disable-the-creation-of-the-rescue-initramfs-on-centos-7/

clean boot partition and update grub:

short summary:

delete the rescue files in /boot and then run

grub2-mkconfig -o /boot/grub2/grub.cfg

https://unix.stackexchange.com/questions/238081/removing-the-rescue-image-from-boot-on-fedora

  • 1
    We try to avoid link-only answers because of the danger of linkrot. Would you be willing to summarize the contents of those links? – Katherine Villyard Feb 10 '16 at 21:15
  • Good Day! Thank You for answer! I just afraid to do something with grub - server in data center far from me, and if it will be unusable I will have problems. – Sergey Serov Feb 11 '16 at 22:30