Skip to content

Use BindsTo dependency for mounting Removable storage devices (i.e USB) #1359

Open
RushingAlien/udisks
#1
@RushingAlien

Description

@RushingAlien

Description

Currently mount units has a Requires dependency against the block device or backing file specified under What. This is not desirable for usecases where backing file or block device can be easily detached, which may cause lingering mounts on some filesystems (i.e BTRFS). Examples are USB storage, NBDs, and loop devices.

I have seen this myself because I use BTRFS for my USB drive, where accidental detaching causes a lingering mount.

Stuff outside of fstab are given ephemeral mount units and as I am aware has no way to set a BindsTo directive other than mounting via systemd-mount. Or by adding mount unit overrides.

For stuff in fstab you can use x-systemd.device-bound in the mount option.

Desired Outcome

For udisks to mount usb devices with a BindsTo relationship against the block device.

Note on Lingering Mounts

Not all filesystems are susceptible to lingering mounts
filesytems susceptible to lingering mounts (mounted, but block device is disconnected)

  • btrfs
  • any filesystem using nbd

I believe there are more, but those are just the ones I know.

Related

systemd/systemd#36634
https://www.freedesktop.org/software/systemd/man/latest/systemd.mount.html
https://www.freedesktop.org/software/systemd/man/latest/systemd-mount.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions