org.freedesktop.UDisks2.Filesystem

org.freedesktop.UDisks2.Filesystem — Block device containing a mountable filesystem

Methods

SetLabel      (IN  s     label,
               IN  a{sv} options);
SetUUID       (IN  s     uuid,
               IN  a{sv} options);
Mount         (IN  a{sv} options,
               OUT s     mount_path);
Unmount       (IN  a{sv} options);
Resize        (IN  t     size,
               IN  a{sv} options);
Check         (IN  a{sv} options,
               OUT b     consistent);
Repair        (IN  a{sv} options,
               OUT b     repaired);
TakeOwnership (IN  a{sv} options);

Properties

MountPoints  readable   aay
Size         readable   t

Description

This interface is used for org.freedesktop.UDisks2.Block devices that contain a mountable filesystem.

Method Details

The SetLabel() method

SetLabel (IN  s     label,
          IN  a{sv} options);

Sets the filesystem label.

IN s label:

The label to set.

IN a{sv} options:

Options (currently unused except for standard options).


The SetUUID() method

SetUUID (IN  s     uuid,
         IN  a{sv} options);

Sets the filesystem UUID value.

IN s uuid:

The UUID to set.

IN a{sv} options:

Options (currently unused except for standard options).

Since 2.10.0


The Mount() method

Mount (IN  a{sv} options,
       OUT s     mount_path);

Mounts the filesystem.

The directory the filesystem will be mounted in is determined by looking at data related to the device or filesystem (such the filesystem UUID and label) and will be created automatically except if the device the filesystem resides on is referenced in the /etc/fstab file, see below. In either case, the directory the filesystem is mounted in, is returned in mount_path on success - it is usually a sub-directory of /run/media/$USER but note that any directory may be returned.

The filesystem type to use can be overridden with the fstype option and mount options (a comma-separated string) can be given in options option. Note that both the mount options and filesystem types are validated against a (small) whitelist to avoid unexpected privilege escalation. The filesystem type is by default determined by the "IdType" property. The fstype option doesn't typically need to be specified, primarily intended as an override in corner cases.

If the as-user option is set, the filesystem is mounted on behalf of the specified user instead of the calling one. This has usually an effect on the returned mount_path and it also allows that user to unmount the filesystem later. This option expects a user name, not a UID.

If the device in question is referenced in the /etc/fstab file, the mount command is called directly (as root) and the given options or filesystem type given in options are ignored.

If x-udisks-auth is specified as an option for the device in the /etc/fstab file, then the mount command is run as the calling user, without performing any authorization check mentioned above. If this fails because of insufficient permissions, an authorization check is performed (which typically results in the user having to authenticate as an administrator). If authorized, the mount command is then run as root.

The filesystem should be unmounted using the Unmount() method.

If the device is removed without being unmounted (e.g. the user yanking the device or pulling the media out) or unmounted in a way that bypasses the Unmount() method (e.g. unmounted by the super-user by using the umount(8) command directly), the device will be unmounted (if needed) and/or the mount point will be cleaned up.

IN a{sv} options:

Options - known options (in addition to standard options) includes fstype (of type 's'), as-user (of type 's') and options (of type 's').

OUT s mount_path:

The filesystem path where the device was mounted.


The Unmount() method

Unmount (IN  a{sv} options);

Unmount a mounted device.

If the device in question was mounted by the calling user via the Mount() method the filesystem is unmounted without any authorization checks. Otherwise, an authorization check is performed (which typically results in the user having to authenticate as an administrator). If authorized, the filesystem is unmounted.

If the mountpoint was previously created by udisks it is guaranteed it will be removed upon returning from this method call.

If the filesystem is busy, this operation fails with the error org.freedesktop.UDisks2.Error.DeviceBusy unless the force option is used.

IN a{sv} options:

Options - known options (in addition to standard options) includes force (of type 'b').


The Resize() method

Resize (IN  t     size,
        IN  a{sv} options);

Resizes the filesystem.

Shrinking operations need to move data which causes this action to be slow. The filesystem-resize job for the object might expose progress.

IN t size:

The target size in bytes, 0 for maximum.

IN a{sv} options:

Options (currently unused except for standard options).

Since 2.7.2


The Check() method

Check (IN  a{sv} options,
       OUT b     consistent);

options: Options (currently unused except for standard options). consistent: Whether the filesystem is undamaged. since: 2.7.2

Checks the filesystem for consistency avoiding any modifications or repairs.

Mounted or unsupported filesystems will result in an error.

IN a{sv} options:

OUT b consistent:


The Repair() method

Repair (IN  a{sv} options,
        OUT b     repaired);

options: Options (currently unused except for standard options). repaired: Whether the filesystem could be successfully repaired. since: 2.7.2

Tries to repair the filesystem.

Mounted or unsupported filesystems will result in an error.

IN a{sv} options:

OUT b repaired:


The TakeOwnership() method

TakeOwnership (IN  a{sv} options);

options: Options (in addition to standard options) includes recursive (of type 'b'). since: 2.7.2

Changes ownership of the filesystem to the UID and GID of the calling user.

Filesystems that don't support ownership result in an error.

IN a{sv} options:

Property Details

The "MountPoints" property

MountPoints  readable   aay

An array of filesystems paths for where the file system on the device is mounted. If the device is not mounted, this array is empty.


The "Size" property

Size  readable   t

The size of the filesystem. This is the amount of

bytes used on the block device representing an outer filesystem boundary. If this is smaller than org.freedesktop.Udisks2.Block.Size, then the filesystem can be made larger with Resize.

If the size is unknown, the property is zero. Currently limited to xfs and ext filesystems only.

Please note that reading value of this property typically causes some I/O to read the filesystem superblock. Unlike the rest of the properties this one is set to be retrieved on-demand and is not proactively cached by the daemon.