On 20.08.19 11:41, lampahome wrote: > I want to remove snapshots and I found two ways: > qemu-img commit > qemu-img rebase > > I found they both can choose which img to rebase(merge). > > And I found some little difference like below: > commit can truncate or not on specific image. > rebase won't truncate rebased image. > > I found they have something little similarity and I don't know what > situation is suitable for commit or rebase? > I don't know what situation is suitable to use commit or rebase.
Generally, rebase is going to be slower because it reads some clusters and compares the old with the new backing file to see whether they are the same. commit will not do that. (OTOH, if there are many clusters in the old backing chain that happen to contain the same data as the new one, this will save space, because it won’t copy those clusters from the old backing chain.) That’s because rebase is a more general tool than commit, so it has to do this comparison cluster by cluster. Other than that, commit is the same as the commit block job, and rebase is similar to the stream block job. One of their main differences is which image the data ends up in: If the overlay and the backing file lie on different storage media, you may prefer one of them to hold data over the other. Example 1: Say your overlay is on a fast medium and your base image is on a slow medium (with greater storage capacity, though). In this case, you probably want to move data off to the slower medium for long-term storage, so you probably want to use commit. Example 2: You have some image with a backing file on a remote server (e.g. some template image). You now want to become independent of that remote server, so you need to move the data to your local storage. In this case, you will want to use rebase (with -b ''). HTH, Max
signature.asc
Description: OpenPGP digital signature