Area personale

 

Tag

 

Ultime visite al Blog

taichungmonellaccio19amorino11m12ps12acer.250miriade159prefazione09Marion20cassetta2limitedelbosco0marabertowjoerivetto6surfinia60Catter1na
 

Ultimi commenti

 
Creato da: taichung il 12/01/2011
Linux Drupal Pinephone Freerunner Android

 

 
« Drupal: cambiare un link...Pinephone review: OpenSu... »

How to hot clone a Linux VM with rsync.

Post n°66 pubblicato il 24 Febbraio 2023 da taichung
 

Problem: I have a Debian vm on Proxmox which lately suffers weird problems which cause the block of the OS. The vm is very old. Originally a Virtualbox 32 bit vm, then moved to KVM/qemu and migrated to 64 bit (kernel+packages).

Therefore I decided to try to clone it. The clone is "hot" because you don't need to shutdown  the source VM; however, to avoid some trouble, it will be better to STOP the running unnecessary  services.

I did this on the same Proxmox host. First I created a new Debian vm with a HD of same size as the original, and SAME version of the OS. On the source (old vm), I stopped all the services which keep writing on the disk (excepted those like logrotate,rlog, syslog etc. which I don't care about): servers for database, email, firewall... I left sshd to allow me to connnect to the machines and check what's happening (btw, in case of failure you can still try to use the console embedded in Proxmox). On the source I created a list of installed packages, copied that list on the new vm and used it to install all  the same packages (check for my previous post on this blog); be sure to have the same rsw repositories on both machines. On the source vm I created a file, called for example "excludedpackages.txt) with the following content:

/boot
/dev
/tmp
/sys
/proc
/etc/fstab
/etc/mtab
/root

You can add other paths in case of need.

With both vm running and connected to my LAN (so that I can ssh into them from a third PC), on the old vm, as root user, I run in a terminal:

$ rsync -vPa -e 'ssh -o StrictHostKeyChecking=no' --exclude-from=/root/excludedpackages.txt / DESTINATIONIP:/

Obviously you need to change "DESTINATIONIP" with the login and real IP address of your destination VM. The system will ask you for the password of the user on the destination vm, then the synchronization will begin, and take some time.
Once finished (hopefully without errors, otherwise you can try again) you can turn off the old vm. Optionally modify the IP address of the destination vm so that it can have the same of the original, old vm; by doing so, you can avoid to tell all the computers of your LAN that the server which provided a certain service (for example the email) has changed IP and therefore they must reconfigure their clients.

Reboot the new VM and check that everything is working.
This procedure should work with all the other GNU Linux OSs, probably with BSD too, with some change.

Enjoy your new shining virtual machine!



Credit for this solution to: https://linuxadmin.io/hot-clone-linux-server/

 
Condividi e segnala Condividi e segnala - permalink - Segnala abuso
 
 
Vai alla Home Page del blog

Cerca in questo Blog

  Trova
 
RSS (Really simple syndication) Feed Atom
 

Archivio messaggi

 
 << Maggio 2024 >> 
 
LuMaMeGiVeSaDo
 
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
 
 

Sponsored link

Inchiostro stampanti varie marche a prezzi competitivi

 

© Italiaonline S.p.A. 2024Direzione e coordinamento di Libero Acquisition S.á r.l.P. IVA 03970540963