How does MyBook automount USB devices?
What daemon does it use?
How can I make MyBook mount all devices as 777 ?
Thanks.
How does MyBook automount USB devices?
What daemon does it use?
How can I make MyBook mount all devices as 777 ?
Thanks.
I don't think this is done with the mount procedure, rather via samba permissions or via user and group permissions. NTFS will only be mounted as read only, so if the external drive is NTFS, you won't be able to write to it.
The whitelight is fine with NTFS, but I don't think the blue ring works with it.
When I attach an external USB (FAT) HD, MyBook mounts it in the following manner:
[root@NAS01 ~]# tail -f /var/log/messages
Sep 7 18:43:31 NAS01 user.notice mount-external-drive[6191]: found the partitions sdc1
Sep 7 18:43:32 NAS01 user.notice mount-external-drive[6191]: no label
Sep 7 18:43:32 NAS01 user.notice mount-external-drive[6191]: partition sdc1 has label Partition-1
Sep 7 18:43:33 NAS01 user.notice mount-external-drive[6191]: Able to mount drive
[root@NAS01 ~]# mount
(rw,uid=33,gid=33,fmask=0111,dmask=0022,codepage=cp437,iocharset=iso8859-1)
[root@NAS01 ~]# ls -al /shares/external/
drwsr-sr-x 3 www-data www-data 4096 Sep 7 18:43 ST3500820AS
So, my questions were:
1. What daemon does MyBook use to automount USB devices?
2. How can I make MyBook mount all devices as rwxrwxrwx (and not rwsr-sr-x)? I.e. change uid, gid and, most important, mask?
Hello emmebiITA,
I have personnaly modified the automount scripts of the Blue ring on My Mybook, so that a specific HArd drive is always mounted under the same name (
because i have plugged several HArd drive of the same kind, they were mounting randomly under different names)
to do so, i have modified the
/etc/hotplug/mount-external-drive :
under the line : debug_mesg "Able to mount drive"
i have added a call to my own mount script
sh /etc/hotplug/mount-static-drive ${partition} ${temp_removal_script}
i pass as parameter of the script, the partition and the "removal script".
Removal script must be build by the mount-static-drive script to remove the mount and assoicated folder, so that when you unplug the drive, it is clean…
let me know if you need more info., i can also send you, as a sample script, my hotplug-static-drive script.
Note that i was keeping this info in mind with the idea to make a "USBDataTank" feature pack, but i never had time to do it…
I also was thinking of using this script to detect a plugged camera, in order to automatically download photos from the camera, when plugged to the Mybook…. (no time too to develop this small feature… )
Regards,
So far, I've done the following things in an attempt to automount an external ntfs drive with rw on usb and ended up with the results at the bottom of this post. I have upgraded the firmware to WD's 2.00.19 and miscellaneous other hacks like changing to the bluering optware feed and running ldconfig.
http://mybookworld.wikidot.com/forum/t-156303/mbwe-bluering-feed#post-1003748
I'm mainly wanting to upgrade to enable ntfs-3g. There's no easier way is there?
There is. The only thing you ultimately need is a sane fuse.ko kernel module, so you can just install it manually. This firmware is mainly designed for best optware experience, everything else comes as a "bonus" :)
Do this to install manually:
- mkdir -p /lib/modules/2.6.17.14/kernel/fs/fuse
- cd /lib/modules/2.6.17.14/kernel/fs/fuse
- wget http://mybookworld.wikidot.com/local--files/ldso-runpath-enabled-firmware/fuse.ko
- cd /lib/modules/2.6.17.14
- echo "alias char-major-10-229 fuse" » modules.alias
- echo "/lib/modules/2.6.17.14/kernel/fs/fuse/fuse.ko:" » modules.dep
http://mybookworld.wikidot.com/forum/t-156303/mbwe-bluering-feed#post-1007025
As for automounting using ntfs-3g, do the following:
1. Replace busybox's mount and umount with util-linux's ones (either install my firmware or get them from optware as described here)
- ipkg install util-linux-ng
- rm /bin/mount /bin/umount
- cp /opt/bin/util-linux-ng-mount /bin/mount
- cp /opt/bin/util-linux-ng-umount /bin/umount
2. Create /sbin/mount.ntfs mount helper link:
- ln -s /opt/bin/ntfs-3g /sbin/mount.ntfs-3g #for `mount -t ntfs-3g` to work properly
- ln -s mount.ntfs-3g /sbin/mount.ntfs
Results:
typing mount /dev/sdb1 gives me:
/dev/sdb1 on /shares/external type fuseblk (rw,user_id=0,group_id=0,default_permissions,allow_other)
even though the fstab entry is:
/dev/sdb1 /shares/external ntfs-3g rw,noauto,gid=33,uid=33 0 0
or:
/dev/sdb1 /shares/external auto rw,noauto,gid=33,uid=33 0 0
and the previous stock automount yielded:
/dev/sdb1 on /shares/external/WD-Ext-HDD-1021/Partition-1 type ntfs (ro,uid=33,gid=33,fmask=0111,dmask=077,nls=iso8859-1,errors=continue,mft_zone_multiplier=1)
So, now that my external ntfs usb drive mounts rw with fuse and ntfs-3g, in order to automount it, do I have to modify /etc/hotplug/mount-external-drive like TeinturMan above and add a custom script?
I noticed that optware's mount and umount depend on some libs provided by optware, so it's pretty unsafe to use them. Better install the ones I provide in my fw:
# cd /
# wget http://mybookworld.wikidot.com/local--files/ldso-runpath-enabled-firmware/mount.tar.gz
# rm -f /bin/mount /bin/umount
# tar -xzvf mount.tar.gz
# ldconfig
How do you mount the external drive with gid and uid 33 (www-data)?
I've created an fstab entry:
/dev/sdb1 /shares/external ntfs-3g rw,noauto,gid=33,uid=33 0 0
and even tried mounting manually with:
mount /dev/sdb1 -o uid=33,gid=33
but I still get:
/dev/sdb1 on /shares/external type fuseblk (rw,user_id=0,group_id=0,default_permissions,allow_other)
This is with stock firmware 2.00.19 and your firmware's mount/umount as mentioned in the last post above. Also, any idea what broke the automount after doing everything I posted above?
I don't now what could have broken automount (can only suggest it was replacing busybox's mount and umount), but ‘mount -t ntfs-3g -o uid=33,gid=33,fmask=0111,dmask=077` works fine, even though `mount` says it doesn’t: try `ls -l /shares/external` - it prints "www-data:www-data" ownerships for me.
UPD: yup, restoring busybox's mount brings automount back to life. Since it's pretty odd, I'll look into it…
:) I concur. I created symlinks back to busybox for mount and umount resulting in automount, of course, read only, but with the correct gid/uid reflected by 'mount'.
I still had this in /etc/fstab:
/dev/sdb1 /shares/external ntfs-3g rw,noauto,gid=33,uid=33 0 0
Also, with busybox, although,
mount /dev/sdb1 /shares/external -t ntfs-3g -o uid=33,gid=33,fmask=0111,dmask=077
gives:
mount: Mounting /dev/sdb1 on /shares/external failed: No such device
this,
ntfs-3g /dev/sdb1 /shares/external -o uid=33,gid=33,fmask=0111,dmask=077
resulted in correct mounting with the same incorrect status from "mount" but ls -l shows uid/gid 33 (www-data).
Yes wierd. Must be something special between /etc/hotplug/mount-external-drive and busybox? I wonder if TeintureMan's script addresses that.
As a workaround, you can let the original hot-plugging mechanism be and use a cron-job that makes use of it. This hasn't yet been tested, but you should be able to automount as many drives as you want to some specific locations using the script I shared here.
Just install mount and umount from my fw as '/bin/util-linux-mount' and '/bin/util-linux-umount' and edit the script to read lines starting with 'MOUNT=' and 'UMOUNT=' like this:
MOUNT=/bin/util-linux-mount
UMOUNT=/bin/util-linux-umount
P.S. like I said earlier, uid and gid options work just fine with ntfs-3g, this is simply not reflected in the output of `mount`
Ok, found a way to make automount work with util-linux's mount. Edit /etc/hotplug/mount-external-drive: change both occurrences of
mount -o move
mount --move
I'll probably have to add it to the ldso-runpath-enabled fw…