OpenVZ Forum


Home » General » Support » container to physical standalone machine (how to load container into a physical machine)
container to physical standalone machine [message #40639] Thu, 09 September 2010 05:07 Go to next message
teekien is currently offline  teekien
Messages: 11
Registered: April 2010
Junior Member
Hi everyone,

I was wondering if anyone has managed to load an OpenVZ container onto a standalone physical machine. (V2P instead of P2V)

I have looked for references, but cannot find any.

Thank you for any replies.

Re: container to physical standalone machine [message #40643 is a reply to message #40639] Thu, 09 September 2010 15:01 Go to previous message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hello,

I'd never done v2p before you mentioned it but
your post made me curious. So here is the quick
report of the experiment that I conducted.

Prerequisites.
Assume a standalone Linux box or virtual machine
running OpenVZ is under consideration. Lets call
it a Node.

The final goal and methods to achieve it.
It would be great to make one of the VEs running
on the Node be not a virtual but a physical machine.
For the sake of simplicity I did it in the following
way:
1. An additional hard disk was attached to the Node.
2. A partition was created and formatted as ext3 filesystem.
3. VE's image was moved to that partition.
4. Appropriate kernel and initrd images were put to that
partition and menu.lst on the Node was fixed in such a way
that the chosen kernel is loaded and "root filesystem"
is pointed to the newly created partiton.

Technical issues.
1-2. I omit the first two steps as it doesn't have anything with
OpenVZ. So, suppose /dev/hdb1 is the newly created partition.
3.

SOME PRELIMINARIES.
# vzlist -a
      CTID      NPROC STATUS    IP_ADDR         HOSTNAME
       101         16 running   -     -
       102         16 running   -               -
       103         19 running   -     -
# cat /etc/vz/conf/103.conf | grep -i OSTEMPLATE
OSTEMPLATE="centos-5-x86"
# tune2fs -L v2p /dev/hdb1
# mount -t ext3 LABEL=v2p /mnt/


PLEASE,MAKE SURE BEFORE SYNCING VE's IMAGE THAT
vzdummy* PACKAGES ARE REMOVED FROM INSIDE THE VE
AND KERNEL, MKINITRD and UDEV PACKAGES ARE INSTALLED)

# rsync -arvpz --numeric-ids  /vz/root/103/  /mnt/

CHANGING /etc/fstab.
# cat /mnt/etc/fstab
LABEL=v2p                 /                       ext3    defaults        1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

MODIFY /mnt/etc/inittab IN THE WAY AS
IT IS DONE ON THE NODE.

CREAT INITRD IMAGE WITH APPROPRIATE MODULES (CHECK THE INITRD ON THE NODE http://wiki.openvz.org/Modifying_initrd_image)
IN MY CASE

# chroot /mnt/
# mkinitrd --with=scsi_mod --with=sd_mod --with=libata --with=ata_piix  /boot/initrd-2.6.18-194.11.3.el5.img 2.6.18-194.11.3.el5

MODIFY menu.lst on the Node
# cat /boot/grub/menu.lst
title Centos-VE (2.6.18-194.11.3)
        root (hd1,0)
        kernel /boot/vmlinuz-2.6.18-194.11.3.el5 ro root=LABEL=v2p rhgb
        initrd /boot/initrd-2.6.18-194.11.3.el5.img



It was enough to me to boot that CentOS based VE.
I expect you may have other issues with v2p but the
general idea might be enough to cope with all problems
that might arise.

[Updated on: Thu, 09 September 2010 15:02]

Report message to a moderator

Previous Topic: Container_enter_failed
Next Topic: 3ware + Linux 2.6.26-2-openvz-amd64 kernel
Goto Forum:
  


Current Time: Thu Sep 12 02:13:08 GMT 2024

Total time taken to generate the page: 0.07498 seconds