BarracudaDrive Your Personal File Sharing Solution

 

BarracudaDrive

Manage Data Your Way

BarracudaDrive for Raspberry Pi

The Raspberry Pi is a tiny (credit card size) computer that runs Linux. The non-profit Raspberry Pi Foundation provides two Raspberry Pi versions, one with and one without network capability. You will need the $35 version that includes an Ethernet jack for Internet access. You will also need one SD card and a USB power supply such as a USB phone charger. See raspberrypi.org for purchase information.

Preparing the Raspberry Pi Board

BarracudaDrive is on the Pi Store

Install BarracudaDrive via the Raspberry Pi store if you already have a Raspberry Pi up and running.

Follow the configuration tutorial after you have installled BarracudaDrive from the Raspberry Pi store.

You will need to install Linux on the SD card, power up the board, and configure Linux before you can install BarracudaDrive. The following instructions are a condensed version designed for Windows users.

Preparing the SD card:
  1. Insert the SD card into your computer.
  2. Download Win32DiskImager.
  3. Unpack and start Win32DiskImager.
  4. Download and unpack the Raspbian "wheezy" version.
  5. Click the blue folder icon in Win32DiskImager and select your Raspbian image file -- i.e. the binary file you unpacked in step 4.
  6. In the device list, select your SD card.
  7. Click "Write".

You can remove the SD card from your computer when the above write operation has completed. Insert the SD card into the Raspberry Pi, insert an Ethernet cable, and insert a USB power cable. The Raspberry Pi should now start booting.

The Raspberry Pi is a complete computer that you can connect to your monitor, keyboard, and mouse. When installing BarracudaDrive, you do not need to connect more than the Ethernet and power supply since we can remote control the device using SSH.

Download and install the free SSH Putty client for Windows. Navigate to your router's web interface and locate the list of DHCP clients. The Raspberry Pi will be on this list. Copy the Raspberry Pi's IP address assigned to it by your router. Start Putty and paste the IP address into the field where you see "Host Name (or IP address)" in Putty.

You should now get a login prompt. The username is pi and the password is raspberry.

You must now perform the initial Raspberry Pi configuration. Type the following in the console window and press the enter key.

pi@raspberrypi ~ $ sudo raspi-config

You should see the Raspberry Pi configuration program:

What you want to do is to expand the root partition, set your time zone, and keyboard. You may want to disable the desktop on boot if you are planning on using the Raspberry Pi as a server and not connecting a monitor. This will also free up some memory.

Installing or Upgrading BarracudaDrive

The following text box contains all required commands for installing or upgrading BarracudaDrive. Click the text box below, copy (CTRL-C), and paste into your SSH window.

The above is a concatenation of commands which downloads the installation script, makes the script executable, and then executes the script. The BarracudaDrive server will be running once the installation or upgrade completes. The server will also start automatically when you power on the device.

Use a browser and navigate to your BarracudaDrive server by typing the Raspberry Pi's IP address into the browser's address bar. You should see the main page in BarracudaDrive. Carefully read the instructions and click the "Config-Wizard" link shown in the left menu. This link takes you to the BarracudaDrive configuration wizard and Internet wizard. You cannot login before you have configured your BarracudaDrive server. Note: you do not need to run the "Config-Wizard" if you are upgrading from an older version.

Configuring BarracudaDrive

You must configure the BarracudaDrive server after installing it. You can do this using the Midori browser installed on the Raspberry Pi or you can do it from your Windows, Mac, etc. -- i.e. your main computer.

  • Using the Raspberry Pi: Start Midori and type in the address http://localhost
  • Using your main computer: Start any browser and type in the address http://ip-addr, where ip-addr is the IP address assigned to your Raspberry Pi.

The BarracudaDrive main page will show up in your browser and this page will redirect you to the configuration wizard since your server is not configured. You can start using the BarracudaDrive server as soon as you have set a password. You should also complete the Internet configuration wizard if your server is behind a router. This will enable external users access to your server.

Managing BarracudaDrive from the command line

The BarracudaDrive installation script installs a daemon script in /etc/init.d/bdd. This script makes sure your BarracudaDrive server starts automatically when you power on your Raspberry Pi.

You can stop,start, and restart BarracudaDrive from the command line as follows:

pi@raspberrypi ~ $ sudo service bdd stop
pi@raspberrypi ~ $ sudo service bdd start
pi@raspberrypi ~ $ sudo service bdd restart

The Linux user bd

The BarracudaDrive server runs as the user 'bd'. This Linux user does not have access to anything outside of its /home/bd directory unless you make specific changes to allow such access.

You can become the user 'bd' by typing the following in a command window:

pi@raspberrypi ~ $ sudo su bd
bd@raspberrypi /home/pi $

The user 'bd' does not have a password and you must therefore login as root and then from root, login as user bd. The above command 'sudo su' makes the 'su' command execute as root. The user root can become any other user on Linux without a password so the command 'su bd' changes the root user to 'bd'.

Using BarracudaDrive as a Network Attached Storage (NAS) device

One of the more popular BarracudaDrive plugins is the Web File Server, which includes a WebDAV server and a Web File Manager. You automatically use the Web File Manager when using a browser and the WebDAV server when using a WebDAV client.

WebDAV is a type of network drive that can be securely accessed over the Internet. Check out the video to the right
if you are new to WebDAV.

The SD card you are using has more than likely insufficient storage space when using your Raspberry Pi as a NAS. You may want to plugin an external USB drive to increase the amount of data that you can store on your Raspberry Pi. The question is, how can BarracudaDrive, which runs as the Linux user 'bd', access this USB drive? We will look at two methods for how the BarracudaDrive server can access your external USB drive.

Using a VFAT formatted USB drive

Most USB drives are pre-formatted as VFAT which is not really a good fit for your Linux powered Raspberry Pi since VFAT cannot store Linux file permission information. We will later look into how to reformat the drive using a Linux file system.

Your Raspberry Pi will auto mount your external VFAT USB drive and the default settings will not allow the 'bd' user access to this drive. The following commands show how to fix this problem:

pi@raspberrypi ~ $ sudo umount /dev/sda1 #umount the auto mounted USB drive
pi@raspberrypi ~ $ sudo mkdir /mnt/usb1 #Create a directory we can use as a mount point
pi@raspberrypi ~ $ sudo mount -t vfat /dev/sda1 /mnt/usb1 -o umask=000 #mount the drive

The above mount command sets the umask to 000, which makes the file permissions 777 on your USB VFAT file system. These permissions make it possible for your BarracudaDrive server to access this drive.

The root directory for the BarracudaDrive Web File Server is /home/bd/disk. This directory can be accessed as http://ip-addr/fs/ using a browser. What we want to do is to make the USB drive accessible via the Web File Manager. An easy way to do this is to create a soft link in the disk directory as follows:

pi@raspberrypi ~ $ sudo su bd # Change to user bd
bd@raspberrypi /home/pi $ cd /home/bd/disk/
bd@raspberrypi ~/disk $ ln -s /mnt/usb1 usb1 #create soft link

The root of the mounted USB drive can now be access as http://ip-addr/fs/usb1/ using a browser. What's great about this solution is that you can now access your SD card and the new USB drive via the Web File Server.

Making the USB drive permanently mounted

Manually remounting the USB drive every time you reboot your Raspberry Pi becomes tedious. You can make the mount permanent by editing the /etc/fstab file. Open the fstab file as follows:

pi@raspberrypi ~ $ sudo nano /etc/fstab

Scroll to the end of the file and paste in the following:

/dev/sda1 /mnt/usb1 vfat umask=000 0 0

Save the file and reboot to test. The drive should mount automatically when you reboot your Raspberry Pi.

Reformatting the drive

We mentioned above that a VFAT file system is not ideal since we cannot set Linux permissions on this drive. In addition, a Linux file system is more resilient to disk errors than a VFAT file system. Another limitation with VFAT is that you cannot store files larger than 4Gbytes. The only benefit in using a VFAT file system is that you can plug it into a Windows computer. If you decide to reformat the drive, you can no longer access the USB drive directly from a Windows computer. However, you can mount the Raspberry Pi from your Windows/Mac/Linux computer using WebDAV and use it as a NAS.

Unmount the USB drive and format as follows:

pi@raspberrypi ~ $ sudo umount  /mnt/usb1
pi@raspberrypi ~ $ sudo mkfs.ext3 /dev/sda1

We can now mount the new formatted drive as follows:

pi@raspberrypi ~ $ sudo mount /dev/sda1 /mnt/usb1

When we used the VFAT file system, we made a soft link that accessed the root of the USB drive. We will do it a little bit different now since we have a Linux file system. Instead of accessing the root, we will create a new directory on the USB drive and set the proper permissions for the 'bd' user.

pi@raspberrypi ~ $ sudo mkdir /mnt/usb1/bd
pi@raspberrypi ~ $ sudo chown bd:daemon /mnt/usb1/bd

The user 'bd' can now access the 'bd' directory on the USB drive. The next step is to fix the soft link we created in the BD disk directory:

pi@raspberrypi ~ $ sudo su bd
bd@raspberrypi /home/pi $ cd /home/bd/disk/
bd@raspberrypi ~/disk $ rm usb1
bd@raspberrypi ~/disk $ ln -s /mnt/usb1/bd usb1

The only thing missing now is to fix the fstab file. We are no longer mounting the drive as VFAT so go ahead and open the fstab file as follows:

pi@raspberrypi ~ $ sudo nano /etc/fstab

Scroll to the end of the file and change the line:

/dev/sda1 /mnt/usb1 vfat umask=000 0 0

to the following:

/dev/sda1 /mnt/usb1 ext3 defaults 0 0

Save the file and reboot to test. The drive should mount automatically when you reboot your Raspberry Pi.

Info for Computer Hobbyists

There is a lot of cool stuff you can do with BarracudaDrive as it is, but you may want to read up on the developer section if you are a computer programmer. BarracudaDrive is an application server letting you write your own scripts to perform; for example, home automation, remote management, and more. With BarracudaDrive, you can write your own web based user interface to control any type of hardware that is connected to a Raspberry Pi such as the readily available Raspberry Pi expansion boards.