How Do I Stop Automount Of Hitichi Lifestudio USB Drive

Home » CentOS » How Do I Stop Automount Of Hitichi Lifestudio USB Drive
CentOS 9 Comments

Most of the time, if I plug a USB drive into my computer, gnome/CentOS/whatever will ask me what I want to do with it. With a Hitachi Lifestudio, all the partitions mount without asking me.

How do I stop that behavior?

My suspicion is that the same kind of mechanism is what makes candy drops work. So far as I know, my backup drive is not candy, but I would still like to be able to control my computer.

9 thoughts on - How Do I Stop Automount Of Hitichi Lifestudio USB Drive

  • Not sure, but if you made entries for it in /etc/fstab that explicitly said not to mount, that might do the trick.

    It looks as if the “noauto” option should do the trick.

    Fred

  • That might work. I could add 30 entries to fstab: /dev/sd[cde][1-9]

    My suspicion is that whatever is mounting the drive is treating it special and might ignore fstab. Ideally I’d learn the the name of the automounter and what database to edit.

  • Michael Hennebry wrote:

    autofs is what’s mounting it. But if you turn it off, you’ll have to manually mount anything that’s not in /etc/fstab.

    Sounds like gnome’s trying to be WinDoze….

    mark

  • Its not ‘autofs’ specifically (which is a simple thing) but udev talking to udisks, allowing your login session to use udisks to mount the volumes if allowed by PolicyKit, speaking through dbus.

    Yeah.


    Jonathan Billings

  • Am 13.08.2015 um 19:52 schrieb Michael Hennebry :

    Could you provide more context information?
    Appliance setup, Dekstop setup, server setup?
    There exist a lot scenarios where something happen automagically?

  • As I said earlier, this behavior isn’t autofs. Don’t blame autofs. autofs is a nice tool. autofs is easy to understand, enable and disable. To disable the auto-mounting of USB disks via udisks, you’d need to set up a custom udev rule. Of course, it’s hard to know which existing udev rule is catching your disk, as you said, behavior is different with an SD card than with a USB disk.

    For CentOS6, the udev configuration for udisks is:
    /lib/udev/rules.d/80-udisks.rules

    … while in CentOS7, the udisks2 udev config is:
    /usr/lib/udev/rules.d/80-udisks2.rules

    You’d put the custom rule in /etc/udev/rules.d/.

    These rules depend on the device name, vendor and model ID, drivers used, etc. You’d have to write a custom udev rule either for that particular device, or something more generic for that class of device.

    You might want to consider just disabling udisks{,2} entirely, if you don’t use the features.


    Jonathan Billings

  • I’ve been trying to read 80-udisks.rules with little success. Would posting it (242 lines) be helpful?
    After I plug in a drive, is there a way to discover what udev rule was applied?

  • udevadm test /sys/

    should give you a whole lot of output. This will include info about what rules apply to the device and actions that udev would take.

  • I did it twice, once with a USB SD card reader and once with another USB drive I discovered that the mount without asking behavior is not specific to Hitachi.

    Both experiments produced more than two hundred lines of output. Interpretation escapes me. I expect that posting them here would be considered rude. I did a grep -n apply on both of them.

    I did the test on the SD card reader while the what-to-do popup was visible:
    98:udev_rules_apply_to_event: RUN ‘socket:/org/kernel/dm/multipath_event’ /lib/udev/rules.d/40-multipath.rules:16
    99:udev_rules_apply_to_event: LINK ‘block/8:33’ /lib/udev/rules.d/50-udev-default.rules:3
    100:udev_rules_apply_to_event: GROUP 6 /lib/udev/rules.d/50-udev-default.rules:76
    110:udev_rules_apply_to_event: OWNER 0 /etc/udev/rules.d/60-libsane.rules:3
    111:udev_rules_apply_to_event: GROUP 100 /etc/udev/rules.d/60-libsane.rules:3
    112:udev_rules_apply_to_event: MODE 0664 /etc/udev/rules.d/60-libsane.rules:3
    114:udev_rules_apply_to_event: LINK ‘disk/by-id/usb-Generic_STORAGE_DEVICE_000000009451-0:0-part1’ /lib/udev/rules.d/60-persistent-storage.rules:55
    115:udev_rules_apply_to_event: LINK ‘disk/by-path/pci-0000:00:02.1-usb-0:9:1.0-scsi-0:0:0:0-part1’ /lib/udev/rules.d/60-persistent-storage.rules:76
    116:udev_rules_apply_to_event: IMPORT ‘/sbin/blkid -o udev -p /dev/sdc1’ /lib/udev/rules.d/60-persistent-storage.rules:90
    125:udev_rules_apply_to_event: LINK ‘disk/by-uuid/3DBE-2637’ /lib/udev/rules.d/60-persistent-storage.rules:100
    126:udev_rules_apply_to_event: RUN ‘udev-acl –action=$env{ACTION} –device=$env{DEVNAME}’ /lib/udev/rules.d/70-acl.rules:53
    127:udev_rules_apply_to_event: IMPORT ‘fstab_import sdc1 block/8:33 disk/by-id/usb-Generic_STORAGE_DEVICE_000000009451-0:0-part1 disk/by-path/pci-0000:00:02.1-usb-0:9:1.0-scsi-0:0:0:0-part1 disk/by-uuid/3DBE-2637 mapper/’ /lib/udev/rules.d/79-fstab_import.rules:1
    150:udev_rules_apply_to_event: IMPORT ‘udisks-part-id /dev/sdc1’ /lib/udev/rules.d/80-udisks.rules:87
    182:udev_rules_apply_to_event: RUN ‘socket:@/org/freedesktop/hal/udev_event’ /etc/udev/rules.d/90-hal.rules:2

    I did the test on the other after all the partitions had been mounted. Not much choice:
    98:udev_rules_apply_to_event: RUN ‘socket:/org/kernel/dm/multipath_event’ /lib/udev/rules.d/40-multipath.rules:16
    99:udev_rules_apply_to_event: LINK ‘block/8:34’ /lib/udev/rules.d/50-udev-default.rules:3
    100:udev_rules_apply_to_event: GROUP 6 /lib/udev/rules.d/50-udev-default.rules:76
    110:udev_rules_apply_to_event: OWNER 0 /etc/udev/rules.d/60-libsane.rules:3
    111:udev_rules_apply_to_event: GROUP 100 /etc/udev/rules.d/60-libsane.rules:3
    112:udev_rules_apply_to_event: MODE 0664 /etc/udev/rules.d/60-libsane.rules:3
    114:udev_rules_apply_to_event: LINK ‘disk/by-id/usb-WD_1200BB_External_57442D5743414C4B31343036323635-0:0-part2’ /lib/udev/rules.d/60-persistent-storage.rules:55
    115:udev_rules_apply_to_event: LINK ‘disk/by-path/pci-0000:00:02.1-usb-0:9:1.0-scsi-0:0:0:0-part2’ /lib/udev/rules.d/60-persistent-storage.rules:76
    116:udev_rules_apply_to_event: IMPORT ‘/sbin/blkid -o udev -p /dev/sdc2’ /lib/udev/rules.d/60-persistent-storage.rules:90
    124:udev_rules_apply_to_event: LINK ‘disk/by-uuid/f9bda2dd-8e62-4493-a612-3582f8e639f5’ /lib/udev/rules.d/60-persistent-storage.rules:100
    125:udev_rules_apply_to_event: RUN ‘udev-acl –action=$env{ACTION} –device=$env{DEVNAME}’ /lib/udev/rules.d/70-acl.rules:53
    126:udev_rules_apply_to_event: IMPORT ‘fstab_import sdc2 block/8:34 disk/by-id/usb-WD_1200BB_External_57442D5743414C4B31343036323635-0:0-part2 disk/by-path/pci-0000:00:02.1-usb-0:9:1.0-scsi-0:0:0:0-part2 disk/by-uuid/f9bda2dd-8e62-4493-a612-3582f8e639f5 mapper/’ /lib/udev/rules.d/79-fstab_import.rules:1
    149:udev_rules_apply_to_event: IMPORT ‘udisks-part-id /dev/sdc2’ /lib/udev/rules.d/80-udisks.rules:87
    194:udev_rules_apply_to_event: RUN ‘socket:@/org/freedesktop/hal/udev_event’ /etc/udev/rules.d/90-hal.rules:2

    As before, interpretation escapes me.