I want to use dd to backup the disk of an OpenVZ VPS in addition to traditional cold tar backups. Because I may need to migrate to a different VPS provider.

From end user point of view, OpenVZ containers are folders on the host (similar to LXC). If I am not wrong, OpenVZ uses common file system so containers (virtual environments) are just directories (isolated by chroot).

Within the container, / uses a block device called /dev/simfs, I wonder if I can use dd to backup the whole disk image over SSH.

Technically I don't see any problem, but I haven't done it myself, just not 100% sure and confident. I have done the same thing for Xen and VMware VMs, it worked fine.

For Xen

ssh root@vps "dd if=/dev/xvda " | dd of=~/backup/xen.img

Does it work for OpenVZ, anyone has tried this before?

ssh root@vps "dd if=/dev/simfs" | dd of=~/backup/openvz.img

  • I don't have access to OpenVZ machine. What does file -s /dev/simfs say? Is it a filesystem? Can you do mkdir /mnt/root ; mount -o ro /dev/simfs /mnt/root? If so, dd might work as well. If not, dd won't work either. – frostschutz Feb 7 '13 at 23:40
  • 2
    Also you should be aware that without some kind of snapshot functionality, dd'ing the live root parititon of a server will produce an inconsistent/damaged image. – frostschutz Feb 7 '13 at 23:42
  • @frostschutz I am aware of the fact. I am just testing the if it works. Because later on I may need to migrate to a different VPS provider (I'll do traditional cold tar backups and do a dd). LVM or Btrfs snapshots work better for backups if I host the containers myself;-) – Terry Wang Feb 7 '13 at 23:52
  • file -s /dev/simfs => /file -s /dev/simfs /dev/simfs: writable, executable, no read permission Not sure what exactly it means. – Terry Wang Feb 7 '13 at 23:53
  • 2
    Useless use of ddssh root@vps cat /dev/xvda >~/backup/xen.img – Gilles 'SO- stop being evil' Feb 7 '13 at 23:55

Your Answer

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

Browse other questions tagged or ask your own question.