Jump to content


Photo

shell script to mount nfs


  • Please log in to reply
3 replies to this topic

#1 bvdbos

bvdbos

    Newbie

  • Jr. Member
  • Pip
  • 5 posts

Posted 08 February 2011 - 01:18 AM

I'm running firmware build 1561 on a Flytouch II and would like to mount some nfs-shares after startup, so I rooted and installed autostart.apk. Then I created the following scipt:
[tt]
timeout=120
interval=5
local_dir=/sdcard/muziek
remote_dir=server:/muziek

while test ! -d "${local_dir}" ; do
  sleep ${interval}
  timeout=`expr ${timeout} - ${interval}`
  if [ ${timeout} -le 0 ]; then
    echo "Lokale directory (${local_dir}) niet gevonden"
    exit 1
  fi
done

mount -t nfs "${remote_dir}" "${local_dir}"
[/tt]

unfortunately the "while" isn't recoginised, so I'm stuck. Does anyone have any ideas or does anyone have a working cifs.ko so i could use mountcfis.apk or mountnfs.apk. Basically what I'm trying to do is create the mountpoints after the sdcard has been mounted.

tia

Bas

#2 duno

duno

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 274 posts

Posted 09 February 2011 - 04:15 AM

I'm running firmware build 1561 on a Flytouch II and would like to mount some nfs-shares after startup, ...


http://www.slatedroi...p?topic=14534.0

#3 bvdbos

bvdbos

    Newbie

  • Jr. Member
  • Pip
  • 5 posts

Posted 09 February 2011 - 05:23 AM

Of course I could do it with gscript or by manually starting a script but the tablet is for my GF so it should work right after starting up. The mount-points should be visible, also after a restart, so /data or /media are a nogo which means i have to put them on the sdcard. Gscript doesn't run scripts at startup afaik. Putting the mount commands in autostart.sh means they will be executed before the sdcard is initialized. I already tried putting a sleep 60 before mounting but this doens't seem to work all the time.

I also tried using 'busybox watch' calling the mount-script every 10 seconds but this doesn't seem to work. Now I'm trying using '-o timeo=xxx' in the mount-command but no luck yet.

If all fails, a shortcut to a shell-script will have to do until we have a working cifs.ko for the flytouch II I guess...

#4 lanosalf

lanosalf

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 217 posts

Posted 10 February 2011 - 12:45 AM

..."The init program directly mounts all filesystems and devices using either hard-coded file names or device names generated by probing the sysfs filesystem (thereby eliminating the need for a /etc/fstab file in Android). After device/system files are mounted, init reads /etc/init.rc and invokes the programs listed there (one of the first of which is the console shell)"...
this information is here http://source.androi...g/bring_up.html
Well, the thing is android doesnīt have fstab anymore, so you should try to edit the init program, but i donīt think so...,
The init.rc is a text based script, you should take a look to the file, is located directly at /, and add some lines at the end or somewhere to mount after sdcard is mounted.
I think this should work i didnīt try, i just use Gscript shortcut located at home screen to mount, and another to umount.
Share what you discover

By the way, i use this script to mount(without busybox didnīt work for me)

busybox mount -t nfs -o nolock,vers=3,rsize=16384,wsize=16384,async 192.168.1.110:/media /sdcard/public

the vers=3 is needed if you want to share bigger files than 2gb, and the size of the packets rsize and wsize was the ones who work fine for me, if i use the defaults 8192 with nfs version 3 problems appears in streaming video, so i increased the packets.
The nfs version 2(default) works fine with 8192 (default), but i canīt stream files bigger than 2gb. They suddenly stop somwhere in the middle.
SO vers=3 and 16384 work excelent.
you can google nfs rsize performance if you have problems

good luck