Permanently mounting an external USB hard drive on a Raspberry Pi

Find the external drive using fstab

pi@raspberrypi:/mnt$ sudo fdisk -l

Disk /dev/mmcblk0: 7964 MB, 7964983296 bytes
4 heads, 16 sectors/track, 243072 cylinders, total 15556608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000827fa

Device Boot Start End Blocks Id System
/dev/mmcblk0p1 2048 1671875 834914 e W95 FAT16 (LBA)
/dev/mmcblk0p2 1679360 15491071 6905856 85 Linux extended
/dev/mmcblk0p3 15491072 15556607 32768 83 Linux
/dev/mmcblk0p5 1687552 1810431 61440 c W95 FAT32 (LBA)
/dev/mmcblk0p6 1818624 15491071 6836224 83 Linux

Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000af53a

Device Boot Start End Blocks Id System
/dev/sda1 2048 2930266111 1465132032 83 Linux
/dev/sda2 2930266112 1565565871 1465133528 83 Linux


You want to mount it using its UUID instead of its /dev address because USB drives get mounted at different addresses on each boot while the UUID will be the same.

sudo blkid

/dev/mmcblk0p1: LABEL="RECOVERY" UUID="3394-996E" TYPE="vfat"
/dev/mmcblk0p3: LABEL="SETTINGS" UUID="7cc3c451-5b28-4fea-8eec-f7c2725966fb" TYPE="ext4"
/dev/mmcblk0p5: LABEL="boot0" UUID="019E-DE96" TYPE="vfat"
/dev/mmcblk0p6: LABEL="root" UUID="cc9b7456-235e-4718-8e53-faa76242e5f3" TYPE="ext4"
/dev/sda1: UUID="cda18eda-8de5-43a1-a629-6737f5752f15" SEC_TYPE="ext2" TYPE="ext3"

Add the drive to the file system table:

sudo vi /etc/fstab

UUID=cda18eda-8de5-43a1-a629-6737f5752f15 /mnt/hdd1 ext3 defaults,errors=remount-ro 0 1

Reboot and the drive should be mounted!

Raspberry Pi: Setting up remote access via TightVNC Server

Install the server on the pi:

sudo apt-get install tightvncserver

Now set up the server to start tightvncserver at boot:

Paste the following into /etc/init.d/tightvnc. You will want to configure the line starting with /usr/bin/tightvncserver. The Pi can do 1920×1080 so that would be the max resolution.

# First configure the user you want to run this under - this will generally be pi, unless you've created your own users
export USER='pi'

eval cd ~$USER

# Check the state of the command - this'll either be start or stop
case "$1" in
    # if it's start, then start vncserver using the details below
    su $USER -c '/usr/bin/vncserver :1 -geometry 1366x768 -depth 24 -pixelformat rgb565'
    echo "Starting vncserver for $USER "
    # if it's stop, then just kill the process
    pkill Xtightvnc
    echo "vncserver stopped"
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
exit 0


sudo chmod +x /etc/init.d/tightvncserver

Now add the script at startup via update-rc.d:

sudo update-rc.d tightvncserver defaults

Now you can access the remote desktop using Ubuntu’s Remote Desktop Viewer tool by entering the Pi’s IP followed by  :1. For example “”

Windows has a variety of clients that can be used too.

For more info see

Setting up Rasbmc (XBMC) on a Raspberry Pi

Raspberry Pi in Action

This is a cheap way to get a high quality and flexible media center sitting under (or in my case, behind) your TV.


From Windows:

  1. Download the installer
  2. Insert your SD card into the computer.
  3. Unzip and run the raspbmc-win32 installer.
  4. Once that is done, stick the card into the Pi and give it some power.
  5. Wait while it installs the root system (grab a coffee!) This should take about 15 minutes, then with a little luck the Pi will reboot twice, run it’s automatic updater, reboot again, then finally open into XBMC .
  6. Note down the IP that is assigned to the Pi as it flashes up, or work it out by checking your router.
  7. Set up your remote. I use Yatse on my Android devices. Otherwise plug in a keyboard or mouse. I’m assuming you can get some input sorted.
  8. Go Settings -> System -> Video -> Video Output and calibrate the TV (otherwise the left sidebar ends up off screen for me).
  9. Add your content. Go Video -> Files -> Files -> Add Videos…
  10. Click browse and choose your directory (root file system / media for me)
  11. Then choose the type of Video you are adding. I’m only adding home videos, but I imagine selecting something here will check online services when you add content and pull down more information and images about that piece of content.
  12. Repeat till you’ve got all your videos and music set up.
  13. Enjoy your raspbmc media center!
  14. Be sure to power it down before resetting it.

That’s the basic install, below is the more advanced stuff.

Setup SSH

  1. SSH will be running on the Pi so shell into the ip and login using the default login, ‘pi’ with password ‘raspberry’.
  2. Select your locale – I choose en_AU UTF8 and en_AU ISO-8859-1. Sit back while locales are generated.
  3. Choose your location. Tip: Australia is one above what you can see by default. Finally you will be dumped at the CLI.
  4. sudo apt-get update (DO NOT do upgrade, currently that breaks the system completely – See:


Install transmission

sudo apt-get install transmission-daemon

Set it to run at startup –

sudo update-rc.d transmission-daemon defaults

Edit the transmission settings file

sudo vi /etc/transmission-daemon/settings.json

change rpc-whitelist-enabled to false

sudo /etc/init.d/transmission-daemon restart

Next we change the mount status of our usb drive so transmission can write to the drive.

First get the drive name:

sudo fdisk -l

Then match the drive name, such as /dev/sdb1 to the UUID:

ls -l /dev/disk/by-uuid

In my case it is 6CBA-812B

Now, edit fstab:

sudo vi /etc/fstab

Add a line like the following:

UUID=6CBA-812B /media/mediatomb vfat defaults,auto,umask=000,users,rw 0 0

Make the mediatomb directory:

sudo mkdir /media/mediatomb

Test with sudo mount -a then reboot and check the drive automounted.