Re: [Qemu-block] [Qemu-devel] Can I only commit from active image to cor
From:
lampahome
Subject:
Re: [Qemu-block] [Qemu-devel] Can I only commit from active image to corresponding range of its backing file by qemu cmd?
Date:
Fri, 14 Sep 2018 10:19:01 +0800
Sorry, I need to explain what case I want to do
Todo: I want to backup a block device into qcow2 format image.
I met a problem which is the file size limit of filesystem ex: Max is 16TB for any file in ext4, but the block device maybe 32TB or more.
I figure out one way is to divide data of device into 1TB chunk and save every chunk into qcow2 image cuz I don't change filesystem, and connect with backing chain.
(That's what I said range is different)
Ex: 1st chunk of device will save into image.000
2nd chunk of device will save into image.001
Nth chunk of device will save into image.(N-1)
...etc
I can see all block device data when I mount image.(N-1) by qemu-nbd cuz the chunk doesn't overlap and all chunks connect by backing chain.
Now I want to do next thing: Incremental backup
When I modify data of 1st chunk, what I thought is to write new 1st chunk to new image image.N and let imgae.(N-1) be the backing file of
image.N .
That's cuz I want to store the data before modified to roll back anytime.
So now I have two version of block device(like concept of snapshot):
One is image.000 to image.(N-1). I can access the data before modify by mount image.(N-1) through qemu-nbd
The other one is image.000 to image.N.
I can access the data after modify by mount image.N through qemu-nbd(cuz the visible 1st chunk are in the image.N)
Consider about the situation:
000 A - - - - - - - -
<<<<<---store the 1st chunk of block device
001 - B - - - - - - -
002 - - C - - - - - - (1st state of block device)
003 A' - - - - - - - - <<<<<--- store the 1st chunk of block device, but data is different
004 - - - D - - - - -(2nd state of block device)
005 - - - - E - - - -
(3rd state of block device)
The original problem is If I want to remove the 2nd state(003 and 004) but I need to keep the data of 003 and 004.
If I just commit 003, the A' of 003 must be committed into 002 cuz 002 is the backing file of 003. I try to figure out some way to let it only commit from 003 into 000.