Test 3

Help › Add more space

Add a disk on DigitalOcean ($10 a month)

A DigitalOcean Volume is an extra disk for the server: 100 GB costs $10 a month. The steps move the uploaded files (and the backup copy of them) onto it, then raise the limit. Do them when few people are using SchoolStack: the site is off for a few minutes.

In the DigitalOcean website:

  1. Open your Droplet, choose Volumes ▸ Add Volume.
  2. Size 100 GB; name it schoolfiles; choose Automatically Format & Mount and Ext4; choose Create Volume.

In the Droplet's Console (paste one line at a time and press Enter; wait for each to finish):

  1. Check the new disk is there (it shows about 98G): df -h /mnt/schoolfiles
  2. Stop SchoolStack and its nightly backup: systemctl stop schoolstack schoolstack-backup.timer
  3. Make two folders on the new disk (the first belongs to SchoolStack): install -d -o schoolstack -g schoolstack -m 750 /mnt/schoolfiles/files && mkdir -p /mnt/schoolfiles/backup-files /var/backups/schoolstack/files
  4. Copy the uploaded files onto it (this can take a few minutes): cp -a /var/lib/schoolstack/files/. /mnt/schoolfiles/files/
  5. Copy the backup of the files onto it: cp -a /var/backups/schoolstack/files/. /mnt/schoolfiles/backup-files/
  6. Keep the old folders aside for now, and make empty ones in their place: mv /var/lib/schoolstack/files /var/lib/schoolstack/files-old && mv /var/backups/schoolstack/files /var/backups/schoolstack/files-old
  7. install -d -o schoolstack -g schoolstack -m 750 /var/lib/schoolstack/files && mkdir /var/backups/schoolstack/files
  8. Tell the server to use the new disk for both folders, now and after every restart: echo '/mnt/schoolfiles/files /var/lib/schoolstack/files none bind,nofail,x-systemd.requires-mounts-for=/mnt/schoolfiles 0 0' >> /etc/fstab
  9. echo '/mnt/schoolfiles/backup-files /var/backups/schoolstack/files none bind,nofail,x-systemd.requires-mounts-for=/mnt/schoolfiles 0 0' >> /etc/fstab
  10. systemctl daemon-reload && mount -a
  11. Check both folders are on the new disk (both lines show about 98G): df -h /var/lib/schoolstack/files /var/backups/schoolstack/files
  12. Raise the limit to 40 GB (the backup copy needs the same again): sed -i '/^SCHOOLSTACK_FLAGS=/ s/$/ --files-quota-mb 40000/' /etc/schoolstack/schoolstack.env
  13. Check it: grep FLAGS /etc/schoolstack/schoolstack.env shows --files-quota-mb 40000 at the end of the line. If it shows nothing, paste echo 'SCHOOLSTACK_FLAGS=--files-quota-mb 40000' >> /etc/schoolstack/schoolstack.env
  14. Start SchoolStack and its backup again: systemctl start schoolstack schoolstack-backup.timer
  15. Check it is running: systemctl status schoolstack says active (running). Open SchoolStack: the notice on Classes is gone, and lesson files still open.

A week later, when everything works, delete the old copies to free the server's own disk: rm -rf /var/lib/schoolstack/files-old /var/backups/schoolstack/files-old

If you ever run the installer (deploy/install.sh) again, paste step 12 again: the installer writes its own options. Updates (schoolstack-update) keep the limit.

Example: The warning says 96%. On Saturday morning the owner adds a 100 GB volume named schoolfiles, pastes the steps one at a time, and sees the notice gone. Teachers can upload again.

Related: When SchoolStack warns you · Where the data lives