Oct 222012
 

I recently bought a 2 terabyte Goflex Home network drive to run as a media server and file server on our local home network. So I figured I’d see how to connect it to the Pi. After searching around various forums, I found a solution that worked. Over the weekend, someone on the Raspberry Pi forums asked how to do this, and so a new “How To” was born.

Pre-requisites for Hooking up goflex drive

  • the drive is already installed on your home network
  • it’s fully up and running
  • You have a userid and password
  • You know the IP address of the network drive

OK let’s do it

From your command line, type…

cd ~ that puts you in your home directory

nano goflex.sh opens a file for editing and calls it goflex.sh

Then you need to type this command, changing the 192…….XXX to the Goflex IP address. Change username and password to your Goflex username and password, and you might need to change Home Public to whatever you want to connect to (e.g. Home Backup or Home Personal).

sudo mount -t cifs '//192.168.XXX.XXX/GoFlex Home Public' /home/pi/goflex/public -o username=blahblah,password=blahblah,iocharset=utf8,file_mode=0777,dir_mode=0777

then…

CTRL+O save
Enter
CTRL+X exit

You might notice I mounted it as a subdirectory of /home/pi This is to ensure you will have full read/write access from user pi. But before we do anything else, we need to create that directory and give it the right permissions…

mkdir goflex make directory called goflex
sudo chmod 777 goflex become super-user just for this command and change directory permissions to full read/write/execute for all users

Assuming you are connecting to “public” we need to create a directory and change its permissions just like we did for goflex.
mkdir goflex/public
sudo chmod 777 goflex/public

Make it executable

Now we need to make the script we just wrote executable so we can run it…

sudo chmod +x goflex.sh

Now, a drumroll and we’ll try to run it…

./goflex.sh (the reason for the ./ is because we are in the same directory as the file we want to run. Anywhere else we would type the full path to the file to run it.)

If you see the normal prompt and no error message, it worked. Now you can go there…

cd goflex/public
ls -l

…and you should see a list of your directories/files :)

If it didn’t work, you’ll get an error message and most likely something in the script is wrong. Check, check, double-check.

Make the Connection Automatic on Boot (optional)

Once you’ve got it working, if you want it to connect every time the Pi boots up, carry on with the next part. I don’t use this myself (but I have checked that it works), as I don’t often want to connect to the network drive, so I’m happy to run the script as and when I need it.

We need to modify the script we wrote slightly.

cd ~
nano goflex.sh

Then add this right at the top

#!/bin/bash this will enable it to run when called from another script

CTRL+O
Enter
CTRL-X

Then we add a line to this file…

sudo nano /etc/rc.local
…this will open a file that contains stuff that runs at boot. This one won’t open unless you use sudo, as it’s a system file.

Go to the bottom just above the line which says “exit 0”. There you should type…

/home/pi/goflex.sh

Then save and exit as usual

CTRL+O
Enter
CTRL-X

And then it should work whenever you boot up.

sudo reboot to give it a try.

I want more!

If you want to mount more than one of the Goflex folders, public, private and backup, you need to have a separate command in the script for each one. You’ll also need a sub-directory for each as we did above – as you can’t mount two “drives” to the same place. This may be obvious, but I thought I’d spell it out anyway. :)

Happy networking :)

  43 Responses to “How to connect a Goflex home network drive to your Raspberry Pi”

  1. Thanks! – I followed your instructions to connect my pi to my iomega nas drive. Worked first time. Much appreciated!! Now I dont need to worry about saving everything onto the SD card.

  2. Hey! Great post – is there a simple way to just connect direct to the goflex home folder i.e //ip address/folder or something? like from browser? or mount ii somhow by just connecting to ip address from gui?

    note i want to be able to get to mounted remote drive from the GUI

    thanks

    • I don’t think there is a simple way. You might be able to do the IP address thing through a browser, like you can in Windows, but I found that clunky, slow and rather unsatisfactory in Windows 7, 64 bit on a good laptop (i7). So, quite likely, it would be virtually unusable on the Pi. No. Sorry, I think it’s a question of following the above instructions, which will still work after you start the GUI as well. If you make a script and add it to your rc.local you only have to do it once. It’s not that hard. :)

  3. Works great for me. I use RPi as a download station (running Aria2+YAAW), and after download I just use a cp command to copy the files downloaded to my GoFlex Home and then read it on my PC and Mac. :inlove:

  4. Have used your instructions to map my: WD My Book Live. Have found the folder created in home/pi but it is empty. Also I see the .sh file in the same directory too. Is this right? If I look in the network drives my Network drive is there and I can go into it and see the files etc. But I can’t search there when looking for audio & video files in the Mplayer. Please help.

    • Sorry I don’t know anything about MPlayer. If you can see your files in the command line then you must be linked to your drive.

      • Well that’s the funny thing becasue I didn’t see my files in the command line. I want to use my files in a GUI, any suggestions on what I can use to do that. Also do I still need to purchase the codecs for Mpeg-2 & VC-1?

        • I thought you said you could see your files?

          If I look in the network drives my Network drive is there and I can go into it and see the files etc. But I can’t search there when looking for audio & video files in the Mplayer. Please help.

          Also do I still need to purchase the codecs for Mpeg-2 & VC-1?

          If you want to watch these formats, yes, but H-264 is already onboard.

          • I can only see the files in the Network drive directory, not in the newly created folder in the, home/pi.

            Are there any instructions anywhere on how to install these purchased codecs please.

          • When I bought the MPEG2 codec, the instructions were in the email I got when they sent me my license codes. :-)

  5. Thanks so much, been going round and round this morning trying to map my Bufallo NAS drive to the PI, seems to work a treat now.

    Keep up the good work.

  6. Thank you for posting this. I only wish this was easy to find as almost every post on connecting a NAS to a Raspi is about using the Raspi as a NAS.

    • Yopu’re welcome. I hope it helped. I’ve added a couple of tags to this post which might help people who want to connect a NAS to raspberry pi to find it more easily.

  7. Thanks for this information. I had shares set up and working on my Pi to my GoFlex NAS and laptop using your method with static ip addresses as you show, over wifi . I have now switched to using dhcp and can connect to the internet on the Pi, but is there a way to amend the scripts for the NAS and laptop shares using dhcp-assigned addresses? I hope someone can help – thanks in advance.

  8. I get an error – line1: 192.168.1.64/GoFlex: No such file or directory
    I have entered GoFlex Home Public . If I enter GoFlexHomePublic then the error says 192.168.1.64/GoFlexHomePublic: No such file or directory
    It’s as if it ignores the directory name after the space.
    What am I doing wrong? IP address is definitely correct.

    • Are you missing off the quotes? If you are, it won’t treat a directory with spaces in properly

      The other thing to ask is did you actually create the directory you’re mounting to?

      • Got it now. Stupid really. I have a new keyboard and had used the wrong key for the quote symbol. Took ages to dawn on me.

        thanks

        • A Eureka moment then. It’s great when you get something working that took a bit of mental effort and many tries. (In fact, that’s a pretty good description of programming.)

          Glad you got it working :)

  9. Hi, i am having real trouble here. I follow your instructions from beginning to end and still get a mount error (6). Changing the 192…to GOFLEX_HOME domain changes my mount error to (115). Any help would be gratefully received

    • An update to this, i can mount the public folder…but i want to mount the Personal folder. replacing Public with Personal does not work

      • This is the command I use…

        sudo mount -t cifs '//192.168.XX.YY/GoFlex Home Personal' /home/pi/goflex/personal -o username=blahblah,password=blahblah,iocharset=utf8,file_mode=0777,dir_mode=0777

        • i think my problem is that my path is complicated.

          My full path using Finder is this: Network/GoFlexHome/mark/GoFlex Home Personal. Changing network to 192.168.X.Y and leaving the rest of my path in like above still gives me a mount error (22).

          I had it working previously with this exact guide before my SD card got corrupted. This means i know it works, i just cant get the right path sorted!

          • You haven’t, perhaps, forgotten to create the local directories on the Pi have you? You _are_ trying to connect a Pi to your GoFlex aren’t you? My doubt stems from your use of ‘finder’ which I’ve only ever seen on Mac (but I don’t pretend to know everything) :)

          • Sorry i may seem to have confused you, i am trying to connect my Pi to my GoFlex using VNC on my Mac. Also using iSSH on my iPad. I am trying to find out the exact path i should write in goflex.sh as putting the ip address and then Go Flex Home Personal is bringing up errors.

          • I’ve given you the exact command, including the path, I use. I think you need someone better than me to help you. I don’t know all that much about networking.

          • I have discovered my problem, my backup, personal and public folders can be seen on my Mac but not on Windows. Now to mount them on Windows instead and then get them on the Pi.

            I do like to complicate things!

  10. Thanks a lot, works fine on my Seagate

  11. Hi all just wanted to add that on the new NOOBS distro and Raspberry Pi 2, I had to add the following sec=ntlm

    • Where did you add that? My script execute and every is working perfectly, but on boot it doesn’t auto connect. It says unable to connect to network. So I guess it try to connect to the drive before the network is properly connected, because if I then immediately after boot run the script its connects.

  12. Hi all, Have been operating my goflex drive successfully without a hitch for over two years now and have recently upgraded the system.
    Something has changed during the upgrade and now cannot access the drive.
    Message is ‘mount error(13): Permission denied. Refer to mount.cifs(8) etc.
    I have checked all permissions, access rights, executables, IP addresses etc, all are exactly as defined in the instructions above yet cannot re-gain access.
    Have any changes been made in the ‘cifs’ security/permissions in the upgrades?
    Linux version currently 3.18.7+ #755 PREEMPT Thu Feb 12 17:14:31 GMT 2015.
    Please can anyone help?

    • Found the problem, we need to add ‘sec=ntlm’ tot he end of the mount line:
      sudo mount -t cifs ‘//192.168.XX.YY/GoFlex Home Personal’ /home/pi/goflex/personal -o username=blahblah,password=blahblah,iocharset=utf8,file_mode=0777,dir_mode=0777,sec=ntlm

  13. Perfect. Thank you!

  14. I am mounting my GoFlex Home on RPi2 running Raspbian (Jessie). I can get it to mount to the Public folder, and it shows the subfolders with the ls -l command. However, when I go to add media to my Plex Media Server on the Pi, I can get to the Public folder, but none of the subfolders are there. Any suggestions?

  15. hi, just got mi zero and am a complete newbie, but your instructions worked a treat. thaks

  16. I’m still experimenting but so far it seems the lightest and fastest method I’ve found to share the goflex SATA drive with a RPi(3) is NFS. Samba is a bit bloated for this application. I don’t know about getting it to work on the factory distro, but I’ve tried debian wheezy and Arch Linux on the go flex and the run a lot better than factory any. Still exploring, but that’s where I am now. Thanks for the write-up, we need more resources like this.

  17. Hi i try do to it but the goflex/public in the Pi is empty

    can you help me please

  18. I used the exact method given here by Alex a couple of years ago to connect a netbook I had converted to Ubuntu 16.04 to a GoFlex Home NAS and it worked perfect 1st time. I tried the same set-up on a Pi3 I just purchased and was frustrated repeatedly with:
    mount error(112): Host is down
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

    After reading 30 or more posts on Go_Flex and NAS connection problems I tried one suggestion that finally worked: Add “vers=1.0” — so freaking simple a solution after hours of frustration.
    Final line of code was:
    sudo mount -t cifs ‘//192.168.xxx.xxx/GoFlex Home Public’ /home/pi/goflex/public -o,username=blahblah,password=blahblah,vers=1.0,iocharset=utf8,file_mode=0777,dir_mode=0777,sec=ntlm

    Not sure if the “sec=ntlm” is needed, That was found in post 12 on this RasPiTv page and didn’t solve the connection problem at the time but may be part of the final solution of the problem.

    Haven’t tested whether the connection to the NAS will be made after a boot. It definitely has never worked on the netbook – there must be a timing problem there. I have to run the script manually each time once booting is finished. Another puzzle to solve.

    Thanks Alex for a great tutorial!

Leave a Reply