This is all about doing live migration of VMs that have attached local storage. So the storage needs to move alongside the compute — and it has to physically move, block by block, from the old hypervisor’s local disk to the new hypervisor’s local disk. How do you do that without a horrible stop-the-world for your customers’ applications?
I always wondered how this was done, and this post gives the shape of one approach to the problem. Enjoyed.
The Linux feature we need to make this work already exists; it’s called
dm-clone
. Given an existing, readable storage device,dm-clone
gives us a new device, of identical size, where reads of uninitialized blocks will pull from the original. It sounds terribly complicated, but it’s actually one of the simpler kernel lego bricks. Let’s demystify it.