Documentation
¶
Overview ¶
Package diskfile makes, grows, copies and measures disk files: the sparse files that hold a guest's disks on the host.
Index ¶
- func AllocatedBytes(path string) int64
- func AllocatedBytesUnder(dir string) (int64, error)
- func Copy(src, dst string) (err error)
- func CreateExt4(ctx context.Context, path string, sizeBytes int64) error
- func CreateExt4From(ctx context.Context, path string, sizeBytes int64, dir string) error
- func GrowExt4(ctx context.Context, path string, sizeBytes int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocatedBytes ¶
AllocatedBytes returns the space the file at path takes up on the host, which for a sparse file is less than its size, or 0 if there is no file.
func AllocatedBytesUnder ¶
AllocatedBytesUnder returns the space the files in the directory tree at dir take up on the host, by AllocatedBytes. It returns what it counted with the first error met walking the tree.
func Copy ¶
Copy copies the disk file at src to dst, sharing its blocks by reflink where the filesystem supports it and otherwise keeping its holes. The copy is written beside dst and renamed into place, so dst never holds a disk half copied.
func CreateExt4 ¶
CreateExt4 creates a sparse disk file of sizeBytes at path, holding an empty ext4 filesystem. It is formatted beside path and renamed into place, so path never holds a disk half made. Formatting needs mke2fs, from e2fsprogs.
func CreateExt4From ¶
CreateExt4From is CreateExt4 with the filesystem holding a copy of the files in dir. It needs e2fsprogs 1.43 or later.
Types ¶
This section is empty.