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
file -s /dev/simfs
say? Is it a filesystem? Can you domkdir /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:40dd
). LVM or Btrfs snapshots work better for backups if I host the containers myself;-) – Terry Wang Feb 07 '13 at 23:52file -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:53dd
→ssh root@vps cat /dev/xvda >~/backup/xen.img
– Gilles 'SO- stop being evil' Feb 07 '13 at 23:55cat
more often thandd
, e.g. zeroing out virtual HDDs. Butdd
still works well when creating swap files;-) – Terry Wang Feb 07 '13 at 23:59dd
is a swiss army knife, don't call it useless... – frostschutz Feb 08 '13 at 02:30dd
orcat
. You might have to work on the filesystem layer. – frostschutz Feb 08 '13 at 02:52