-
Notifications
You must be signed in to change notification settings - Fork 12
Setting up an external data drive
Brad Smith edited this page Jan 26, 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:
- Connect the disk to the device, boot it up, and log in as root (or run
sudo -i) - Identify the device name of the disk.
-
fdisk -lcan help with this - On a cubietruck, if you are booted from an SD card the hard disk should always be
/dev/sdb
- BE SURE YOU GOT THE RIGHT DEVICE NAME! The next step will destroy everything on it.
- Format the disk and apply a label to identify it:
-
mkfs.ext4 -L TUNAPANDA_DATA /dev/sdX(replaceXwith the correct device name)
- Mount the disk in a temporary location and move any existing data to it
mount LABEL=TUNAPANDA_DATA /mntmv /usr/local/tunapanda/data/* /mnt/
- 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 /mntmount LABEL=TUNAPANDA_DATA /usr/local/tunapanda/datareboot
- When the device comes back up, use
df -hto confirm that the hard disk is mounted intunapanda/data