Hacker News new | ask | show | jobs
by ryanmjacobs 1728 days ago
This is fantastic. I am definitely going to look into the blktrace calls. They look useful.

---

I've been looking for a way to copy virtual machine disks over the network with minimal downtime.

I.e. Copy the entire 50 GB disk over. Suspend the VM. Do a quick pass that picks up the changed blocks. Resume the VM.

Does anyone have a tool for that? It would be similar to how QEMU/KVM does it for VM migrations. (They only support doing it for RAM though.)

---

Also related, you can use the sysrq feature on Linux to remount the root file system as read-only. Then run `dd if=/dev/sda | ssh user@destination.com 'cat > sda.img'` to transfer the root partition consistently.

I've used this twice to migrate VPSs off of Cloud providers and onto my physical servers to convert to .qcow2 images. Worked perfectly :)

I'm not sure if you are required to reboot afterwards, but I always do. It would be nice to "un sysrq remount".

2 comments

Qemu has a native changed blocks API like vmware, but I'm not sure of anything that uses it extensively (besides oroxmox backup server pointing at a oroxmox server).

https://lwn.net/Articles/837053/

Also you can always do the fsfreeze yourself (which is what qemu agent can do, and is used by proxmox backup server).

> Does anyone have a tool for that? It would be similar to how QEMU/KVM does it for VM migrations. (They only support doing it for RAM though.)

I don't know of anything wrapping it, but if I was doing that I'd just put it on ZFS (handing zvols to qemu as disks) and then do incremental snapshots and send-recv them. (Bonus: trivial inline compression, and if you `zfs send --raw` even the transfer will be compressed)

Ah. Yeah, that's what I have been doing. It took about an hour to send 100G initial ZFS seed over the network between different datacenters. Then I suspended all of the VMs and sent the remaining incremental.

The --raw/-w flag does send the compressed data.

It always feels brittle to me because of how manual the process is. Maybe it's time to create some decent scripts with safe logic and checks...

Scripting would be nice, but unless you're deleting things it feels extremely safe to me, since you're working on (and retain) snapshots the whole way; if anything ever does go wrong just roll back:)