Thursday, February 13, 2014

Google Fiber Mount smb on Linux (Fedora/Ubuntu)

Well I recently had the privilage of having google fiber installed at my house. Since I opted for the good ol' extra tv package, I got a nice 2TB network hard drive. It allows local machines to connect with it through a samba file server so that you can back up all your photos, songs, and videos.

This is really nice, something I'd really like to do is share my videos not only with my tv box, but also with my web server, so that I can serve these videos, songs, etc through my web site. Obviously getting the local gfiberstorage server to take a peek into my 500gb servers hard drive would be quite a bit to chew off. Also, why use my server hard drive when I have this nice 2TB local HD.

So the next choice was to map the remote gfiberstorage drive into my webservers root file system so that it could get at all the videos through the network. I've only mounted through the GUI on linux and that wouldn't work this scenario so I had to do a little research into mounting network drives into the linux file system.

I decided to start on my Fedora 20 laptop and figure it out there before moving to the ubuntu box.


  1. Create a mount point. It appears /media seems to be a popular mount point, in addition to /mnt. I chose media cause it seemed to fit. sudo mkdir /media/gfiberstorage/videos/
  2. Mount the samba share. This step took me quite a while to figure out. At first I just mounted it and it asked me for a password for root, which i typed root, and it worked. However, only my root user was able to read and write into the directory. It took me awhile but I found the a few options that helped me mount it better. These options go behind the -o. There is:
    1. guest
      1. This removes the need to add a user/pass
    2. rw
      1. This would allow both read and write access (The default for the user)
    3. uid=<local username>
      1. Sets the local groupname that should own the dir/files of the mount
    4. gid=<local groupname>
      1. Sets the local groupname that should own the dir/files of the mount
    5. iocharset=utf8
      1. Allows you to access files/dirs with UTF-8 (non english) chars
    6. In case you want to log in with user/pass
      1. username=<remote username>
      2. password=<password for remote user>
      3. credentials=/home/userdir/.smbcredentials
        1. You can also store your creds in a file and reference that to keep your user/pass secure on the machine. In this case just put the username=?? and password =?? on the first two lines of the file.
    7. file_mode=0777,dir_mode=0777
      1. If you want to spin up the mount with file and dir privs. You could do this and keep ownership to root, but still allow other users to work in the dir
    8. sec=ntlm
      1. I didn't need this on either my fedora 20 or ubuntu 12.04, but apparently due to some recent moves of cifs mount code into the kernel this option may be necessary in some cases.
    9. _netdev
      1. If you are mounting during bootup this option will delay creating the network connection to the remote file system till the network is in place. source
I ended up with this guy in order to mount 
sudo mount -t cifs -o guest,rw,uid=sean //gfiberstorage/videos /media/gfiberstorage/videos

Now on to my ubuntu box, had to install cifs-utils
sudo apt-get install cifs-utils

After which I could mount using the same command/options as the fedora box.

And when your all finished, you can unmount via
sudo umount /media/gfiberstorage/videos

And now I can dump files directly to the network share, access the videos through the google fiber interface, and also serve them out through my http server. Pretty cool!

The main reason I wanted to do this is my chromecast requires http urls in order to play videos through it's browser. I've managed to write an application that lets me serve videos to the chromecast from my local network, my public web server, and yes also files I've thrown up to google drive (That 1TB they add to your account makes this really nice)

No comments:

Post a Comment