On Mon, Oct 15, 2018 at 3:54 AM Richard W.M. Jones <rjones@redhat.com> wrote:
[Adding libguestfs mailing list]
On Sun, Oct 14, 2018 at 11:53:17AM -0400, Raghuram Devarakonda wrote:
Hi,
In our project, we deal with quite large sparse files whose total size runs into several hundred terabytes or even more, though actual allocated size on disk is much smaller. The problem is that such large files present issues for copying around, compression, or even for computing checksums. I am wondering of I can use guestfs-tools to mount a QCOW2 image and then use the image as sparse file. The idea is that actual file on the disk would be compact though to our code, sparse file interface is preserved.
It's not very clear to me exactly what you want, but in general yes qcow2 is a good way to handle very large, sparse disk images.
If you can be clearer about exactly what you mean by "mount" then I could answer the question better. For example, do you mean "mount a filesystem in the qcow2 image"? In which case use guestmount. If you mean "attach the qcow2 disk as a local device" then qemu-nbd can do this.
We would like to create and write to a large sparse file but would like to keep the file on disk itself in compact format. So we are not talking about a file system but a single file. I guess this means creating qcow2 disk and attach as a local device? Thanks, Raghu