Sam Stefan

Mar 02

Thank you Offscreen. #offscreen

Thank you Offscreen. #offscreen

Jan 27

Timbre Theme

image

Timbra is a Tumblr theme Magnus Erichsen and I developed back before Christmas, as one of Synth’s Friday projects. Designed for anyone who likes classic typography, lovely retina icons and great big images. It’s also fully responsive and completely free!

You can preview and install it here.

Jan 23

“Are you ready to start on this website? Cause there’s Node going back.” — Magnus (via synthquote)

Jan 21

A new addition to the den.

A new addition to the den.

Jan 06

Using The Raspberry Pi As Network Attached Storage

image

Over the Christmas break, while visiting my parents I found a local shop that sold Raspberry Pi’s, and subsequently bought one (something I’ve been meaning to do for awhile). 

The last couple of days I’ve been playing around trying different Samba share set-ups, to get the most throughput using the Raspberry Pi as a NAS. I thought I’d share what I’ve found to be the most effective.

It’s worth noting that all my results are with a Raspberry Pi Model B (512MB RAM, UK Model) over-clocked to 900MHz ARM, 250MHz core, 450MHz SDRAM, 2 overvolt using the built-in over-clocker and an USB 3TB external hard-drive with its own power supply. I’m also using Raspbian as the OS.

With my current settings I’ve been able to achieve the following results using the network port:

Writes of around 10 MB/second

Read of around 8 MB/second

This is plenty fast enough for steaming video, music and backing-up relatively large files form the computers in my flat.

Updating / Formatting

I was having some issues with transfer speed at first, until I opened raspi-config and ran the updater. I recommend you do this before starting.

I did originally want to have the drive formatted as exFAT, so I could plug it directly plug it into my PC/Mac and copy over a large chuck of the files with USB three. But I ended up opting for Ext4, after running into problems with permissions when mounting the drive using fstab (I’ll explain how to do this later) and reading about it’s performance benefits with Raspbian. If you want to know how to format a drive via command line, you can follow the guide on the Ubuntu website.

Once you’ve formatted the drive you’ll want to mount it — I did this through fstab so I didn’t have to mount it manually every time I restart my Pi. To add the drive to fstab open terminal and type the following:

sudo vim /etc/fstab

Note Vim doesn’t come preinstalled with Raspbian, you’ll need to do this yourself, or use a different editor.

Now fstab is open add the following line to the bottom of the file:

/dev/sda3 /media/storage ext4 defaults 0 0

There are two main things you’ll need to change here, /dev/sda3 needs to be the name of your hard-drive and /media/storage is the folder that you want it to mount to (this folder need to already exists). The rest can stay the same, save the file and exit.

To mount the drive you just type:

sudo mount -a

Setting up Samba

Before installing Samba, updated the package list with:

sudo apt-get update

Then install Samba with:

sudo apt-get install samba

Now it’s installed, you need to configure your shares. To do this you need to open the smb.conf file in terminal with Vim:

sudo vim /etc/samba/smb.conf

Jump to the bottom of the file add the following lines then save the file and exit:

[Storage]
  comment = Pi File Server Share
  path = /media/storage
  browsable = yes
  guest ok = yes
  create mask = 0777
  writeable = yes

This configuration adds the Samba share ‘Storage’, making the hard-drive I mounted earlier /media/storage available on the network. You can read more about the different configurations here.

Setting Permissions

Now you’ve added the share you’ll need to set the permissions on the folder, so guest users can read/write files. To do so type the following in terminal:

sudo chown -R nobody:root /media/storage

Once you’ve done that, restart the service to reload the configuration file you changed earlier:

sudo service samba restart

That’s all you need to do! The share should now be accessible over the network.

If you have any feedback please let me know via twitter: @samstefan