[How To] Mount Windows Share on OpenElec Boot

nothere

Banned
Nov 25, 2012
1,036
0
0
Please note this is not the same thing as adding a share through XBMC. This mounts the SMB in at a Linux level and will do so every reboot.

Q. Why would you want to do this?
A. Some addons mainly Ic*f*lms and XBMCMusic have the option to download (as opposed to stream). Natively XBMC does not allow addons to write to a share created in XBMC it only allows local drives. It can access network shares, and read them ok, the problem comes when you want to write to them. The share has to be mounted at an OS level for an addon to be able to write to the share.

Q. What does mounting do?
A. A folder is created within /storage/ which acts as a kind of shortcut to a real folder on a network share. Once mounted if you open this folder it will show the contents of the network share you assigned it to. Essentially the OS thinks this is actually a local folder on the Pi.

How....

1. SSH in to the pi (I use Putty) and create a mount point (the folder which will point to your share, in my example I will be mounting a folder on my desktop where all my downloads go).
mkdir /storage/pcdownloads

2. Make sure the folder on your desktop is shared (im my case its a folder called Downloads)

3. Navigate to your Pi's ip address in Windows Explorer
\\192.168.2.2\ (in my case)
You should see some shared folders.

4. Double click on the Configfiles folder and create a new file called
autostart.sh
Make sure its called autostart.sh and not something like autostart.txt or autostart.sh.txt (you may need to turn on file extensions in Folder Options in Windows)

5. Copy and paste the following into autostart.sh
Code:
[B]#!/bin/sh
(sleep 30; \
mount -t cifs -o username=user,rw //192.168.2.22/Downloads /storage/pcdownloads; \
)&[/B]
Change the 3rd line to reflect your network and shared folder. My PC has a static IP of 192.168.2.22 and the shared folder on my PC I want to mount is called Downloads. The bit after that on the 3rd line is the location of the mount point on your PI. Stick to the \storage\ folder. My mount point is called pcdownloads.

If you have a username and password to get into windows use this as the basis of the 3rd line.
Code:
[B]mount -t cifs -o username=username,password=password,rw //192.168.2.22/Downloads /storage/pcdownloads; \[/B]
Reboot your PI and you should have your windows share mounted. You should be able to navigate to the mount point (\storage\pcdownloads in my case) and use it to download to. Anything you download will be on your network share.
 
Last edited:

nothere

Banned
Nov 25, 2012
1,036
0
0
I initally looked at mounting as I wanted to be able to download from XBMC music. Adding the network source via XBMC as a download location did not work and gave a read only file system error in the log. but actually mouting the drive in linux before xbmc boots makes the share writable to download to.
 

DarkAngel

Member
Jan 1, 2013
45
0
6
Michigan, USA
Great stuff, I been telling people on windows about NTFS Symbolic links too (for Vista and higher,) I knew there was a way like this to do it in *unix based systems I just didn't know all of the commands.

Now I know :)

You might be able to do the same commands in other *unix based systems as well (Android / ATV <~ That's *unix based too right?) But where to auto load them I'm not sure.
 

nothere

Banned
Nov 25, 2012
1,036
0
0
Android easy. Use cifsmanager from the play store. Atv2 if there was a way I'm sure it would have been found by now :) it requires a modded kernel with cifs support.
 
Last edited:

bullsboy

New member
May 28, 2012
392
0
0
Derbyshire, UK
Great piece of work and really timely for me. After 2 years of thinking my NAS drive was about to die, I finally realised it was the router. Now, replaced router means I can actually use the NAS drive properly. N*viX+Mounted folder=1 rapidly filling NAS!
 

nothere

Banned
Nov 25, 2012
1,036
0
0
Great piece of work and really timely for me. After 2 years of thinking my NAS drive was about to die, I finally realised it was the router. Now, replaced router means I can actually use the NAS drive properly. N*viX+Mounted folder=1 rapidly filling NAS!
You got it working? Not heard from anyone else trying it. My hard drive is full now need another 5tb :)
 

bullsboy

New member
May 28, 2012
392
0
0
Derbyshire, UK
It worked (almost) straight away. I don't have usernames and passwords on my NAS but I remembered I once needed to use the username "guest" from aPC once. As soon as I put that into the auto start file, it worked perfectly
 

tuxen

Banned
Mar 23, 2012
2,235
0
0
Denmark
Great contributions metal. This is one of the most annoying crippling of the atv2.

Remember you can also do this the other way around if you do not have a nas.
I have a 3TB USB hd with media connected directly to the r-pi and to reach that as a network drive from a windows machine I just map a network drive lets say Z: to \\openelec\media\ or just \\openelec\ (the whole storage partition) and then browse to the media folder. This way you can use your openELEC as shared storage to your windows or other platforms instead of using a pc to share your harddrive to your r-pi.
This uses much less power, the r-pi is allways on, and it's where you watch the movies anyway and it powers down the harddrive when not in use to. So openELEC can also be used as a samba mini nas straight out of the box. :)
 
Last edited:

bullsboy

New member
May 28, 2012
392
0
0
Derbyshire, UK
Great contributions metal. This is one of the most annoying crippling of the atv2.

Remember you can also do this the other way around if you do not have a nas.
I have a 3TB USB hd with media connected directly to the r-pi and to reach that as a network drive from a windows machine I just map a network drive lets say Z: to \\openelec\media\ or just \\openelec\ (the whole storage partition) and then browse to the media folder. This way you can use your openELEC as shared storage to your windows or other platforms instead of using a pc to share your harddrive to your r-pi.
This uses much less power, the r-pi is allways on, and it's where you watch the movies anyway and it powers down the harddrive when not in use to. So openELEC can also be used as a samba mini nas straight out of the box. :)
That's pretty cool. So openelec mounts the hard drive under storage natively?
I'd give that a go except I've just gone wireless so I'd have to get a USB hub :D
 

bobpeace

New member
Nov 28, 2012
29
0
0
I have a hard drive hooked up to my Airport Extreme that I have successfully mounted as writable. I mounted to a path of 192.168.1.1/MediaHd/Music.

I created a directory in the Storage folder on the SD Card called "files"
The Airport Extreme has an ip address of : 192.168.1.1

So, here is the autostart.sh I created

#!/bin/sh
(sleep 30; \
mount -t cifs -o username=Guest,rw //192.168.1.1/MediaHD/Music /storage/files; \
)&

Been waiting for this... Thanks metalkettle!
 
Last edited:

Canaya

New member
Sep 1, 2012
50
0
0
Great contributions metal. This is one of the most annoying crippling of the atv2.

Remember you can also do this the other way around if you do not have a nas.
I have a 3TB USB hd with media connected directly to the r-pi and to reach that as a network drive from a windows machine I just map a network drive lets say Z: to \\openelec\media\ or just \\openelec\ (the whole storage partition) and then browse to the media folder. This way you can use your openELEC as shared storage to your windows or other platforms instead of using a pc to share your harddrive to your r-pi.
This uses much less power, the r-pi is allways on, and it's where you watch the movies anyway and it powers down the harddrive when not in use to. So openELEC can also be used as a samba mini nas straight out of the box. :)
Hi tuxen, i attempted to do this also. I have a hdd attached to my raspberry pi and from my MacBook I can see the media folder and inside the media folder I see my hdd but if I click on the hdd folder it tells me I can't view the contents because I don't have permissions. Any idea what I can do about it? Thank you
 

Mcord

New member
Nov 30, 2012
135
0
0
Solved my issue with viewing my ext hd via editing samba.comf.sample. can now remote write
 
Last edited:

Canaya

New member
Sep 1, 2012
50
0
0
Solved my issue with viewing my ext hd via editing samba.comf.sample. can now remote write
Would you Mind sharing the steps in how to do this? The drive btw is formatted in Mac os journaled if it matters
 

Mcord

New member
Nov 30, 2012
135
0
0
I could be wrong but that could be your issue. I have two partitions on my drive. The first is formated for Mac and is for time machine backups. The second was formated for dos. My time machine partition I can see all files but not view them, although when it is hooked to directly to my Mac I can. The dos partition I can see and view all files. What I.couldn't do was write to the partition. I changed the file I mentioned and now I can write to my dos partition but my I still can not write to my time machine.