GNU/Linux >> Znalost Linux >  >> Ubuntu

Použití Udev k automatickému připojení externího HDD?

Právě jsem nainstaloval Plex Media Server do svého linuxového boxu a jsem spokojený s myšlenkou serveru. Můj problém je ve skutečnosti, že Plex neobjevuje ŽÁDNÝ ze souborů na mém externím pevném disku. Dotyčný disk je Western Digital My Passport (500 GB) naformátovaný na NTFS a má na něm již asi 200+ koncertů filmů.

Po prohledání fór Plex jsem zjistil, že nemám správná oprávnění k souboru pro server Plex pro přístup k jednotce. Při hledání odpovědí jsem se dostal dostatečně daleko, abych zjistil, že pravidlo udev je moje nejlepší volba (použití fstab nepřipadá v úvahu, koneckonců disk je VYJÍMATELNÝ. 🙂 ). Dostal jsem se dokonce tak daleko, že jsem sepsal většinu pravidla; prostě to není automatické připojení (jako když připojím disk, připojí se k normálnímu přípojnému bodu Ubuntu /media/$USERNAME/My Passport/). 🙁

Zde je to, co zatím ve svém pravidle mám:

/etc/udev/rules.d/71-my-passport.rules

KERNEL=="sd?[0-9]", ATTRS{manufacturer}=="Western Digital", ATTRS{product}=="My Passport 0748", ACTION=="add", RUN+="mount -o dmask=007,fmask=117,gid=1001,uid=1000 /dev/%k /media/My Passport/"

Další náhodné věci:

blkid

/dev/sda1: UUID="d3ebc281-e885-4770-9ef9-f69651f54a12" TYPE="ext4" 
/dev/sda5: UUID="3569aee9-c16a-49ad-ba03-199180c59f60" TYPE="swap" 
/dev/sdb1: LABEL="My Passport" UUID="948251618251493E" TYPE="ntfs"

udevadm info -a -n /dev/sdb1

Udevadm info starts with the device specified by the devpath and then

kráčí po řetězci nadřazených zařízení. Vytiskne se pro každé
nalezené zařízení, všechny možné atributy ve formátu klíče pravidel udev.
Odpovídající pravidlo může být složeno z atributů zařízení
a atributů od jednoho rodiče zařízení.

looking at device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb/sdb1':
KERNEL=="sdb1"
SUBSYSTEM=="block"
DRIVER==""
ATTR{ro}=="0"
ATTR{size}=="976705536"
ATTR{stat}=="     389    30494    32584     3040        0        0        0        0        0     1180     3040"
ATTR{partition}=="1"
ATTR{start}=="2048"
ATTR{discard_alignment}=="0"
ATTR{alignment_offset}=="0"
ATTR{inflight}=="       0        0"

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb':
KERNELS=="sdb"
SUBSYSTEMS=="block"
DRIVERS==""
ATTRS{ro}=="0"
ATTRS{size}=="976707584"
ATTRS{stat}=="     467    30494    33208     3084        0        0        0        0        0     1224     3084"
ATTRS{range}=="16"
ATTRS{discard_alignment}=="0"
ATTRS{events}==""
ATTRS{ext_range}=="256"
ATTRS{events_poll_msecs}=="-1"
ATTRS{alignment_offset}=="0"
ATTRS{inflight}=="       0        0"
ATTRS{removable}=="0"
ATTRS{capability}=="50"
ATTRS{events_async}==""

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0':
KERNELS=="14:0:0:0"
SUBSYSTEMS=="scsi"
DRIVERS=="sd"
ATTRS{rev}=="1019"
ATTRS{type}=="0"
ATTRS{scsi_level}=="7"
ATTRS{model}=="My Passport 0748"
ATTRS{state}=="running"
ATTRS{queue_type}=="none"
ATTRS{iodone_cnt}=="0x1fb"
ATTRS{iorequest_cnt}=="0x1fb"
ATTRS{timeout}=="30"
ATTRS{evt_media_change}=="0"
ATTRS{max_sectors}=="240"
ATTRS{ioerr_cnt}=="0x1"
ATTRS{queue_depth}=="1"
ATTRS{vendor}=="WD      "
ATTRS{device_blocked}=="0"
ATTRS{dh_state}=="detached"
ATTRS{iocounterbits}=="32"

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0':
KERNELS=="target14:0:0"
SUBSYSTEMS=="scsi"
DRIVERS==""

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14':
KERNELS=="host14"
SUBSYSTEMS=="scsi"
DRIVERS==""

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0':
KERNELS=="1-1.1:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="usb-storage"
ATTRS{bInterfaceClass}=="08"
ATTRS{bInterfaceSubClass}=="06"
ATTRS{bInterfaceProtocol}=="50"
ATTRS{bNumEndpoints}=="02"
ATTRS{supports_autosuspend}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"
ATTRS{interface}=="MSC Bulk-Only Transport"

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1':
KERNELS=="1-1.1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="1.1"
ATTRS{idVendor}=="1058"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{busnum}=="1"
ATTRS{devnum}=="12"
ATTRS{configuration}=="USB Mass Storage"
ATTRS{bMaxPower}=="500mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="80"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="1019"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="575832314336324C38343535"
ATTRS{version}==" 2.10"
ATTRS{urbnum}=="1578"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Western Digital"
ATTRS{removable}=="removable"
ATTRS{idProduct}=="0748"
ATTRS{bDeviceClass}=="00"
ATTRS{product}=="My Passport 0748"

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="01"
ATTRS{devpath}=="1"
ATTRS{idVendor}=="8087"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{busnum}=="1"
ATTRS{devnum}=="2"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="6"
ATTRS{bcdDevice}=="0000"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="310"
ATTRS{ltm_capable}=="no"
ATTRS{removable}=="fixed"
ATTRS{idProduct}=="0024"
ATTRS{bDeviceClass}=="09"

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="3"
ATTRS{bcdDevice}=="0308"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="0000:00:1a.0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="53"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 3.8.0-30-generic ehci_hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="EHCI Host Controller"

looking at parent device '/devices/pci0000:00/0000:00:1a.0':
KERNELS=="0000:00:1a.0"
SUBSYSTEMS=="pci"
DRIVERS=="ehci-pci"
ATTRS{irq}=="16"
ATTRS{subsystem_vendor}=="0x17aa"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0320"
ATTRS{companion}==""
ATTRS{consistent_dma_mask_bits}=="32"
ATTRS{dma_mask_bits}=="32"
ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
ATTRS{device}=="0x1e2d"
ATTRS{uframe_periodic_max}=="100"
ATTRS{msi_bus}==""
ATTRS{local_cpulist}=="0-3"
ATTRS{vendor}=="0x8086"
ATTRS{subsystem_device}=="0x3977"
ATTRS{numa_node}=="-1"
ATTRS{d3cold_allowed}=="1"

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""

udevadm test $(udevadm info -q cesta -n /dev/sdb1) 2>&1

run_command: calling: test
adm_test: version 175
This program is for debugging only, it does not run any program,
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

parse_file: reading '/lib/udev/rules.d/40-crda.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-gnupg.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-hplip.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-ia64.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-inputattach.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-libgphoto2-2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-libsane.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-ppc.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-usb-media-players.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-usb_modeswitch.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-virtualbox-dkms.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-virtualbox-guest-dkms.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-virtualbox.rules' as rules file
parse_file: reading '/lib/udev/rules.d/42-qemu-usb.rules' as rules file
parse_file: reading '/lib/udev/rules.d/50-firmware.rules' as rules file
parse_file: reading '/lib/udev/rules.d/50-udev-default.rules' as rules file
parse_file: reading '/lib/udev/rules.d/55-dm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/56-hpmud_support.rules' as rules file
parse_file: reading '/lib/udev/rules.d/56-lvm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-btrfs.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-cdrom_id.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-pcmcia.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-alsa.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-input.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-serial.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage-dm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage-lvm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage-tape.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-v4l.rules' as rules file
parse_file: reading '/lib/udev/rules.d/61-accelerometer.rules' as rules file
parse_file: reading '/lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules' as rules file
parse_file: reading '/lib/udev/rules.d/64-xorg-xkb.rules' as rules file
parse_file: reading '/lib/udev/rules.d/66-xorg-synaptics-quirks.rules' as rules file
parse_file: reading '/lib/udev/rules.d/69-cd-sensors.rules' as rules file
add_rule: IMPORT found builtin 'usb_id', replacing /lib/udev/rules.d/69-cd-sensors.rules:85
parse_file: reading '/lib/udev/rules.d/69-libmtp.rules' as rules file
parse_file: reading '/lib/udev/rules.d/69-xorg-vmmouse.rules' as rules file
parse_file: reading '/lib/udev/rules.d/69-xserver-xorg-input-wacom.rules' as rules file
parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as rules file
parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-power-switch.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-printers.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-uaccess.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-udev-acl.rules' as rules file
parse_file: reading '/etc/udev/rules.d/71-my-passport.rules' as rules file
parse_file: reading '/lib/udev/rules.d/71-seat.rules' as rules file
parse_file: reading '/lib/udev/rules.d/73-seat-late.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-cd-aliases-generator.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-net-description.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-persistent-net-generator.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-probe_mtd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-tty-description.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-ericsson-mbm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-longcheer-port-types.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-nokia-port-types.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-platform-serial-whitelist.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-qdl-device-blacklist.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-simtech-port-types.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-usb-device-blacklist.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-x22x-port-types.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-mm-zte-port-types.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-nm-olpc-mesh.rules' as rules file
parse_file: reading '/lib/udev/rules.d/78-graphics-card.rules' as rules file
parse_file: reading '/lib/udev/rules.d/78-sound-card.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-btrfs-lvm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-drivers.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-mm-candidate.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-udisks.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-udisks2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-brltty.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-hdparm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-hplj10xx.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-keyboard-configuration.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-lvm2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-regulatory.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-usbmuxd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-alsa-restore.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-alsa-ucm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-libgpod.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-pulseaudio.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-cd-devices.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-keyboard-force-release.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-keymap.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-kpartx.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-udev-late.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-dell.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-fujitsu.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-gateway.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-ibm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-lenovo.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-toshiba.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-csr.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-hid.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-wup.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-bluetooth-hid2hci.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-dmraid.rules' as rules file
parse_file: reading '/lib/udev/rules.d/99-steam-controller-perms.rules' as rules file
udev_rules_new: rules use 304140 bytes tokens (25345 * 12 bytes), 48779 bytes buffer
udev_rules_new: temporary index used 83960 bytes (4198 * 20 bytes)
udev_device_new_from_syspath: device 0x7f5a65af2b70 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb/sdb1'
udev_device_new_from_syspath: device 0x7f5a65af58b0 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb/sdb1'
udev_device_read_db: device 0x7f5a65af58b0 filled with db file data
udev_device_new_from_syspath: device 0x7f5a65af7de0 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb'
udev_device_new_from_syspath: device 0x7f5a65af8610 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0'
udev_device_new_from_syspath: device 0x7f5a65af8e30 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0'
udev_device_new_from_syspath: device 0x7f5a65af9640 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14'
udev_device_new_from_syspath: device 0x7f5a65af9e30 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0'
udev_device_new_from_syspath: device 0x7f5a65afa620 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1'
udev_device_new_from_syspath: device 0x7f5a65afae10 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1'
udev_device_new_from_syspath: device 0x7f5a65afb600 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1'
udev_device_new_from_syspath: device 0x7f5a65afbde0 has devpath '/devices/pci0000:00/0000:00:1a.0'
udev_device_new_from_syspath: device 0x7f5a65afc590 has devpath '/devices/pci0000:00'
udev_rules_apply_to_event: GROUP 6 /lib/udev/rules.d/50-udev-default.rules:67
udev_device_read_db: device 0x7f5a65af7de0 filled with db file data
udev_rules_apply_to_event: LINK 'disk/by-id/usb-WD_My_Passport_0748_575832314336324C38343535-0:0-part1' /lib/udev/rules.d/60-persistent-storage.rules:46
udev_rules_apply_to_event: LINK 'disk/by-path/pci-0000:00:1a.0-usb-0:1.1:1.0-scsi-0:0:0:0-part1' /lib/udev/rules.d/60-persistent-storage.rules:64
udev_rules_apply_to_event: IMPORT '/sbin/blkid -o udev -p /dev/sdb1' /lib/udev/rules.d/60-persistent-storage.rules:75
udev_event_spawn: starting '/sbin/blkid -o udev -p /dev/sdb1'
spawn_read: '/sbin/blkid -o udev -p /dev/sdb1'(err) 'error: /dev/sdb1: Permission denied'
spawn_wait: '/sbin/blkid -o udev -p /dev/sdb1' [28479] exit with return code 2
udev_rules_apply_to_event: RUN 'mount -o dmask=007,fmask=117,gid=1001,uid=1000 /dev/%k /media/My Passport/' /etc/udev/rules.d/71-my-passport.rules:1
udev_rules_apply_to_event: IMPORT 'udisks-part-id /dev/sdb1' /lib/udev/rules.d/80-udisks.rules:88
udev_event_spawn: starting 'udisks-part-id /dev/sdb1'
spawn_read: 'udisks-part-id /dev/sdb1'(err) 'using device_file=/dev/sdb syspath=/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb, offset=1048576 ao=0 and number=1 for /dev/sdb1'
spawn_read: 'udisks-part-id /dev/sdb1'(err) 'Error opening /dev/sdb: Permission denied'
spawn_wait: 'udisks-part-id /dev/sdb1' [28480] exit with return code 0
udev_rules_apply_to_event: RUN '/sbin/modprobe -qba dm-multipath' /lib/udev/rules.d/95-kpartx.rules:10
udev_event_execute_rules: no node name set, will use kernel supplied name 'sdb1'
udev_node_update_old_links: update old name, '/dev/disk/by-label/Myx20Passport' no longer belonging to '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb/sdb1'
link_find_prioritized: found 'b8:17' claiming '/run/udev/links/diskx2fby-labelx2fMyx5cx20Passport'
link_update: no reference left, remove '/dev/disk/by-label/Myx20Passport'
udev_node_update_old_links: update old name, '/dev/disk/by-uuid/948251618251493E' no longer belonging to '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb/sdb1'
link_find_prioritized: found 'b8:17' claiming '/run/udev/links/diskx2fby-uuidx2f948251618251493E'
link_update: no reference left, remove '/dev/disk/by-uuid/948251618251493E'
udev_node_add: creating device node '/dev/sdb1', devnum=8:17, mode=0660, uid=0, gid=6
udev_node_mknod: preserve file '/dev/sdb1', because it has correct dev_t
udev_node_mknod: preserve permissions /dev/sdb1, 060660, uid=0, gid=6
node_symlink: preserve already existing symlink '/dev/block/8:17' to '../sdb1'
link_find_prioritized: found 'b8:17' claiming '/run/udev/links/diskx2fby-idx2fusb-WD_My_Passport_0748_575832314336324C38343535-0:0-part1'
link_update: creating link '/dev/disk/by-id/usb-WD_My_Passport_0748_575832314336324C38343535-0:0-part1' to '/dev/sdb1'
node_symlink: preserve already existing symlink '/dev/disk/by-id/usb-WD_My_Passport_0748_575832314336324C38343535-0:0-part1' to '../../sdb1'
link_find_prioritized: found 'b8:17' claiming '/run/udev/links/diskx2fby-pathx2fpci-0000:00:1a.0-usb-0:1.1:1.0-scsi-0:0:0:0-part1'
link_update: creating link '/dev/disk/by-path/pci-0000:00:1a.0-usb-0:1.1:1.0-scsi-0:0:0:0-part1' to '/dev/sdb1'
node_symlink: preserve already existing symlink '/dev/disk/by-path/pci-0000:00:1a.0-usb-0:1.1:1.0-scsi-0:0:0:0-part1' to '../../sdb1'
udev_device_update_db: unable to create temporary db file '/run/udev/data/b8:17.tmp': Permission denied
ACTION=add
DEVLINKS=/dev/disk/by-id/usb-WD_My_Passport_0748_575832314336324C38343535-0:0-part1 /dev/disk/by-path/pci-0000:00:1a.0-usb-0:1.1:1.0-scsi-0:0:0:0-part1
DEVNAME=/dev/sdb1
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host14/target14:0:0/14:0:0:0/block/sdb/sdb1
DEVTYPE=partition
ID_BUS=usb
ID_INSTANCE=0:0
ID_MODEL=My_Passport_0748
ID_MODEL_ENC=Myx20Passportx200748
ID_MODEL_ID=0748
ID_PART_TABLE_TYPE=dos
ID_PATH=pci-0000:00:1a.0-usb-0:1.1:1.0-scsi-0:0:0:0
ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_1_1_0-scsi-0_0_0_0
ID_REVISION=1019
ID_SERIAL=WD_My_Passport_0748_575832314336324C38343535-0:0
ID_SERIAL_SHORT=575832314336324C38343535
ID_TYPE=disk
ID_USB_DRIVER=usb-storage
ID_USB_INTERFACES=:080650:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=WD
ID_VENDOR_ENC=WDx20x20x20x20x20x20
ID_VENDOR_ID=1058
MAJOR=8
MINOR=17
SUBSYSTEM=block
UDEV_LOG=6
UDISKS_PRESENTATION_NOPOLICY=0
USEC_INITIALIZED=19772580387
run: 'mount -o dmask=007,fmask=117,gid=1001,uid=1000 /dev/sdb1 /media/My Passport/'
run: '/sbin/modprobe -qba dm-multipath'

Přijatá odpověď:

Možná, že adresář, kam se pokoušíte připojit svůj disk, není vytvořen (/media/MY PASSAPORT); zkuste změnit své pravidlo udev takto:

..., RUN+="/bin/mkdir -p /media/My_Passport", RUN+="/bin/mount -o dmask=007,fmask=117,gid=1001,uid=1000 /dev/%k /media/My_Passport/"

argument -p vám nedá chybu, pokud složka již existuje;
Změnil jsem vaše „připojení“ na „/bin/mount“ (takto to mám v pravidlech udev)
Také jsem změnil název adresáře, kam chcete připojit svůj disk (bez mezer; mezery je třeba escapovat); zkuste to takto

Související:Změna polohy rozlišení obrazovky? (Rozbitá obrazovka notebooku)?
Ubuntu
  1. Jak zakázat automatické připojení externích disků?

  2. Jak nastavit vlastní názvy zařízení pomocí udev v CentOS/RHEL 7

  3. Jak trvale nastavit hodnotu „dev_loss_tmo“ pomocí pravidla Udev

  1. Který shell používám?

  2. Bad Magic Number na externím HDD Superblock?

  3. Jak vytvořit externí samoopravné pole Btrfs USB HDD Raid 1?

  1. Stream to Discord pomocí Obs?

  2. Jak trvale nastavit nr_requests pomocí pravidel UDEV

  3. Použití pravidel udev ke spuštění skriptu při vložení USB