fstrim


Description:

[ Version ( since = "1.19.6" ) ]
public bool fstrim (string mountpoint, Fstrim? optargs) throws Error

trim free space in a filesystem

Trim the free space in the filesystem mounted on mountpoint. The filesystem must be mounted read-write.

The filesystem contents are not affected, but any free space in the filesystem is "trimmed", that is, given back to the host device, thus making disk images more sparse, allowing unused space in qcow2 files to be reused, etc.

This operation requires support in libguestfs, the mounted filesystem, the host filesystem, qemu and the host kernel. If this support isn't present it may give an error or even appear to run but do nothing.

In the case where the kernel vfs driver does not support trimming, this call will fail with errno set to ENOTSUP. Currently this happens when trying to trim FAT filesystems.

See also zero_free_space. That is a slightly different operation that turns free space in the filesystem into zeroes. It is valid to call fstrim either instead of, or after calling zero_free_space.

This function depends on the feature "fstrim". See also feature_available .

Parameters:

this

A GuestfsSession object

optargs

a GuestfsFstrim containing optional arguments

Returns:

true on success, false on error




2022 vala-language.org