5 ms·
The first pass, reading the whole disk, takes a long time (often hours for HDDs), so you'll have to deal with a lot of modifications. As long as the system was
by tgsovlerkhgsel 5y ago
The first pass, reading the whole disk, takes a long time (often hours for HDDs), so you'll have to deal with a lot of modifications.
As long as the system was only under normal near-idle load, there will be some modifications, but not too many, so you'll be able to catch up much more quickly, leaving the window for new modifications even smaller.
Of course, if the disk is continuously receiving a high write volume, the race might never end. But if it's idle long enough for you to do a sync and a final collection pass before the next write, you'll have a full image.
- derefr 5y agoPlus, if the same few pages are getting written over and over (as often happens in high-write-load scenarios), you don’t need to queue up N reads, but instead can just do one, to capture the latest value. Similar to POSIX signal coalescing—once you know “X happened”, any other “X happened” notifications are redundant and can be dropped, until you actually handle the first one.
- marcan_42 5y agoAs long as you can catch up to a point where you read all busy pages and none were written in the meantime, yes. Generally, the way VM migrations deal with this is by suspending the VM once a small enough set of dirty pages remain. I think the same can be done with block devices on Linux; if I remember correctly, there's some file in sysfs that you can poke to quiesce a block device. Just make sure your app is fully in RAM/cache, ideally locked, if you do this to your root filesystem :)
- cafxx 5y agoYou could potentially also speed it up a bit by, after the first pass, trying to read first blocks that are unlikely to be written again soon (normally the longer a block has been written last, the less likely it is to be written again soon). This would implicitly leave blocks that are being written over and over for last.
- hddqsb 5y agoExcept that's not how this tool works. It only does a single pass over the modified blocks as far as I can tell.[1][2] [1] https://github.com/benjojo/hot-clone/blob/6a019efe28bdbbeeb1ade1f188eaeb0a9843e5a5/main.go#L137 https://github.com/benjojo/hot-clone/blob/6a019efe28bdbbeeb1... [2] https://github.com/benjojo/hot-clone/blob/6a019efe28bdbbeeb1ade1f188eaeb0a9843e5a5/dirty-bitmasks.go#L45 https://github.com/benjojo/hot-clone/blob/6a019efe28bdbbeeb1...