Skip to content

Setting up an external data drive

Brad Smith edited this page Mar 28, 2015 · 2 revisions

The cubietruck and other small devices do not have enough built-in storage space for large services like wikipedia and MOOCs, but can use a SATA hard disk for extra space. The external_data_drive role, which is required by the provision_base role, so it should be part of all deployments, adds a udev rule that auto-mounts a disk with a label matching the {{ external_data_drive__disklabel }} ansible variable (TUNPANDA_DATA by default) in the {{ external_data_drive__mountpoint }} directory (/usr/local/tunapanda/data/ by default). This directory is also where most services store their content.

So, to add a new hard disk that the system will know how to use, do the following:

  1. Connect the disk to the device, boot it up, and log in as root (or run sudo -i)
  2. Identify the device name of the disk.
  • fdisk -l can help with this
  • On a cubietruck, if you are booted from an SD card the hard disk should always be /dev/sda, and it should have one partition called /dev/sda1
  1. BE SURE YOU GOT THE RIGHT DEVICE NAME! The next step will destroy everything on it.
  2. Format the disk and apply a label to identify it:
  • mkfs.ext4 -L TUNAPANDA_DATA /dev/sdX1 (replace X with the correct device name)
  1. Mount the disk in a temporary location and move any existing data to it
  • mount LABEL=TUNAPANDA_DATA /mnt
  • mv /usr/local/tunapanda/data/* /mnt/
  1. Mount the disk in the right place (probably not necessary, but just in case it's needed for a clean shutdown), and reboot to test.
  • umount /mnt
  • mount LABEL=TUNAPANDA_DATA /usr/local/tunapanda/data
  • reboot
  1. When the device comes back up, use df -h to confirm that the hard disk is mounted in tunapanda/data