Created
November 8, 2022 08:12
-
-
Save anseljh/132cf07efa1e07b6be2e1b5febcada87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add a Digital Ocean storage Volume and move your whole Mastodon directory into it! | |
# Ansel Halliburton | |
# https://github.com/anseljh | |
# Unmount the volume's current mountpoint | |
# /dev/sda on /mnt/masty_vol_1 type ext4 (rw,noatime,discard) | |
umount /dev/sda | |
# Stop services | |
# We keep nginx up so it can at least serve a 500 error. | |
systemctl stop mastodon-web mastodon-sidekiq mastodon-streaming postgresql redis | |
# Move Mastodon folder to temp location | |
mv /home/mastodon /home/mastodon_temp | |
# Make a new empty folder at the original location | |
mkdir /home/mastodon | |
# Make mastodon user the owner of the folder | |
chown mastodon:mastodon /home/mastodon | |
# Mount volume to previous folder location | |
# https://docs.digitalocean.com/products/volumes/how-to/mount/ | |
mount -o defaults,nofail,discard,noatime /dev/sda /home/mastodon | |
# Check mount | |
findmnt /home/mastodon | |
# Move contents | |
mv /home/mastodon_temp/* /home/mastodon | |
## Note: This did not copy the dotfiles!!! | |
# Start services | |
systemctl start mastodon-web mastodon-sidekiq mastodon-streaming postgresql redis | |
systemctl reload nginx | |
# Update fstab so the volume mounts on boot | |
# https://docs.digitalocean.com/products/volumes/how-to/mount/ | |
echo "/dev/sda /home/mastodon ext4 defaults,nofail,discard,noatime 0 2" >> /etc/fstab | |
# Verify mounts are OK | |
# https://docs.digitalocean.com/products/volumes/how-to/mount/ | |
findmnt --verify --verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment