9

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?

  • Although the provided answer does directly answer your question, you may also want to consider changing the configuration of initramfs-tools to reduce the number of modules it contains and/or to compress it using xz instead of gzip. Compression using xz over gzip alone results in a significant reduction in the size of the generated initramfs images. Further details: https://askubuntu.com/a/344252/309457 – KingJ Oct 06 '18 at 10:12

1 Answers1

4
  • 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)

user.dz
  • 48,105
  • 1
    Good idea about the USB backup, although in this case I have a backup on the other disk in the array, which should be good enough for recovery. I'll give it a try, but I might try a simulation on another machine first... – Peter Ford Sep 21 '15 at 07:58