This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Sharing a directory via NFS

Other Parts Discussed in Thread: OMAP3530

Hi all,

I am a newbie in this amazing world of OMAP's and DSP's playing around with a clone of the beagleboard (OMAP3530).  It works well with a compiled kernel and the dvsdk-omap3evm-rootfs. I want to cross-compile some programs with my laptop and access and run them with my beagle board with an NFS shared directory. I have already configured the server (in the laptop), the board pings ok to my laptop (via ethernet) but i cant mount the nfs-directory succesfully. What can i do? do i need any special piece of software like nfs-utils, portmap and so on?

thanks in advance!

  • It would help if you could publish your u-boot environment variables and the actual boot log showing the UART output when the board fails to boot.

    The SDK does a lot of the NFS setup automatically, and (for better or worse) sometimes this hides the reason for why NFS fails.

    To set things up from scratch on a Ubuntu host the following steps are needed:

    - Install NFS server

    # sudo apt-get install nfs-kernel-server

    - Edit /etc/exports file to include path to root of NFS mount point (example below, there is a space before the *)

    /home/user/NFS/rootfs *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)

    - Run NFS server

    # sudo /etc/init.d/nfs-kernel-server start

    Set up u-boot environment variables for NFS mount.  This includes setting serverip to the ipaddress of the NFS server and bootargs (example below)

    nfspath=/home/user/NFS/rootfs,nolock

    bootargs console=${console} noinitrd rw ip=dhcp root=/dev/nfs nfsroot=${serverip}:${nfspath}

     

    Please confirm these settings.  You said the board could ping the server from u-boot.  Is that correct?  That is good.  Sometimes network configuration is the issue.  Could you describe the network?  Is the board and host connected to a simple router, or a corporate network?

    Regards, Greg

  • It was my first post  and it has been a sweet surprise finding your answer! thanks!

    The NFS server in ubuntu is already working, i did all the set up you explain this morning and i have been able to share a directory with my laptop and another laptop -also running ubuntu-. That works very well!

    The next step i wanna do is sharing just a directory, not the whole / filesystem. The kernel and the filesystem are in a SD card and  i wanna create a directory in /home/root from which i can have access to my laptop so that i dont have to be continuously copying and pasting my cross-compiled programs. And i wanna use NFS to do it. (i dont know an easier way...)

    If i understand it right, the u-boot environment variables you post are for mounting the whole filesystem via network, arent they?

    May i need some software?? How can i install and configure it? (opkg has no package in the list related to nfs)

    The board is connected via ethernet and the laptop via WiFi to the same server.

    Thank you again!

    Miguel

  • I don't know of any software available (via opkg or otherwise).  It is probably possible to build the same software that you are using between Ubuntu hosts to work on the board.  It would have to be cross-compiled and transferred to the SD card.

    However, I think that you may be better off mounting the entire filesystem via NFS.  It may not seem like much of an advantage when you just want to use a single cross-compiled program, but there are many applications that also install drivers, libraries and configuration files in addition to an executable binary.  Being able to target the NFS as the install location is very useful in these cases.

    You can copy the filesystem from the SD card to your Ubuntu host very easily.  Just mount the SD card in the Ubuntu machine and use "cp -a" to do the copy.  The "-a" will preserve all of the ownership and permissions of the files. 

    # cp -a [sdcard]/rootfs/* [NFSdir]

    An additional tip that I like to do is put an empty file with a meaningful name like "MyNFS_verXX" in the folder [NFSdir]/home/root.  So then when the board boots up, you can do an ls and see that file.  It is a good sanity check that you are in the NFS mount and not the SD card by mistake.

    Greg 

  • There a few cases where people have mounted a non-rootfs NFS drive in addition to the rootfs. The syntax has some weirdness that requires the NFS server address to be repeated. For example:

    mount -t nfs 192.168.0.250:/home/me /home/root -o rw,nolock,addr=192.168.0.250

    http://e2e.ti.com/support/embedded/f/354/t/67858.aspx
    http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/416/t/112873.aspx

     

  • I MOUNTED IT!!

    However i dont precisely understand what i exactly did... but i am going to explain it anyway.

    First of all i created the NFS server following the same instructions gkturner gives. I could verified it automounting this NFS dir in another dir in the same host laptop or even in another laptop

    REMEMBER: the nfs-kernel-server has to be started anytime u turn ur computer on! (i think)

    Secondly, i tried to mount the NFS in my board but there was no way to do it, it always gave me the same error:

    mount: wrong fs type, bad option, bad superblock on 192.168.1.58:/home/mmendia/nfs_dir
           missing codepage or helper program, or other error
           (for several filesystems (e.g. nfs, cifs) you might
           need a /sbin/mount.<type> helper program)
           In some cases useful info is found in syslog - try
           dmesg | tail  or so

    I also could ping my host ip perfectly, which meant i have ethernet working properly. What i thought was it has to be sth related to software and i tried to find something with opkg once after updating it

    root@(none):~/opkg list | grep nfs

    But nothing appeared. So it came up to my mind that i could add an extra feed to the opkg, from which it could find, download and install some software related to nfs.

    Before going on i want to clarify which device i have: it is an embest devkit8000: a beagleboard clone with an ethernet module. It runs the DVSDK version 4. Some time ago i remember i played with Angstrom and opkg and there were more feeds than in the opkg running in the fs the DVSDK provides. So in /etc/opkg i created the following file:

    base-feed.conf

    This file only has one line:

    src/gz base http://feeds.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base

    (I also created the file beagleboard-feed.conf but i think it is not necessary for this matter)

    After i ran opkg update and opkg list | grep nfs and...

    Package kernel-module-nfs-acl version 2.6.32-r100g+gitr5fc29e7b2a76a64a739f857858ef0b98294aa15.
    Package kernel-module-nfsd version 2.6.32-r100g+gitr5fc29e7b2a76a64a739f857858ef0b98294aa155.6.
    Package klibc-utils-nfsmount version 1.5.15-r5.5 has no valid architecture, ignoring.         
    Package task-base-nfs-dbg version 1.0-r93.6 has no valid architecture, ignoring.              
    Package task-base-nfs-dev version 1.0-r93.6 has no valid architecture, ignoring.              
    Package task-base-nfs version 1.0-r93.6 has no valid architecture, ignoring.                  
    nfs-utils - 1.1.2-r9.6 - userspace utilities for kernel nfs                                   
    nfs-utils-client - 1.1.2-r9.6 - userspace utilities for kernel nfs                            
    nfs-utils-dev - 1.1.2-r9.6 - userspace utilities for kernel nfs                               
    nfs-utils-doc - 1.1.2-r9.6 - userspace utilities for kernel nfs    

    So i installed nfs-utils and nfs-utils-client (both, just in case) and i modified my /etc/fstab adding one line:

    192.168.1.58:/home/mmendia/nfs_dir /home/root/nfs_dir nfs defaults,nolock,rsize=8192,wsize=8192 0 0

    And i rebooted the board. I logged in as root and did

    root@(none):~/mount -a

    root@(none):~/cd nfs_dir

    root@(none):~/ls

    ... and voilá!! I could see the files i created in my ubuntu-host-laptop! I dont know if i will find any problem from now on but i have done it 4 times and it works.

    I also find it very useful to mount the entire filesystem and i think that with the steps given in the previous post it can be done! I did not try the mount opt addr = ip but i am not sure it would have worked without having installed nfs-utils and nfs-utils-client before because this programs also install the portmapper and so on (which i think are required to do this things). Of course, if i would have cross-compiled the nfs-kernel-server of utils from my laptop it could have been done but... i wanna learn to cross-compile first ;-)

    Thanks all for your support and sorry for my English! hope u find this issue useful! Cheers from Spain!

    Miguel