Archive

Archive for the ‘OpenVZ’ Category

SolusVM: Cancelling stuck migrations

April 8th, 2022 Comments off

There is a rare bug which can occur with SolusVM, in which migrations will get stuck at 0% – no matter how much time passes, like so or if you want to cancel the migration process because of slow transfer speed.

When this happens, do the following:

1) Connect to the SolusVM master via SSH

2) Execute the following command to create a database backup of the SolusVM master (it’s unlikely it will be needed, but, better safe than sorry!):

curl -o svmdbdump.sh https://raw.githubusercontent.com/solusvm-support/helpers/master/svmdbdump.sh && sh svmdbdump.sh

3) Execute the following command to launch a MySQL session:

MYSQL_PWD=`cat /usr/local/solusvm/includes/solusvm.conf | awk -F ":" '{print $3}'` mysql `cat /usr/local/solusvm/includes/solusvm.conf | awk -F ":" '{print $1}'` -u`cat /usr/local/solusvm/includes/solusvm.conf | awk -F ":" '{print $2}'` -h`cat /usr/local/solusvm/includes/solusvm.conf | awk -F ":" '{print $4}'`

4) Execute the following three commands, replacing “ID” with the ID of the VPS as shown in the URL when managing the VPS (i.e. https://yoursolusvm.com/admincp/manage.php?id=99999 – 99999 is the ID in this example)

update migrations set status = 2 where vserverid = 99999;
update migrations set status2 = 1 where vserverid = 99999;
update migrations set status3 = 1 where vserverid = 99999;

5) Open the SolusVM Migration page for the VPS in question.

6) Select “Migration failed. Clean ip the destination node and boot the source virtual server” 

Categories: Control Panel, OpenVZ, SolusVM Tags:

Create a template from a OpenVZ container on Virtuozzo node with the ploop layout

January 30th, 2021 Comments off

1) SSH to the OpenVZ/Virtuzzo slave node where the source template container is running.

2) Stop the container via SolusVM interface.

3) Create a directory where you wish to mount the container image, e.g.:

mkdir /24x7template

4) Mount the container image using CTID:

mount -t ploop /vz/private/751/root.hdd/DiskDescriptor.xml /24x7template

Note : In the above example, the CTID is 751, you will need to replaced it with the actual your container ID.

[root@server ~]# mount -t ploop /vz/private/751/root.hdd/DiskDescriptor.xml /24x7template
Opening delta /vz/private/751/root.hdd/root.hds
Opening delta /vz/private/751/root.hdd/root.hds
Adding delta dev=/dev/ploop26012 img=/vz/private/751/root.hdd/root.hds (rw)
Mounted /dev/ploop26012p1 at /24x7template fstype=ext4 data=',balloon_ino=12'
[root@server ~]#

5) go to the directory, you will see the files like below:

cd /24x7template
[root@server ~]# cd /24x7template
[root@server 24x7template]# ls -la
total 100
dr-xr-xr-x 19 root root 4096 Dec 10 21:46 .
dr-xr-xr-x. 22 root root 4096 Dec 10 21:48 ..
drwx--x--x 2 root root 4096 Dec 9 02:00 backup
lrwxrwxrwx 1 root root 7 Mar 12 2019 bin -> usr/bin
dr-xr-xr-x 3 root root 4096 Mar 12 2019 boot
drwxr-xr-x 2 root solusvm 4096 Mar 12 2019 dev
drwxr-xr-x 88 root root 12288 Dec 10 21:45 etc
drwxr-xr-x 5 root root 4096 Dec 8 15:24 home
lrwxrwxrwx 1 root root 7 Mar 12 2019 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Mar 12 2019 lib64 -> usr/lib64
drwx------ 2 root root 16384 Mar 12 2019 lost+found
drwxr-xr-x 2 root root 4096 Apr 10 2018 media
drwxr-xr-x 2 root root 4096 Apr 10 2018 mnt
drwxr-xr-x 4 root root 4096 Dec 8 15:22 opt
dr-xr-xr-x 2 root root 4096 Mar 12 2019 proc
-rw-r--r-- 1 root root 109 Dec 8 15:25 razor-agent.log
dr-xr-x--- 14 root root 4096 Dec 10 03:35 root
drwxr-xr-x 3 root root 4096 Mar 12 2019 run
lrwxrwxrwx 1 root root 8 Mar 12 2019 sbin -> usr/sbin
lrwxrwxrwx 1 root root 25 Dec 8 15:20 scripts -> /usr/local/cpanel/scripts
drwxr-xr-x 2 root root 4096 Apr 10 2018 srv
drwx------ 2 root root 4096 Mar 12 2019 sys
drwxrwxrwt 7 root root 4096 Dec 10 21:47 tmp
drwxr-xr-x 13 root root 4096 Dec 8 15:21 usr
drwxr-xr-x 22 root root 4096 Dec 9 13:52 var
-rw-r--r-- 1 root root 0 Dec 9 13:54 .vzfifo

6) Create a template using the following command, e.g. for CentOS 7:

tar --numeric-owner --ignore-failed-read -czpf /vz/template/cache/centos-7-x86_64-ez.tar.gz ./*
[root@server 24x7template]# tar --numeric-owner --ignore-failed-read -czpf /vz/template/cache/centos-7-x86_64-ez.tar.gz ./*
tar: ./usr/local/cpanel/var/cpdoveauth_domainownerd.sock: socket ignored
tar: ./usr/local/cpanel/var/cpauthd.sock: socket ignored
tar: ./usr/local/cpanel/var/cpdoveauthd.sock: socket ignored
tar: ./usr/local/cpanel/var/cpwrapd.sock: socket ignored
[root@server 24x7template]#

7) Unmount the ploop device:

cd ~
umount /24x7template

8) On OpenVZ 7 additional step should be done, the name of the template has to be the following format:

OS-version-bit-custom.tar.gz

It is /usr/libexec/ovz-template-converter –verbose /vz/template/cache/centos-7-x86_64-ez.tar.gz

So the template should be named centos-7-x86_64-ez.tar.gz

Unmounting file system at /tmp/tmpfoOqjQ
Unmounting device /dev/ploop26012
Opening delta /tmp/tmpBs5hMm/root.hds
Deleted the temporary template contents directory /tmp/tmpfoOqjQ
Creating cache file for the selected template
./
./DiskDescriptor.xml
./DiskDescriptor.xml.lck
./root.hds
Compressed 5293219840 bytes into 2133279899 bytes ==> 40.30%
Created cache file for the selected template: /vz/template/cache/centos-7-x86_64-ez.plain.ploopv2.tar.lz4
Deleted the temporary working directory /tmp/tmpBs5hMm
[root@server ~]#

Here if you get “No space left on device” error for /tmp

Refer to below “df -h” command output for /tmp from the node for more details:

/dev/ploop26012p1 4.8G 4.6G 0 100% /tmp/tmpfoOqjQ

Following steps need to perform of the slave server over SSH.

Remove already made configuration for the template:

rm /vz/template/cache/distribution-version-arch[customname.plain.ploopv2.tar.lz4
rm /vz/template/distribution/version/arch/config/os/customname

For example:

rm /vz/template/cache/centos-7-x86_64-custom.plain.ploopv2.tar.lz4
rm /vz/template/centos/7/x86_64/config/os/custom

Then, open the file /etc/vz/conf/vps.vzpkgtools.conf-sample with a text editor and Increase the value of DISKSPACE, for example:

DISKSPACE="20485760:20485760"

Convert the template again:

/usr/libexec/ovz-template-converter --verbose /vz/template/cache/centos-7-x86_64-ez.tar.gz

9) Upload the template file at /vz/template/cache directory on the Master server. Once the templates are uploaded, navigate to Media > List templates and click on the corresponding Add button under the SolusVM interface.

Categories: OpenVZ, Virtuozzo Tags: , ,

Mount windows/linux disk using kpartx

May 10th, 2017 Comments off

This post will guide you through how to access the contents of the virtual disk (LVM disk) directly so that you don’t need to boot the VM or when VM is not booting and you want to recover the data(windows or linux)

[root@node ~]# lvdisplay | grep centos
LV Path /dev/VolGroup/centos
LV Name centos

We need to create device maps from this LVM device’s partition tables.

kpartx -av /dev/VolGroup/centos

add map VolGroup-centos1 (253:8): 0 9912042 linear /dev/VolGroup/centos 63
add map VolGroup-centos2 (253:9): 0 562275 linear /dev/VolGroup/centos 9912105
add map VolGroup-centos : 0 562212 linear 253:9 9912168

Now we can mount the image and grab any files we may need.

mkdir /mnt/centos

mount /dev/mapper/vbox-centos1 /mnt/centos

Once we are done accessing our files, we can go ahead and unmount the partition and delete the partition mappings.

umount /mnt/centos

kpartx -d /dev/VolGroup/centos

Categories: OpenVZ, SolusVM Tags: , , , , ,
%d bloggers like this: