Difference between revisions of "028 to 042 kernel upgrade"
(created (stolen from https://openvz.org/User_talk:Denis_Hohryakov)) |
(No difference)
|
Revision as of 21:44, 29 October 2013
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
Contents
Update your system
yum update
Add rhel6 kernel repos
Disable rhel5 and enable rhel6 OpenVZ kernel repository.
In other words, change /etc/yum.repos.d/openvz.repo
to look like this (changes required are in bold):
[openvz-kernel-rhel6] name=OpenVZ RHEL6-based stable kernels #baseurl=http://download.openvz.org/kernel/branches/rhel6-2.6.32/current/ mirrorlist=http://download.openvz.org/kernel/mirrors-rhel6-2.6.32 enabled=1 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ #exclude=vzkernel-firmware
[openvz-kernel-rhel5] name=OpenVZ RHEL5-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhel5-2.6.18/current/ mirrorlist=http://download.openvz.org/kernel/mirrors-rhel5-2.6.18 enabled=0 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ
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/sdxY
Turn on ext4 features:
# tune2fs -O extents,uninit_bg,dir_index /dev/sdxY
Check the new file system again, as ext4 this time:
# fsck.ext4 -fD /dev/sdxY
You can do the same for root filesystem, too.
Now, mount your ROOT (/
, not /vz
) and BOOT partitions:
# mkdir /tmp/root # mount /dev/sdaB /tmp/root # mount /dev/sdaC /tmp/root/boot
Finally, chroot into it:
# chroot /tmp/root
Edit its /etc/fstab
, replacing ext3
with ext4
for /vz
(and /
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
Acknowledgements
This article was originally written by Denis Hohryakov.