Is it OK to delete the /boot/initrd.img file on a running system

I have a server with a RAID1 root partition, but it has a small partition for /boot on each of the two drives: I 'dd' one to the other whenever an update is made.

Unfortunately the /boot partition is too small - when the kernel is updated initramfs doesn't have space to write a new initrd.img into the partition. Fixing the partition size would mean depriving the company of its critical services for a while, which I'd like to avoid.

As I understand grub booting, the initrd.img is only used until the real partitions are mounted. Is it OK to just delete the existing initrd.img and free the space to build the new one, while the system is running?


Solution 1:

  • It is ok to remove it and the kernel too while a running system.
  • But you should plan for the worst, what are you going to do if system crash or shutdown at the time of replacing, or it could be a bad kernel update.

    It's recommended to keep always an old kernel that works.

    So keep a ready USB boot disk with backup of that kernel & ramdisk. (5~10min to recover)