automount USB on Debian?
Hi,
I was wondering if someone could shed some light on what im trying to do. I was reading many tutorials others say though fstab and udev. Im trying to automount the usb to /media/usb2 automatically when the usb connects. This is what i go so far on fstab Code:
/dev/disk/by-label/mylabelname /media/usb2 ntfs defaults,noauto 0 0 Code:
SUBSYSTEMS=="block", ENV{ID_FS_LABEL}=="mylabelname", RUN+="/bin/mount /dev/disk/by-label/mylabelname" but it im getting and error on the fstab any ideas? Thank you |
Try changing "noauto" to "auto."
This is a shot in the dark: I know "auto" works on boot, but I've never tested it on a system that's already booted. |
Thanks for the reply, unfortunately did not work i tried this
added on fstab Quote:
Quote:
Thank you |
what do you desire?
|
Thanks for the reply, the idea is that the usb will be doing backups weekly. so when i connect the usb to the Debian machine should automatic mount the usb to the folder. Then a script i created will execute the backup to that usb and finally it will unmounted it, then the next day i remove it.
Thank you |
i think you want a udev rule.
search for articles on how to write udev rules; maybe this: http://dt.iki.fi/udev/ |
I don't see why this wouldn't work in fstab
Quote:
|
Quote:
Code:
nano /etc/udev/rules.d/11-externalusb.rules Code:
ACTION=="add", SUBSYSTEM=="usb", \ Code:
mount /media/usb2 Code:
/etc/init.d/udev restart |
Quote:
|
"no luck" doesn't really cut it, sorry.
udev rules are tricky and require testing; you can't just jump in with your full-blown solution, you have to start with a test script, use the udev monitoring utility etc. etc. do some research, and spend a little more time on this. ultimately, it is definitely possible to use udev to achieve what you want. 100% sure of that. comments on your attempt: - an executable script should not be in /media. put it in ~/bin or /usr/local/bin instead. - not sure which distro you use, but shouldn't you be using systemd commands (instead of init.d...)? good luck. if you ask for more help, post a full report of what you did, commands issued and output received. |
Did you ever try just adding the users option so that users can mount/unmount and changing the rights on the script so it runs as your user (thus having it automounted as yourself so you can unmount it)?
|
Quote:
|
Quote:
Code:
UUID=7462E08062E04886 /media/usb2 ntfs noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=2,x-systemd.device-timeout=2 |
All times are GMT -5. The time now is 01:47 PM. |