Changes

Jump to: navigation, search

028 to 042 kernel upgrade

3,935 bytes added, 21:44, 29 October 2013
created (stolen from https://openvz.org/User_talk:Denis_Hohryakov)
This article describes a way to upgrade your old OpenVZ system with RHEL5-based
(028stabNNN kernel) to RHEL6-based (042stabNNN) kernel, and convert /vz
from ext3 to ext4.

Assumptions:
* systems is CentOS (RHEL) 5.x
* vzkernel is 028stabXXX, i.e. RHEL5-based
* /vz uses ext3

End result should be:
* Same CentOS 5 system
* vzkernel is 042stabXXX
* /vz uses ext4

== Update your system ==

yum update

== Add rhel6 kernel repos ==

Disable rhel5 and enable rhel6 OpenVZ kernel repository.
In other words, change <code>/etc/yum.repos.d/openvz.repo</code>
to look like this (changes required are '''in bold'''):

[openvz-kernel-rhel6]
name=OpenVZ RHEL6-based stable kernels
<nowiki>#baseurl=http://download.openvz.org/kernel/branches/rhel6-2.6.32/current/</nowiki>
<nowiki>mirrorlist=http://download.openvz.org/kernel/mirrors-rhel6-2.6.32</nowiki>
'''enabled=1'''
gpgcheck=1
<nowiki>gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ</nowiki>
'''#exclude=vzkernel-firmware'''

[openvz-kernel-rhel5]
name=OpenVZ RHEL5-based kernel
<nowiki>#baseurl=http://download.openvz.org/kernel/branches/rhel5-2.6.18/current/</nowiki>
<nowiki>mirrorlist=http://download.openvz.org/kernel/mirrors-rhel5-2.6.18</nowiki>
'''enabled=0'''
gpgcheck=1
<nowiki>gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ</nowiki>


== Install new OpenVZ kernel ==

# yum install vzkernel.x86_64

== Check bootloader configuration ==

Make sure 042stab kernel is there and will boot by default:

cat /boot/grub/grub.conf

timeout 5
default 0
title OpenVZ (2.6.32-042stab081.8)
root (hd0,1)
kernel /vmlinuz-2.6.32-042stab081.8 ro root=/dev/sda3 vga=0x317 selinux=0 sysfs.deprecated=1
initrd /initrd-2.6.32-042stab081.8.img

title OpenVZ (2.6.18-348.16.1.el5.028stab108.1)
root (hd0,1)
kernel /vmlinuz-2.6.18-348.16.1.el5.028stab108.1 ro root=/dev/sda3 vga=0x317 selinux=0
initrd /initrd-2.6.18-348.16.1.el5.028stab108.1.img
....

== Reboot into new kernel ==

# reboot

and make sure the system is up and running.

== Convert /vz to ext4 ==

Boot node from a live-CD (such as, CentOS 6 live CD) and perform the following steps.

Check file system:
# fsck.ext3 -f /dev/sd''xY''

Turn on ext4 features:
# tune2fs -O extents,uninit_bg,dir_index /dev/sd''xY''

Check the new file system again, as ext4 this time:
# fsck.ext4 -fD /dev/sd''xY''

You can do the same for root filesystem, too.

Now, mount your ROOT (<code>/</code>, not <code>/vz</code>) and BOOT partitions:
# mkdir /tmp/root
# mount /dev/sd''aB'' /tmp/root
# mount /dev/sd''aC'' /tmp/root/boot

Finally, chroot into it:
# chroot /tmp/root

Edit its <code>/etc/fstab</code>, replacing <code>ext3</code> with <code>ext4</code> for <code>/vz</code> (and <code>/</code> if you converted it as well).
# vi /etc/fstab

== Create new initrd with proper modules ==

This assumes you are still entered chroot:

# mkinitrd -v -f --with=ext4 --builtin=ehci-hcd --builtin=ohci-hcd --builtin=uhci-hcd \
/boot/initrd-2.6.32-042stab81.8.img 2.6.32-042stab081.8

Notes:
* you have to add ext4 explicitly
* in RHEL6 kernels some USB stuff (that used to be in ehci-hcd, ohci-hcd, uhci-hcd modules) is built-in

== Reboot and enjoy ==

End result is:

# cat /etc/issue
CentOS release 5.10 (Final)
Kernel \r on an \m

# uname -a
Linux CentOS-58-64-minimal 2.6.32-042stab081.8 #1 SMP Mon Sep 30 16:52:24 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux

# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 259G 1.5G 244G 1% /
tmpfs tmpfs 16G 0 16G 0% /dev/shm
/dev/sda2 ext3 496M 46M 425M 10% /boot
/dev/sdb1 ext4 1.8T 196M 1.7T 1% /vz

== See also ==

* [[Quick installation]]

== Acknowledgements ==

This article was originally written by [[Denis Hohryakov]].

[[Category: HOWTO]]

Navigation menu