Please note the new address for this forum : forum.excito.org. The old address redirects here but I don't know for how long. Thanks !
New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !
Auto mounting / connecting USB disks
Auto mounting / connecting USB disks
Hi! I have browsed the forums and web but can't seem to find a pretty solution to automount usb disks.
Challange:
Everytime I reconnect a USB device I first need to "connect" the device through the Settings in the webfrontend. Ideally I'd like to have this plug & play - You insert the USB drive and it becomes available instantly under /home/storage/extern/[drivename]
Solution options I have found/tried:
1.) Autofs - Seems to be the way to go but is not supported by the standard kernel of the B3. As such even apt-get install autofs fails. Compiling a new kernel seems a bit daunting...
2.)am-utils - Looks like it should do the job as a module but appears hard to configure (?)
3.)Other options mentioned in the forum like USBmount and iv.... have been touched/developed last in 2007 so seem out of date.
Long story short, how do I best set this up? Do I REALLY need to recompile my kernel?
On the side: Why would you not automount usb drives by default anyway as in Windows??? Especially since the computer detects and identifies the drives correctly. (How good would be a checkbox next to each drive that just says "Automount?", you just tick the box and all mounting is done for you going fwd...)
Thanks
Frank
Challange:
Everytime I reconnect a USB device I first need to "connect" the device through the Settings in the webfrontend. Ideally I'd like to have this plug & play - You insert the USB drive and it becomes available instantly under /home/storage/extern/[drivename]
Solution options I have found/tried:
1.) Autofs - Seems to be the way to go but is not supported by the standard kernel of the B3. As such even apt-get install autofs fails. Compiling a new kernel seems a bit daunting...
2.)am-utils - Looks like it should do the job as a module but appears hard to configure (?)
3.)Other options mentioned in the forum like USBmount and iv.... have been touched/developed last in 2007 so seem out of date.
Long story short, how do I best set this up? Do I REALLY need to recompile my kernel?
On the side: Why would you not automount usb drives by default anyway as in Windows??? Especially since the computer detects and identifies the drives correctly. (How good would be a checkbox next to each drive that just says "Automount?", you just tick the box and all mounting is done for you going fwd...)
Thanks
Frank
Re: Auto mounting / connecting USB disks
[Bump] ...nobody - c'mon surely this is doable on the B3?
Re: Auto mounting / connecting USB disks
Alright... after 2 hours of research step 1 is solved - the autofs4 module is installed without recompiling the entire kernel. (That doesn't necessarily mean the USB auto mount will be working though...)
NO GUARANTEES THIS WORKS!!! But...
install the autofs module as described in the following links (I had to read both to get it):
http://forum.excito.net/viewtopic.php?p=7877
and
http://www.pixelbeat.org/docs/rebuild_k ... odule.html (for Fedora, but works almost 1:1)
If you run into issues check with for the last couple of errors and if the error is that the vermagic string is wrong, set the version of your kernel exactly by editing the Makefile file in nano. Then you have to run through the entire make sequence again.
Anyway, have attached the autofs4.ko for kernel version 2.6.39.4-9
In theory you should be able to download and then do an insmod /your/downloaded/dir/autofs4.ko and it might work.
Maybe one of the pro's can comment what the risks of that procedure are... I am not sure.
Cheers
Frank
NO GUARANTEES THIS WORKS!!! But...
install the autofs module as described in the following links (I had to read both to get it):
http://forum.excito.net/viewtopic.php?p=7877
and
http://www.pixelbeat.org/docs/rebuild_k ... odule.html (for Fedora, but works almost 1:1)
If you run into issues check with
Code: Select all
dmesg | less
Anyway, have attached the autofs4.ko for kernel version 2.6.39.4-9
In theory you should be able to download and then do an insmod /your/downloaded/dir/autofs4.ko and it might work.
Maybe one of the pro's can comment what the risks of that procedure are... I am not sure.
Cheers
Frank
- Attachments
-
- autofs4.ko_for_linux_2.6.39.4-9.zip
- (12.43 KiB) Downloaded 619 times
Re: Auto mounting / connecting USB disks
Well, the issue here would be the reliability of the source of this file (i.e. You).
But yes, you are correct that the kernel source holds an error that causes the version magic to be incorrect. This is controlled by the Makefile and you should change that directly after pulling in the source (before doing anything else that will cause the wrong version to be stamped in generated scripts).
But yes, you are correct that the kernel source holds an error that causes the version magic to be incorrect. This is controlled by the Makefile and you should change that directly after pulling in the source (before doing anything else that will cause the wrong version to be stamped in generated scripts).
Re: Auto mounting / connecting USB disks
You could change the version when doing the make menuconfig since it is an configuration setting.
"General Setup -> Local version"
"General Setup -> Local version"
Re: Auto mounting / connecting USB disks
Hi!
Need please some help by adding autofs into b3...
I installed autofs with errors and tried to fix them, but its wont work.
(im using google/ forum.excito search =>
http://forum.excito.net/viewtopic.php?p=7877
and
http://www.pixelbeat.org/docs/rebuild_k ... odule.html
but i dont know whats to do)
Than i tried to install amd from am-utils, but thats to complex for me.
I need to mount my esata (Dockingstation) only when i access this device (unmount time 2 seconds e.g.).
I`m edit the minidlna.conf
Now i can mount the esata on Webpage and start a scan with ...
The scanner dont like one special bluray folder by scanning my HDDs, this one Bluray folder freez my B3. I moved this 20GB folder and the scan finished with no errors.
Now i need an Automounter thats start an "minidlna -R" on mounting too (e.g. command in fstab).
So please can anyone tell me step by step whats to do to get autofs running on an up to date b3?
I know how to configure autofs, thats not the problem...
Thank you very very well!
(sorry for my bad english!)
EDIT:
Hi Community,
is this way right?
Maybe someone can help me to find my mistake...?!...
Thanks a lot!
Need please some help by adding autofs into b3...
I installed autofs with errors and tried to fix them, but its wont work.
(im using google/ forum.excito search =>
http://forum.excito.net/viewtopic.php?p=7877
and
http://www.pixelbeat.org/docs/rebuild_k ... odule.html
but i dont know whats to do)
Than i tried to install amd from am-utils, but thats to complex for me.

I need to mount my esata (Dockingstation) only when i access this device (unmount time 2 seconds e.g.).
I`m edit the minidlna.conf
Code: Select all
media_dir=A,/home/storage/extern
media_dir=V,/home/storage/extern
media_dir=P,/home/storage/extern
media_dir=A,/home/storage/music
media_dir=V,/home/storage/video
media_dir=P,/home/storage/pictures
Code: Select all
minidlna -R (more infos in debug mode "-d"
The scanner dont like one special bluray folder by scanning my HDDs, this one Bluray folder freez my B3. I moved this 20GB folder and the scan finished with no errors.
Now i need an Automounter thats start an "minidlna -R" on mounting too (e.g. command in fstab).
So please can anyone tell me step by step whats to do to get autofs running on an up to date b3?
I know how to configure autofs, thats not the problem...
Thank you very very well!
(sorry for my bad english!)

EDIT:
Hi Community,
is this way right?
Code: Select all
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.4.tar.gz (cat /proc/version says 2.6.39.4-11)
tar xzf linux-2.6.39.4.tar.gz
cd linux-2.6.39.4
cp /proc/config.gz .
gunzip config.gz
cp config .config
nano .config
# changes
CONFIG_AUTOFS_FS=m
CONFIG_AUTOFS4_FS=m
$ make modules
$ mkdir /lib/modules/2.6.39.4-11/kernel/fs/autofs
$ mkdir /lib/modules/2.6.39.4-11/kernel/fs/autofs4
$ cp -v fs/autofs/autofs.ko /lib/modules/2.6.39.4-11/kernel/fs/autofs/autofs.ko (there is no file autofs.ko)
$ cp -v fs/autofs4/autofs4.ko /lib/modules/2.6.39.4-11/kernel/fs/autofs4/autofs4.ko (copy this file ok)
$ depmod -a (OK)
$ modprobe autofs4 (FATAL: Error inserting autofs4 (/lib/modules/2.6.39.4-11/kernel/fs/autofs4/autofs4.ko): Invalid module format) [WHATS WRONG HERE?]
$ /etc/init.d/autofs restart
Stopping automounter: done.
Starting automounter: done.
Thanks a lot!
Re: Auto mounting / connecting USB disks
Not an answer to the autofs problem, but maybe for others that are looking for a different way to automount USB/FLASH drives...
I use a udev rule to automount USB/FLASH drives without the need of autofs.
unfortunately the forum doesn't let me post the rule I am using...as my 'post looks too spamy for a new user'
I use a udev rule to automount USB/FLASH drives without the need of autofs.
unfortunately the forum doesn't let me post the rule I am using...as my 'post looks too spamy for a new user'
Re: Auto mounting / connecting USB disks
OK Lymon,
Now you're a normal user. Please post your stuff
Martijn
Now you're a normal user. Please post your stuff

Martijn
Re: Auto mounting / connecting USB disks
> Now you're a normal user. Please post your stuff
I tried, but I still can't post the code...still 'too spamy'
I tried, but I still can't post the code...still 'too spamy'
Last edited by lymon on 10 Feb 2014, 10:01, edited 2 times in total.
-
- Posts: 904
- Joined: 09 Oct 2009, 18:49
Re: Auto mounting / connecting USB disks
+1 for using udev, it's very flexible. Long time ago before online backups I had a udev rule that, when I plugged in my external hard drive, it automatically triggered a script that backed up my /home/storage to the drive and then dismounted it again.
Re: Auto mounting / connecting USB disks
Sorry Lymon,
The button on the moderator panel doesn't seem to work as I intend it to do. I guess you have to make some more posts and gain a normal usewr status.
Martijn
The button on the moderator panel doesn't seem to work as I intend it to do. I guess you have to make some more posts and gain a normal usewr status.
Martijn
Re: Auto mounting / connecting USB disks
I figured I'd take a look at that udev option and found some blog hinting this same solution for Arch Linux. I adapted the code to match the usual behaviour when mounting the disk through the B2|3 admin pages and made some modifications to support a USB cdrom device and use Windows character encoding on vfat.
Note that if you have an esata drive connected you should change the range [b-z] on the 4th line to [c-z]
Code: Select all
# /etc/udev/rules.d/10-automount.rules
# start at sdb to ignore the system hard drive
KERNEL!="sd[b-z]*", GOTO="automount_end"
# verify that the device contains media
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="automount_end"
# set some defaults
ENV{mount_path}="/home/storage/extern"
ENV{mount_options}="relatime"
ENV{file_system_type}="auto"
# import filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"
# get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usb-%k"
# filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", ENV{mount_options}="$env{mount_options},codepage=850,iocharset=iso8859-1"
# can't use auto when mounting these file systems
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", ENV{file_system_type}="ntfs-3g"
ACTION=="add", ENV{ID_FS_TYPE}=="iso9660", ENV{file_system_type}="iso9660"
# create mountpoint and mount the filesystem
ACTION=="add", RUN+="/bin/mkdir -p '%E{mount_path}/%E{dir_name}'", RUN+="/bin/mount -t %E{file_system_type} -o %E{mount_options} /dev/%k '%E{mount_path}/%E{dir_name}'"
# clean up after device removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '%E{mount_path}/%E{dir_name}'", RUN+="/bin/rmdir '%E{mount_path}/%E{dir_name}'"
# exit
LABEL="automount_end"
Re: Auto mounting / connecting USB disks
yes, that's similar to the rule that I use.
Works like a charm
Works like a charm
Re: Auto mounting / connecting USB disks
I Agree. Worked just fine in the tests that I did (do not own a USB cdrom drive myself, so that part is kind of open). Must note though that pulling a USB device out before properly dismounting it, is not a really wise thing to do if you wrote any data to it while it was connected.