bityard Blog

// In-place Upgrade from RHEL 6 to RHEL 7 with separate /usr Filesystem

Officially there is no support for an in-place upgrade from RHEL 6 to RHEL 7 within a Hyper-V VM and with /usr residing on a separate filesystem. The latter issue is described in the Red Hat knowledge base article Why does Red Hat Enterprise Linux 7 in-place upgrade fails if /usr is on separate partition?. With several tweaks in the right places an in-place upgrade with /usr residing on a separate filesystem is still possible. This article describes the necessary steps.

Disclaimer: This guide comes with no fitness for purpose or guarantee whatsoever! I'm not liable for any damage resulting from following the described procedure. Before starting an upgrade ensure that you understand the steps to be performed and have arranged a service downtime as well as a proper fallback scenario and have a working backup in place!
  1. Create a backup and or a snapshot of the system to be upgraded.

  2. Follow the procedure outlined in How do I upgrade from Red Hat Enterprise Linux 6 to Red Hat Enterprise Linux 7?.

  3. The preupgrade assistant will fail with at least the following messages:

    root@rhel6:# preupg
    
    The Preupgrade Assistant is a diagnostics tool
    and does not perform the actual upgrade.
    Do you want to continue? [Y/n]
    y
    Gathering logs used by the Preupgrade Assistant:
    
    [...]
    
    |In-place upgrade requirements for the /usr/ directory                        |fail              |
    |Hyper-V                                                                      |fail              |
    --------------------------------------------------------------------------------------------------
    The tarball with results is stored in '/root/preupgrade-results/preupg_results-170731111749.tar.gz' .
    The latest assessment is stored in the '/root/preupgrade' directory.
    Summary information:
    We have found some critical issues. In-place upgrade or migration is not advised.
    Read the file /root/preupgrade/result.html for more details.
    Read the admin report file /root/preupgrade/result-admin.html for more details.
    Please ensure you have backed up your system and/or data
    before doing a system upgrade to prevent loss of data in
    case the upgrade fails and full re-install of the system
    from installation media is needed.
    Upload results to UI by the command:
    e.g. preupg -u http://example.com:8099/submit/ -r /root/preupgrade-results/preupg_results-170731111749.tar.gz .
    

    Make sure any other issues or conflicts are resolved and re-run the the preupgrade assistant iteratively until all but the two issues shown above are resolved.

  4. Force starting the upgrade process by ignoring the last two remaining issues shown above:

    root@rhel6:# redhat-upgrade-tool -f --network <VERSION> --instrepo <URL>
    
  5. After the upgrade is finished do not reboot immediately!

  6. Modify the GRUB configuration in /boot/grub/grub.conf first. This is necessary in order to activate the logical volume that contains the /usr filesystem at boot time:

    root@rhel6:# vi /boot/grub/grub.conf
    

    In the section title System Upgrade (redhat-upgrade-tool) add a rd.lvm.lv=VG/LV stanza to the kernel line. E.g. for the logical volume lv_usr within the volume group vg00:

    [...]
    title System Upgrade (redhat-upgrade-tool)
            root (hd0,0)
            kernel /vmlinuz-redhat-upgrade-tool [...] rd.lvm.lv=vg00/lv_usr [...]
            initrd /initramfs-redhat-upgrade-tool.img
    [...]
  7. Modify the system init script /etc/rc.d/rc.sysinit in order to prevent file system checks at boot time. Otherwise the startup of the upgrade system will fail, due to the fact that /usr is now already mounted from the boot stage.

    root@rhel6:# vi /etc/rc.d/rc.sysinit
    

    Comment the fsck command in line 422 of the init script /etc/rc.d/rc.sysinit, like shown in the following example:

    /etc/rc.d/rc.sysinit
    420         STRING=$"Checking filesystems"
    421         echo $STRING
    422         #fsck -T -t noopts=_netdev -A $fsckoptions
    423         rc=$?
    424

    The line numbers are only shown for purpose of illustration. Do not insert the line numbers at the beginning of the line!

  8. Reboot the system to start the actual upgrade process.

  9. After the upgrade to RHEL 7 has finished, the system might hang on the post-upgrade reboot due to the logical volume containing the /usr filesystem not being available. In order to circumvent this issue, stop the automatic boot of the upgraded system and perform a manual boot with modified GRUB parameters.

    • In the GRUB menu navigate to the entry Red Hat Enterprise Linux Server ([…]) and press E to enter the command line editing mode.

    • Navigate to the kernel /vmlinuz[…] entry and again press E.

    • Like above, add a rd.lvm.lv=VG/LV stanza for the logical volume containing the /usr filesystem to the kernel line. E.g. for the logical volume lv_usr within the volume group vg00 add the stanza rd.lvm.lv=vg00/lv_usr.

    • Press RETURN followed by B to start the boot of the RHEL 7 system.

  10. After the RHEL 7 system has sucessfully booted, don't forget to permanently add the changes to the GRUB command line from the previous step to the GRUB configuration /boot/grub/grub.conf:

    root@rhel7:# vi /boot/grub/grub.conf
    

    For every title section add a rd.lvm.lv=VG/LV stanza to the kernel line. E.g. for the logical volume lv_usr within the volume group vg00:

    [...]
    title Red Hat Enterprise Linux Server 7.3 Rescue 3b8941354040abfa3882f5ca00000039 (3.10.0-514.el7.x86_64)
            [...]
            kernel /vmlinuz-0-rescue-[...] rd.lvm.lv=vg00/lv_usr [...]
            [...]
    title Red Hat Enterprise Linux Server (3.10.0-514.el7.x86_64) 7.3 (Maipo)
            [...]
            kernel /vmlinuz-[...] rd.lvm.lv=vg00/lv_usr [...]
            [...]
    [...]
  11. Finish the procedure outlined in How do I upgrade from Red Hat Enterprise Linux 6 to Red Hat Enterprise Linux 7?.

All done, your system should now have successfully been upgraded from RHEL 6 to RHEL7.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information