tech:automount_montage_automatique_clef_usb
Table des matières
Automount montage automatique clef USB
Brouillon
Source :
Voir :
Voir aussi :
- udevil
- udisks2
- Autofs
- udisks-glue
- usbmount
Contexte
Pas d’environnement graphique.
Manip
Voir aussi udisks2
Hack avec la commande at. Voir notes_systemd_udev
apt-get install pmount
/etc/udev/rules.d/90-automount.rules
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/usr/local/bin/h_pmount.sh %k" ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/usr/local/bin/h_pumount.sh /dev/%k"
/usr/local/bin/h_pmount.sh
#! /bin/bash echo "/usr/bin/pmount -r $*" |at now
/usr/local/bin/h_pumount.sh
#! /bin/bash echo "/usr/bin/pumount $*" |at now
# udevadm control --reload udevadm control --reload-rules udevadm trigger
Notes
udevadm control --log-priority=err unbuffer udevadm monitor --environment
blkid -o value -s UUID /dev/sda1
usbmount
Source : https://github.com/rbrito/usbmount
Debug
Troubleshooting USBmount :
- Do you have HAL running ? Any GNOME or KDE daemon automounting devices ?
- Let's suppose that the partition containing the filesystem that you want USBmount to automatically handle is /dev/sda1 (your case may, quite possibly, vary). Then, check the result of the following command :
udevadm test --action=add /sys/class/block/sda1
The command above just gives diagnostics of what USBmount would do with the device, but it doesn't actually mount or interfere with the device. It is intended for debugging purposes. Be careful that it generates a lot of output. Many screens, depending on the device.
- Under the same assumptions as the above, another good diagnostic tool is the following :
udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)
Autres
Remounting filesystems without physical removal
udevadm trigger --action=add /dev/sdd2
Plop
/etc/udev/rules.d/automount.rules
# automounting usb flash drives # umask is used to allow every user to write on the stick # we use --sync in order to enable physical removing of mounted memory sticks -- this is OK for fat-based sticks # I don't automount sda since in my system this is the internal hard drive # depending on your hardware config, usb sticks might be other devices than sdb* #SUBSYSTEMS=="usb",ACTION=="add",KERNEL=="sd[b-z][1-9]", RUN+="/usr/bin/pmount --sync --umask 000 %k" SUBSYSTEMS=="usb",ACTION=="add",KERNEL=="sd[b-z][1-9]", RUN+="/usr/bin/pmount --read-only --charset utf8 %k" SUBSYSTEMS=="usb",ACTION=="remove", KERNEL=="sd[b-z][1-9]", RUN+="/usr/bin/pumount %k"
/etc/udev/rules.d/automount.rules
ACTION=="add",KERNEL=="sd[a-z][0-9]",RUN+="/usr/bin/pmount -r 000 %k" ACTION=="remove",KERNEL=="sd[a-z][0-9]",RUN+="/usr/bin/pumount /dev/%k" ACTION=="add", KERNEL=="sd[b-z]*", PROGRAM="/bin/sh -c '/bin/sleep 2; /sbin/blkid -c /dev/null -s UUID -o value /dev/%k", RUN+="/bin/sh -c '/bin/sleep 3 ; /usr/bin/pmount -r --charset utf8 %c'" ACTION=="remove", KERNEL=="sd[b-z]*", RUN+="/usr/bin/pumount %k"
tech/automount_montage_automatique_clef_usb.txt · Dernière modification : de Jean-Baptiste
