On Wed, Jan 25, 2017 at 5:01 PM, Alberto Garcia <be...@igalia.com> wrote:
> On Wed, Jan 25, 2017 at 04:16:22PM +0100, Gianni Costanzi wrote: > > > > > what's the purpose of specifying the size when you're creating > > > > an image with a backing file? Is it simply ignored? > > > > > > The (virtual) sizes of the new image and the backing image can be > > > different. If you don't specify anything then the new image will > > > have the same size. > > > I still don't understand what it means. If I have a base image of > > 10 GB with and it is almost full of data (it has a 10GB partition > > almost full, for example) and then I create a new image with 2 GB of > > size based on the first one. > > Then you get a 2GB image. When you create an image with qemu-img you > get the (virtual) size that you asked for. > > When QEMU reads from the virtual disk and a particular chunk of data > is not in the new image then it reads it from the backing image. > > The practical effect is that you have a new image with the first 2GB > of the backing image. > > > If I boot my os from the new Image I still see 10 GB partition, > > right? > > Well, the OS will probably say that you have a 2GB disk with a 10GB > partition, because that's what's written in the partition table, but > as soon as you try to use it you'll get an "attempt to access beyond > end of device". > > Berto > > Thank you very much, this is very clear! Then I think that it can be only useful to specify a larger size, if you want to enlarge the FS within the new image. Gianni