Mounting Drives using cifs

Discussion in 'HD/HDR-FOX T2 Customised Firmware' started by Teg, Sep 28, 2011.

  1. Teg

    Teg Member

    Hi

    Newbie to the forum. Had my HDR-Fox-T2 for a few months now and thought it would be a good time to load the custom firmware. It loaded on a treat! Thank you guys! Great work! I have downloaded the cifs package via the full web interface.

    Now I would like to know how to mount shared folders I have on my linux (Ubuntu) server, so they can be viewed on the Humax. I would like to keep them mounted permanantly as the server is always running in the background.

    It would also be useful to have write access to the server, so I can transfer files from the Hummy over to the server to save space for more recording.

    I appreciate your help.

    Thanks in advance...

    Teg
     
  2. Rich_A

    Rich_A New Member

    The syntax you need is:
    mount -t cifs //server/share /destination/dir -o username=username,password=password

    If you want to see your share on the TV you need to put the destination somewhere inside the /media/My Video/ (or My Photo, My Music) folder

    To automatically create a mapping when the hummy boots, create a text file called something like S99mountme in /mod/etc/init.d containing the mount command and then chmod 755 the file to make it executable.

    My file in init.d maps a single share from my NAS containing all my media and then uses bind to map the relevant media directories in the share to the relevant directories on the hummy so I can see them on the telly:

    mkdir /media/sausagestor
    mount -t cifs //192.168.1.2/share /media/sausagestor -o username=username,password=password
    mount --bind /media/sausagestor/video "/media/My Video/_sausagestor"
    mount --bind /media/sausagestor/photos "/media/My Photo/_sausagestor"
    mount --bind /media/sausagestor/music "/media/My Music/_sausagestor"
     
    Teg likes this.
  3. Teg

    Teg Member

    Thanks Rich! Worked an absolute dream! :) Never knew that my Hummy would have so many geeky possibilities! All the guys out there working on the customised hardware, I owe you guys a drink!

    Thanks again! :)
     
  4. Teg

    Teg Member

    Hi again. I am able to mount shares using a command in telnet window but the script does not seem to work. I have saved the following in the directory as you suggested but it does not mount the shares.

    mount -t cifs //192.168.1.69/video "/media/My Video/Network" -o username=teg,password=password
    mount -t cifs //192.168.1.69/tunes "/media/My Music/Network" -o username=teg,password=password
    mount -t cifs //192.168.1.69/photos "/media/My Photo/Network" -o username=teg,password=password

    Appreciate any suggestions. Have I used the wrong directory? I did update the permissions as you also directed.

    Thanks in advance.
     
  5. Rich_A

    Rich_A New Member

    If you go to your /mod/etc/init.d folder and attempt to run the script by typing ./S99mountme, does it run and successfully mount the partitions?

    Have you created the 'Network' directories inside the /media/My XXX/ directories before doing the mount commands?
     
  6. Teg

    Teg Member

    Yes I have created the network directories
    Running the script by typing the command in the telnet window - that works fine! :) So not sure why it is not running.
     
  7. af123

    af123 Well-Known Member

    Take a look at the log file /tmp/modinit.log and see if that gives any clues.

    It might be that the script is running before your network is ready. If that's the case then wrap it in a network check like this:

    Code:
    
    [ "$1" = start ] || exit 0
    
    (
        while [ ! -f /tmp/if-up ]; do
                echo "Mountme: waiting for network."
                sleep 1
        done
    
        mkdir /media/sausagestor
        mount -t cifs //192.168.1.2/share /media/sausagestor -o username=username,password=password
      # etc.
    ) &
    
    
    The ( ) & bit creates a subshell in the background so the whole boot process doesn't stall.
     
    Teg likes this.
  8. Teg

    Teg Member

    Getting the following error message when attempting to run the amended script manually

    Humax# ./S99mountshares
    ./S99mountshares: exit: line 1: Illegal number: 0

    Thanks in advance

    Teg
     
  9. xyz321

    xyz321 Active Member

    Insert the following as the first line of the script:

    Code:
    #!/bin/sh
     
    Teg likes this.
  10. Teg

    Teg Member

    Still having problems I am afraid

    When trying to run the amended script


    Humax#
    Humax# ./S99mountshares
    -/bin/sh: ./S99mountshares: not found
    Humax#
    Humax# ls
    S01cifs S01mongoose S99mountshares rcS
    Humax#

    Error log

    run_init =============================================
    Loaded CIFS module into kernel.
    /mod/etc/init.d/rcS: line 36: /mod/etc/init.d/S99mountshares: not found
    Loading config file /mod/etc/mongoose.conf
     
  11. af123

    af123 Well-Known Member

    That error message means that the script has DOS/Windows line endings in it rather than UNIX ones. Try this:

    Code:
    humax# cd /mod/etc/init.d
    humax# dos2unix < S99mountshares > S99mountshares.unix
    humax# mv S99mountshares.unix S99mountshares
    humax# chmod 755 S99mountshares
    
     
    Teg likes this.

Share This Page