Skip to main content

Raspberry Pi -- Installing Samba (Windows Share) File server

Having successfully run Debian Wheezy on my Raspberry Pi, I went forward with my initial idea of setting up a low cost power efficient file server for accessing my external hard disks from my Windows7 desktop, HP-Mini running Ubuntu and Mac Mini running OS X Lion (yeah I do like bragging about my machines :D ).

This turned out to be pretty straight forward.

As expected, the external Seagate USB disk immediately got recognized and appeared as /dev/sda
[  579.948350] usb 1-1.2: New USB device found, idVendor=0bc2, idProduct=3001
[  579.948384] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  579.948405] usb 1-1.2: Product: FreeAgent
[  579.948421] usb 1-1.2: Manufacturer: Seagate
[  579.948447] usb 1-1.2: SerialNumber: 2GEX323R
[  579.967638] scsi0 : usb-storage 1-1.2:1.0
[  580.970520] scsi 0:0:0:0: Direct-Access     Seagate  FreeAgent        102D PQ: 0 ANSI: 4
[  589.142942] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[  589.144669] sd 0:0:0:0: [sda] Write Protect is off
[  589.144717] sd 0:0:0:0: [sda] Mode Sense: 1c 00 00 00
[  589.146298] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  589.171762]  sda: sda1
[  589.180680] sd 0:0:0:0: [sda] Attached SCSI disk

Next step is to create a mount point
pi@raspberrypi ~ $ sudo mkdir /media/terradisk
Add the correct entry to /etc/fstab (edit this with your preferred editor)
pi@raspberrypi ~ $ sudo vim /etc/fstab
So that it looks like the following,

And mount it
pi@raspberrypi ~ $ sudo mount -a
The new usb drive should now show up
Next install samba,
pi@raspberrypi ~ $ sudo apt-get install samba samba-common-bin
Once finished, open the samba configuration file
pi@raspberrypi ~ $ sudo vim /etc/samba/smb.conf
and edit as follows.
In the Authentication section, uncomment
   security = user
and add the following section in the end
[SamDataDump]
comment = Data Dump on Sam Raspberry Pi
path = /media/terradisk
writeable = yes
guest ok  = no
Remember to change
[SamDataDump]
with the share name you want and
path = /media/terradisk
with the path to wherever you mounted your external disk.
Add the smb password for the default pi user
pi@raspberrypi ~ $ sudo smbpasswd -a pi
Set permissions so that pi user can access the share,
pi@raspberrypi ~ $ sudo chown -R pi:pi /media/terradisk/
Restart samba
pi@raspberrypi ~ $ sudo /etc/init.d/samba restart
And done!
Try accessing the share,


 And it works!

Comments

Anonymous said…
So you finally gave up on the green-on-black terminal colour scheme :)
sourcejedi said…
Are all your USB drives desktop-class, or are they low-power laptop-class drives?

I've just rescued a laptop-class drive connected to a SheevaPlug (also ARM), which was apparently half-way towards killing itself after half a year. I'd be interested to know what smartctl says about Load_Cycle_Count on your drive(s). http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=18626&p=183526

Popular posts from this blog

Making inactve USB Hard Disk spin down automatically in Linux.

I have a 400GB Seagate IDE HDD connected to Mars, our hostel's file-server using an USB enclosure. The USB enclosure is a cheap "Made in China" product. Consequently it has some special "features". One such notable "feature" is that the disk is kept spinning by the controller even if there has been no disk I/O for a long time. I have three other USB disks connected to the same machine, a 1TB Seagate FreeAgent Desk External Drive, a 500GB Maxtor Basics External Drive and a 2.5" 60GB Fujitsu SATA Disk inside a Transcend USB enclosure. All of these spin down themselves if there has been no I/O for sometime. Keeping the hard disk spinning unnecessarily for ever, not only wastes power but also overheats the drive, thereby reducing its life. I tried noflushd, which is supposed to force idle hard disks to spin down, but found it to be of no help. USB enclosure generally work by performing an SCSI emulation over USB. sdparm is an utility which can be use

Force an application to use VPN, using iptables in Linux

Enforcing an application, for example a torrent client like Transmission , to always use the VPN interface or any particular network interface for that matter, is trivially simple using iptables on Debian, Ubuntu or any other GNU/Linux distro. Personally, I am running Debian Sid on the Raspberry Pi . Occasionally I use it for downloading files ( legal stuff, seriously, believe me :D  ) using Transmission Bittorrent client over a VPN connection. Sometimes it happens that the VPN connection fails and doesn't reconnect for whatever reason and Transmission continues pulling stuff directly over my internet connection, which I would like to avoid. Fortunately it is very straightforward to enforce rules based on application owner UID. Transmission runs under the owner debian-transmission in Debian (use htop to check this) and the following two lines of iptables ensures that any process with owner having UID, debian-transmission , will not use any other network interface apart from the

Rendering LaTeX in Blogger.

Rendering LaTeX in Blogger is pretty easy thanks to the JavaScript LaTeX equation render engine from http://www.yourequations.com . To enable LaTeX rendering go to the Blogger Dashboard --> Layout --> Edit HTML . Then add the line <script> type="text/javascript" src="http://tex.yourequations.com/"></script> <script type="text/javascript" src="http://tex.yourequations.com/"></script> just before <body/> . Half the job is now done. Then, for example to render: \int_{0}^{\pi}\frac{x^{4}\left(1-x\right)^{4}}{1+x^{2}}dx =\frac{22}{7}-\pi Use the code: <pre lang="eq.latex"> \int_{0}^{1}\frac{x^{4}\left(1-x\right)^{4}}{1+x^{2}}dx =\frac{22}{7}-\pi </pre> The LaTeX code will now be displayed as: \int_{0}^{1}\frac{x^{4}\left(1-x\right)^{4}}{1+x^{2}}dx=\frac{22}{7}-\pi Ofcourse Javascript needs to be enabled in the Browser for the renderer to work.