Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
I don't see why this wouldn't work in fstab and put in the script to unmount it when it's done.
the issue for that is that only applies if it gets rebooted the server the idea is that the usb is going to be disconnect and reconnected every week. and it has to be noauto instead of auto because if the usb is not attached its going to get stuck on fstab.
"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)?
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)?
Thanks for the reply, the user is only going to connect the usb and the rsync does automatic the backup.
"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.
Thanks for the reply, as i have tried for the past month and could not get it working, as for the commands in the above post all other tutorials are the same and none of them worked the only one which was was adding this to fstab
But the issue as i said before i cant unmount safely. the distro im using is Debian Jessie, and the script is rsync which was duly noted as i changed the location to what you recommended. All I ask is what am i doing wrong from the above commands on post (number 8)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.