2

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 07 '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 07 '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 07 '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 07 '13 at 23:53
  • 2
    Useless use of ddssh root@vps cat /dev/xvda >~/backup/xen.img – Gilles 'SO- stop being evil' Feb 07 '13 at 23:55
  • @Gilles Cool! I use cat more often than dd, e.g. zeroing out virtual HDDs. But dd still works well when creating swap files;-) – Terry Wang Feb 07 '13 at 23:59
  • dd is a swiss army knife, don't call it useless... – frostschutz Feb 08 '13 at 02:30
  • And if you have no read permission, you can't use either dd or cat. You might have to work on the filesystem layer. – frostschutz Feb 08 '13 at 02:52

0 Answers0