upgrades-migrations / redhat-upgrade-tool

Upgrades Red Hat Enterprise Linux from one major version to a newer one. Disclaimer: It was fun. R.I.P. :-)
GNU General Public License v2.0
15 stars 17 forks source link

Check for sufficient space in /boot #19

Closed bocekm closed 7 years ago

bocekm commented 7 years ago

Installation of kernel and grub during the upgrade requires certain amount of space in /boot. If that space is not available during the upgrade stage after the reboot, the upgrade fails. This update adds a check of the available space left after the initramfs and kernel are downloaded. 50 MB should be enough even with reserve.

Related:

bocekm commented 7 years ago

@pirat89 The message you reported is not the one I was updating. The "insufficient disk space: /boot needs 16M more free space" is actually a message from yum when "testing upgrade transaction". I can't influence this message.

To test my message, leave just enough space to let the tool download the images without problem. Then if the available space is less than 50MB, my message pops up.

Refrain from using --cleanup-post option to be able to see what has been downloaded and what not.

bocekm commented 7 years ago
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
...
tmpfs                 939M     0  939M   0% /dev/shm
/dev/vda1             477M  367M   85M  82% /boot
[root@localhost ~]# redhat-upgrade-tool-cli --cleanup-post --addrepo --instrepo=http://example.com/RHEL-7/7.3/Server/x86_64/os --network 7.3
...
Not enough space. /boot/ needs additional 18 MiB.
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
...
/dev/vda1             477M  420M   32M  94% /boot

In the second df listing, you can see the effect of downloading initramfs-redhat-upgrade-tool.img (~50M) and vmlinuz-redhat-upgrade-tool kernel (~5M). The minimum of 50 MiB we require is for the RHEL 7 kernel package. Installation of this package in the initramdisk phase copies ~42MB worth of data to /boot.