org.freedesktop.UDisks2.Filesystem

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

Methods

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

Properties

MountPoints  readable   aay

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 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

Mounting a file system is a privileged operation and before fulfilling the request, an authorization check for one of the two actions org.freedesktop.udisks2.filesystem-mount or org.freedesktop.udisks2.filesystem-mount-system is performed (the value of the "HintSystem" property is used to determine which one). The latter check typically results in the user having to authenticate as an administrator while the former typically doesn't require authentication if the caller is on a local console.

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. The authorization checks mentioned above are still performed.

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 of the authorization checks mentioned above. If this fails because of insufficient permissions, an authorization check is performed for the org.freedesktop.udisks2.filesystem-fstab action 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') 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 not mounted by the calling user via the Mount() method the filesystem is unmounted without any authorization checks. Otherwise, an authorization check is performed for the org.freedesktop.udisks2.filesystem-unmount-others action which typically results in the user having to authenticate as an administrator. If authorized, the filesystem is unmounted.

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').

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.