I have a CentOS6.9 Linux server remotely on a VPS Provider and I need to clone my remote server on my local computer as a Virtual Machine for examination purposes.

I made a full server backup without compression to another remote server (rsync.net) by using the following rsync command:

rsync -auHxv --numeric-ids --delete-after --progress --exclude="/etc/fstab" --exclude="/dev/*" --exclude="/proc/*" --exclude="/sys/*" --exclude="/tmp/*" --exclude="/boot/*" --exclude="/run/*" --exclude="/mnt/*" --exclude="/media/*" --exclude="/backup/*" --exclude="/lost+found" / -e ssh user@server.rsync.net:backup_directory

Would it be possible to use this backup as an image for cloning through Virtual Machine on my local computer, either by using VMWare Workstation or Virtual Box or any other Virtual Machine Platform ?


I would use DD over SSH and import that as a new VBox image after conversion. I use GZIP to skip copying gigs of empty space.

ssh root@remoteIP  "dd if=/dev/sda | gzip - " | dd of=image.gz

Uncompress and convert.

gunzip image.gz 
VBoxManage convertdd image image.vdi --format VDI
  • Thanks. How exclusions are declared ?
    – Cadmos
    Jun 4 '18 at 18:01
  • Hey @Cadmos unfortunately DD does not have such a concept. If you wanted to use rsync I would just install the same OS in VBox then run your rsync from there. I think that would be quickest. Although DD would give you a 1:1 copy of the disc.
    – Joe M
    Jun 4 '18 at 19:30
  • I agree it would be better using DD however the free disk space on the VPS that is to be backed up has not enough disk space (almost 20%) and I have to exclude at least /home dir which has the cpanel accounts in.
    – Cadmos
    Jun 4 '18 at 19:45
  • my disk is 100GB however now only the 23GB are being used. DD /gzip will create an image of the total capacity of the disk or only for the used space, meaning the 23GB, so the image will be equal/lesser than 23GB ?
    – Cadmos
    Jun 5 '18 at 11:01
  • Hey @Cadmos - Using GZIP it should be ~23GB or less, it compresses all the empty space to 0 bytes. Hopefully you should gain some more compression from GZIP as well. When you GUNZIP it, it will be 100GB though.
    – Joe M
    Jun 5 '18 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.