Monday, June 25, 2012

Give me spaaaaace!

More on my Raspberry Pi experiences. 

On the default disk image of Debian recommended by the Raspberry foundation, after install the VNC server as described in my previous post, you're left with just shy of 300MB of disk space to play with. This seems measly when you're used to talking about how many GB free space a disk has.

So what can we do about it without plugging in more *stuff* to my lovely little minimalist Pi? The answer is ... mount a network drive from the PC that acts as a file server and first-stage backup server to the rest of the house!

I have a Projects folder on my desktop, where I keep any coding ... well... projects, funnily enough. The drive that contains that folder has plenty of free space (about 200GB as it happens), so this is just fine for my purposes today.
  1. First up, create a share in Windows, with Guest as the Co-owner (yes, i know I could create a Pi user on my box, but I'm feeling lazy at this stage)
  2. Now ssh or VNC and open a terminal session on the Pi.
  3. run "sudo mkdir /mnt/projects"
  4. run "sudo vi /etc/fstab" and add the lines as follows

Contents of /etc/fstab:

# these lines exist already
proc            /proc           proc    defaults        0       0
/dev/mmcblk0p1  /boot           vfat    defaults        0       0
#/dev/mmcblk0p3  none            swap    sw              0       0

# this is the new line:
//192.168.0.5/Projects /mnt/projects cifs user=guest%,uid=1000,gid=1000

Notes:

  1. "192.168.0.5" is the IP of my PC - I would use the named UNC path, but I have Virtual Box on the machine too, which is advertising another address under the same name, that just seems to confuse Samba on the Pi.
  2. "Projects" is the name of the Windows share
  3. "/mnt/projects" is the director where the files will appear on the Pi
  4. "cifs" is the type of file system
  5. "user=guest%" indicates we're logging into Windows as guest, with no password (I know, I know, even a private network needs security, I leave this as an exercise for you, the reader)
  6. "uid=1000,gid=1000" tells the file system to be owned by the "pi" user and group on the Pi, so we can read & write to the files without needing to "sudo" all the time.
Pretty simple really. And because I've used SyncToy on the windows folder to contribute any files from the Projects folder into my backup drive (external USB) and then into my DropBox account, anything I write from the Pi to /mnt/projects will automatically be double backed up every night. (Afterall, any data that you don't have at least two copies of is data that you don't care about, n'est pas?)

Addendum

I just added a similar line to "/etc/fstab" for an 8GB pendrive in the unused USB socket, to give me more, local, faster space:
#pendrive
/dev/sda1 /media/usbstick vfat rw,uid=1000,gid=1000
(remembering to create the "/media/usbstick" directory first)

No comments:

Post a Comment