Help mapping my NAS as USB drive

Discussions regarding FON's WiFi routers

Help mapping my NAS as USB drive

Postby NoRiCKaBe » Sun Jan 09, 2011 7:47 pm

Hi everyone!

I have recently bought a external HDD with NAS function.

After some test, i realized that copying files to the HDD is faster if I do it via NAS own function of the HDD than connecting it directly to the USB port of my Fonera 2N and using the fonera to share it to my local network.

As you image, I want to use this external HDD to download files on it with fonera's download manager.

My problem is that I cannot use my HDD as USB-HDD and have it's own NAS function at the same time. It only works as NAS or as USB-HDD.

I have tried to map de samba link of the NAS to /var/mounts/

I created a NAS called folder in /var/mounts, and it appears as selectable for dowloading files in Download Manager, so i think this stuff is possible to do.

The remaining problem is that I need to install a CIFS client to my Fonera and get it working to do the mapping stuff.

Any help with this?

Million thanks!!!!!!! And sorry for my poor english :oops:
NoRiCKaBe
 
Posts: 2
Joined: Sun Jan 09, 2011 7:30 pm

Re: Help mapping my NAS as USB drive

Postby Skynetbbs » Mon Jan 10, 2011 12:01 pm

Hi,

please install the following application from http://www.fonera.be/flash/FON2303/pack ... mipsel.ipk

cd /tmp
wget http://www.fonera.be/flash/FON2303/pack ... mipsel.ipk
opkg install kmod-fs-cifs

Let's try to mount a Cifs share on the remote pc 192.168.10.2 with sharename "terrabyte-share"
mkdir /mnt/cifs
mount -t cifs //192.168.10.2/terrabyte-share /mnt/cifs -o user=fonero,password=fonero
ls /mnt/cifs

I believe http://luci.subsignal.org/trac/browser/ ... luci-samba is a plugin that could be adapted to use this Kmod-fs-Cifs via the GUI
Perhaps Mathijs could tell us if this plugin would "work" ... as I'm unsure if Fon-NG even accepts FSTAB changes?
Skynetbbs
 
Posts: 564
Joined: Fri Apr 09, 2010 6:47 pm

Re: Help mapping my NAS as USB drive

Postby baro » Thu Jan 05, 2012 1:06 am

something isn't going right here:

root@Fonera:~# opkg install kmod-fs-cifs_2.6.21-fonera2n-1_mipsel.ipk
Installing kmod-fs-cifs (2.6.21-fonera2n-1) to root...
Collected errors:
* ERROR: Cannot satisfy the following dependencies for kmod-fs-cifs:
* kernel (=2.6.21-fonera2n-1) * kmod-nls-base *

root@Fonera:~# opkg install kmod-nls-base_2.6.21-fonera2n-1_mipsel.ipk
Installing kmod-nls-base (2.6.21-fonera2n-1) to root...
Collected errors:
* ERROR: Cannot satisfy the following dependencies for kmod-nls-base:
* kernel (=2.6.21-fonera2n-1) *

why is it complaining about my kernel? do I need to find another cifs version? I'm on 2.3.7.0beta2
baro
 
Posts: 25
Joined: Tue Aug 10, 2010 11:40 pm

Re: Help mapping my NAS as USB drive

Postby baro » Thu Jan 05, 2012 7:43 pm

forget it... I've been able to install cifs.... at least seems so :)
but after a reboot, lsmod | grep cifs doesn't find anything :roll:
baro
 
Posts: 25
Joined: Tue Aug 10, 2010 11:40 pm

Re: Help mapping my NAS as USB drive

Postby baro » Thu Jan 05, 2012 11:27 pm

demsg says "cifs: version magic '2.6.23.17 mod_unload MIPS32_R1 32BIT ' should be '2.6.21.7 mod_unload MIPS32_R1 32BIT"
any idea how to fix it?
baro
 
Posts: 25
Joined: Tue Aug 10, 2010 11:40 pm

Re: Help mapping my NAS as USB drive

Postby Matthijs » Tue Jan 10, 2012 11:49 am

Hmm, it looks like the kernel module is somehow compiled for the wrong kernel? Not sure how that happened. SkynetBBS, where did you get this kernel module from?
User avatar
Matthijs
 
Posts: 418
Joined: Fri Apr 09, 2010 6:47 pm

Re: Help mapping my NAS as USB drive

Postby Skynetbbs » Tue Jan 10, 2012 4:10 pm

this thread is >1year old...
I made this using a cvs export of the fonosfera buildchain at that time... in january 2011

perhaps with the new firmware of last augustus this doesn't work anymore
kernel problems at linux.org started also end of august, start of september.....
Skynetbbs
 
Posts: 564
Joined: Fri Apr 09, 2010 6:47 pm

Re: Help mapping my NAS as USB drive

Postby Matthijs » Tue Jan 10, 2012 4:40 pm

But AFAIK the 2.0n firmware has never used the 2.6.23 kernel, always 2.6.21 (since that's what Ralink ships drivers for...)
User avatar
Matthijs
 
Posts: 418
Joined: Fri Apr 09, 2010 6:47 pm

Re: Help mapping my NAS as USB drive

Postby Skynetbbs » Tue Jan 10, 2012 4:49 pm

Matthijs wrote:But AFAIK the 2.0n firmware has never used the 2.6.23 kernel, always 2.6.21 (since that's what Ralink ships drivers for...)

don't look at me... my drivers are 2.6.21 :-)
http://www.fonera.be/flash/FON2303/pack ... d-fs-cifs_2.6.21-fonera2n-mipsel.ipk

I have never seen the errors he reported nor have I tried to reinstall it on recent firmware versions...
Skynetbbs
 
Posts: 564
Joined: Fri Apr 09, 2010 6:47 pm

Re: Help mapping my NAS as USB drive

Postby baro » Wed Jan 11, 2012 8:20 pm

I'm gettin that error because my opkg.conf has got http://downloads.openwrt.org/kamikaze/8 ... /packages/ as repo (kernel 2.6.23.17) and, given my very little knowledge, I was hoping to install the kmod-fs-cifs taken from there :oops:

I've been also trying to manually edit (using XVI) the cifs.ko file to change the magic number but insmod cifs.ko wasn't succeding
(actually editing http://downloads.openwrt.org/kamikaze/7 ... mipsel.ipk
I was able to load cifs but the mount -t command was freezing, perhaps not compatible again)
I guess there's no other option than find a kmod-fs-cifs compiled for my 2.6.21.7 kernel but I haven't been able to...

noob question: what is the module kernel supposed to do? I've been playing also with it :oops: is there a way to downgrade my kernel to 2.6.21 and use skynetbbs cifs without flashing again? :oops:
baro
 
Posts: 25
Joined: Tue Aug 10, 2010 11:40 pm

Re: Help mapping my NAS as USB drive

Postby baro » Sat Jan 28, 2012 5:44 pm

back to 2.3.6.1 and cifs is working :)
baro
 
Posts: 25
Joined: Tue Aug 10, 2010 11:40 pm

Re: Help mapping my NAS as USB drive

Postby baro » Sun Feb 05, 2012 2:06 pm

I'd like to share what I did to have my NAS mounted on my fonera 2.0n with 2.3.6.1 (I didn't succeed using 2.3.70 b1 nor b2 as you might have read in my previous posts); here are the steps I've been following.

first of all we need to install cifs (thank you Skynetbbs!! got some spare time to fix it for 2.3.7.0? :D):
Code: Select all
mkdir /usr/lib/opkg
vi /etc/opkg.conf
src snapshots2 http://www.fonera.be/flash/FON2303/packages/mipsel/
echo option force_space >> /etc/opkg.conf
opkg update
wget http://www.fonera.be/flash/FON2303/packages/mipsel/kmod-fs-cifs_2.6.21-fonera2n-1_mipsel.ipk


to make sure everything is ok let's type
Code: Select all
lsmod | grep cifs
and some info should shows up.

we now need to mount the device, and it may be nice to have it in the fstab so it mounts automatically.
(in my case I've been mounting on /tmp/mounts/Disc-A1 my NAS which is set up as static 192.168.11.2 and shares a dir named "Fonera")
Code: Select all
/etc/init.d/fstab stop
uci add fstab mount
uci set fstab.@mount[-1].target=/tmp/mounts/Disc-A1
uci set fstab.@mount[-1].device=//192.168.11.2/Fonera
uci set fstab.@mount[-1].fstype=cifs
uci set fstab.@mount[-1].options=user=fonero,password=fonero
uci set fstab.@mount[-1].enabled=1
uci commit fstab
/etc/init.d/fstab start


to check if everything as gone right let's see what we have in the fstab file:
Code: Select all
vi /tmp/fstab

and it should looks like this:
Code: Select all
/dev/sda1       /home   ext3    noauto,rw,sync  0       0
//192.168.11.2/Fonera   /tmp/mounts/Disc-A1     cifs    user=fonero,password=fon


that's it :)

one last tweak: for some reasons when I was restarting, the drive did NOT show up yet.
I took the advice from this posting https://forum.openwrt.org/viewtopic.php?id=27210 and put "sleep 15" in the start function of the /etc/init.d/fstab file. That fixed the problem.

Code: Select all
start() {
        sleep 15
        config_load fstab
        mkdir -p /var/lock
        lock /var/lock/fstab.lck
        #echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /etc/fstab
        lock -u /var/lock/fstab.lck
        config_foreach do_mount mount
        config_foreach do_swapon swap


sorry for my english and please let me know if something isn't done as it should be and/or might be done in a faster way
baro
 
Posts: 25
Joined: Tue Aug 10, 2010 11:40 pm

Re: Help mapping my NAS as USB drive

Postby Matthijs » Tue Apr 24, 2012 6:58 pm

If you want to have another go at trying 2.3.7.0 beta2, Fon now publishes firmware images built by our autobuilder from recent subversion revisions (see http://blog.fonosfera.org/automated-fir ... available/). Additionally, some extra packages are compiled and available as .ipk files, one of which is the cifs kernel module (they're only available as ipk, not included in the main firmware). For example, the cifs module for 2.0n from the most recent svn release can be downloaded here:

http://download.fonosfera.org/auto-buil ... mipsel.ipk

I suspect that this module will work with the beta2 release, though I haven't tested it myself.
User avatar
Matthijs
 
Posts: 418
Joined: Fri Apr 09, 2010 6:47 pm

Re: Help mapping my NAS as USB drive

Postby baro » Wed Apr 25, 2012 7:32 pm

oh nice I might give it a try thank you;
by the way I was able to find a working cifs for beta2 (jazzy was really nice and sent that to me!) and I was quite sure I somewhat mentioned this here on the forum (though I could not find it here anymore.....)

I've been spotting a few CIFS so this could be helpful, I'm going to see if it is working better thank you
baro
 
Posts: 25
Joined: Tue Aug 10, 2010 11:40 pm

Re: Help mapping my NAS as USB drive

Postby circlecode » Wed Apr 25, 2012 8:28 pm

thanks to @Matthijs, cifs now works on fonera 2.0n, and really easily:

download required ipks:
Code: Select all
# cd /tmp
# wget http://download.fonosfera.org/auto-builds/fon-ng/fon-ng-r2048/fonera2n/packages/mipsel/kmod-nls-base_2.6.21.7-fonera2n-1_mipsel.ipk
# wget http://download.fonosfera.org/auto-builds/fon-ng/fon-ng-r2048/fonera2n/packages/mipsel/kmod-fs-cifs_2.6.21.7-fonera2n-1_mipsel.ipk

Depending on the charset of your server, download the correct encoding: (mine is UTF8, but cp-437 an iso8859-1 are also provided
Code: Select all
# cd /tmp
# wget http://download.fonosfera.org/auto-builds/fon-ng/fon-ng-r2048/fonera2n/packages/mipsel/kmod-nls-utf8_2.6.21.7-fonera2n-1_mipsel.ipk


now install these: (--force-depends is required since the kernel does not have exactly the same name)
Code: Select all
# opkg install --force-depends kmod-nls-base_2.6.21.7-fonera2n-1_mipsel.ipk
# opkg install --force-depends kmod-fs-cifs_2.6.21.7-fonera2n-1_mipsel.ipk

and install the codepage you downloaded
Code: Select all
# opkg install --force-depends kmod-nls-utf8_2.6.21.7-fonera2n-1_mipsel.ipk

If everything is ok, cifs module is loaded:
Code: Select all
# lsmod | grep cifs
cifs                  262464  1
nls_base                5440  2 nls_utf8,cifs


then you can mount your samba share: (adapt to your config)
Code: Select all
# mount -t cifs //<ip><share> <mount point> -o user=<your user>,iocharset=utf8
circlecode
 
Posts: 1
Joined: Wed Apr 04, 2012 6:50 pm

Re: Help mapping my NAS as USB drive

Postby Matthijs » Wed Apr 25, 2012 9:38 pm

circlecode wrote:now install these: (--force-depends is required since the kernel does not have exactly the same name)


This is not entirely correct: The firmware image does not contain a list of installed packages that are included in the image, so opkg doesn't know that any packages are already installed. I guess I should see about fixing this, some time...
User avatar
Matthijs
 
Posts: 418
Joined: Fri Apr 09, 2010 6:47 pm


Return to Fonera Routers

Who is online

Users browsing this forum: Google [Bot] and 1 guest