Anonymous
×
Create a new article
Write your page title here:
We currently have 9 articles on NixSec. Type your article name above or click on one of the titles below and start writing!



    NixSec

    Migrate hw+vps with rsync


    With these rsync commands you can migrate any hardware or vps, as long as the OS version and disk layout are identical on the target machine.


    rsync -arAXv --numeric-ids --exclude=/etc/lvm --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/etc  \
    /sysconfig/network-scripts --exclude=/proc --exclude=/tmp --exclude=/var/tmp --exclude=/sys \
    --exclude=/dev --exclude=/mnt --exclude=/boot --exclude=lost+found --exclude=/root / [email protected]<IP>:/
    

    The command shown here should be executed on the SOURCE/original machine. (One time active sync)

    rsync -arAXv --numeric-ids --exclude=/etc/lvm --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/etc \
    /network/interfaces --exclude=/etc/sysconfig/network-scripts --exclude=/proc --exclude=/tmp \
    --exclude=/var/tmp --exclude=/sys --exclude=/dev --exclude=/mnt --exclude=/boot --exclude=lost+found \
    --exclude=/root / [email protected]<IP>:/
    

    The command shown here should be executed on the SOURCE/original machine. (Continues active sync) This can be put in a cronjob that keeps the machine in continues sync.

    rsync -qarAX --numeric-ids --exclude=/etc/lvm --exclude=/root/.ssh --exclude=/etc/ssh --exclude=/etc/fstab \
    --exclude=/root/.ssh --exclude=/etc/mtab --exclude=/etc/network/interfaces \ 
    --exclude=/etc/sysconfig/network-scripts --exclude=/proc --exclude=/tmp --exclude=/var/tmp \
    --exclude=/sys --exclude=/dev --exclude=/mnt --exclude=/boot --exclude=lost+found --exclude=/root / [email protected]<IP>:/
    


    --exclude=/etc/lvm    All server specific lvm meta data, they are probably (or can be) new on the target machine
    --exclude=/etc/fstab    All server specific drive mappings, they are probably (or can be) new on the target machine
    --exclude=/etc/mtab     All server specific device mappings, they are probably (or can be) new on the target machine
    --exclude=/etc/network  Server network and IP settings
    --exclude=/proc All local running processes
    --exclude=/tmp  Server specific temporary files
    --exclude=/var/tmp      Server specific temporary files
    --exclude=/sys  System directory with libraries and system files
    --exclude=/dev  Server specific hardware devices
    --exclude=/mnt  Mounted devices, cdrom or iso's
    --exclude=/boot Server specific boot files and initrd
    --exclude=/root You might want to copy this manual later, it is excluded due to ssh keys, if they get overwritten during transfer the rsync breaks
    --exclude=lost+found    Server and disk specific lost bits and bites