{"id":679,"date":"2022-08-18T09:27:00","date_gmt":"2022-08-18T08:27:00","guid":{"rendered":"http:\/\/blogs.silicontechnix.com\/?p=679"},"modified":"2026-08-18T09:33:35","modified_gmt":"2026-08-18T08:33:35","slug":"how-to-convert-openvz-lxc-containers-to-esxi","status":"publish","type":"post","link":"https:\/\/blogs.silicontechnix.com\/?p=679","title":{"rendered":"How to convert OpenVz\/LXC containers to ESXi?"},"content":{"rendered":"<p>&nbsp;<\/p>\n<div>\n<p>Here my short course of action &#8211; perhaps someone will be helpful.<\/p>\n<p>1. create 2Gb clean image on openvz host<\/p>\n<p>dd if=\/dev\/zero of=\/opt2\/VHD\/speed.img bs=516096c count=4000<br \/>\nfdisk -u -C4000 -S63 -H16 \/opt2\/VHD\/speed.img<br \/>\n2. mount image, create fs<\/p>\n<p>losetup -o32256 \/dev\/loop0 \/opt2\/VHD\/speed.img<br \/>\nmke2fs -b1024 \/dev\/loop0 2015968<br \/>\ntune2fs -j \/dev\/loop0<br \/>\n3. mount image with fs<\/p>\n<p>mount -text3 \/dev\/loop0 \/mnt\/speed\/<br \/>\n4. copy container files to image<\/p>\n<p>cp -av \/var\/lib\/vz\/private\/131\/* \/mnt\/speed\/<\/p>\n<p>5. umount image<\/p>\n<p>6. convert\u00a0 image to VMDK format<\/p>\n<p>kvm-img convert -f raw speed.img -O vmdk speed.vmdk<br \/>\n7. on esxi host create VM without hdd<br \/>\n8. copy speed.vmdk to esxi (best way &#8211; use FTP)<br \/>\n9. on esxi convert VMDK image to thin format<\/p>\n<p>vmkfstools -i speed.vmdk -d thin speed-thin.vmdk<br \/>\n10. connect speed-thin.vmdk to VM (edit VM properties-&gt;add hard disk-&gt; use existing&#8230;), start VM, boot from rescue CD:<\/p>\n<p>&#8211; vi \/etc\/network\/interfaces<\/p>\n<p>&#8211; vi \/etc\/apt\/sources.list<br \/>\n&#8211; apt-get update<br \/>\n&#8211; apt-get install linux-image-2.6-686 grub-pc<br \/>\n&#8211; add in \/etc\/inittab<br \/>\n1:2345:respawn:\/sbin\/getty 38400 tty1<br \/>\n2:23:respawn:\/sbin\/getty 38400 tty2<br \/>\n3:23:respawn:\/sbin\/getty 38400 tty3<br \/>\n4:23:respawn:\/sbin\/getty 38400 tty4<br \/>\n5:23:respawn:\/sbin\/getty 38400 tty5<br \/>\n6:23:respawn:\/sbin\/getty 38400 tty6<br \/>\n&#8211; echo &#8220;\/dev\/sda1 \/ ext3 defaults,errors=remount-ro 0 1&#8221; &gt; \/etc\/fstab<br \/>\n&#8211; update-grub<\/p>\n<p>11. boot VM normally<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Here my short course of action &#8211; perhaps someone will be helpful. 1. create 2Gb clean image on openvz host dd if=\/dev\/zero of=\/opt2\/VHD\/speed.img bs=516096c count=4000 fdisk -u -C4000 -S63 -H16 \/opt2\/VHD\/speed.img 2. mount image, create fs losetup -o32256 \/dev\/loop0 \/opt2\/VHD\/speed.img mke2fs -b1024 \/dev\/loop0 2015968 tune2fs -j \/dev\/loop0 3. mount image with fs mount -text3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-679","post","type-post","status-publish","format-standard","hentry","category-bookmark"],"_links":{"self":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts\/679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=679"}],"version-history":[{"count":2,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts\/679\/revisions"}],"predecessor-version":[{"id":1140,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts\/679\/revisions\/1140"}],"wp:attachment":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}