Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToRaw ¶
ConvertToRaw reads a QCOW2 v2/v3 image at src and writes an equivalent raw disk image to dst. It writes "N%\n" progress lines to w.
Supported features:
- Compressed clusters: deflate (type 0, default)
Unsupported features (return an error):
- Encryption (encryption_method != 0 in the header)
- ZSTD compression (QCOW2 v3 with compression_type=1)
Backing files are not followed: unallocated clusters are written as zeros.
func Create ¶
Create writes a new empty QCOW2 v2 image at path with the given virtual size in bytes. The file contains no allocated data clusters; reads from the raw image will return zeros.
func IsQCOW2File ¶
IsQCOW2File returns true if path starts with the QCOW2 magic bytes (0x514649fb = "QFI\xfb").
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device provides read-write block device access to a QCOW2 v2/v3 image. Unallocated virtual clusters are allocated lazily on first write (COW append). Compressed clusters are supported for reading; writing to a compressed cluster returns an error (re-compression is not implemented).
func OpenDevice ¶
OpenDevice opens the QCOW2 image at path as a read-write block device.
func (*Device) Fd ¶
Fd returns the underlying file descriptor. Useful for callers that need to pass the QCOW2 container to syscall- or sparse-tools-flavoured APIs (note the fd is the container, not the virtual disk — random reads via the fd yield QCOW2-format bytes, not raw guest data; use ReadAt for the latter).
type Format ¶
type Format struct{}
Format is the QCOW2 disk image format. A Format value satisfies the diskimage_format.Format interface defined in github.com/go-diskimages/interface without requiring an import of that module (Go structural typing).
func (Format) Create ¶
Create creates a new QCOW2 disk image. Delegates to the package-level Create.