Skip to content

Instantly share code, notes, and snippets.

@MRDGH2821
Last active May 9, 2024 15:07
Show Gist options
  • Save MRDGH2821/52ae47cba31e73d8e0fd8a69c49559bc to your computer and use it in GitHub Desktop.
Save MRDGH2821/52ae47cba31e73d8e0fd8a69c49559bc to your computer and use it in GitHub Desktop.
Symlinks Casa OS files to external storage
#!/usr/bin/env bash
# Made by https://github.com/MRDGH2821
# Migrates the /DATA sub folders to specified external storage.
# Run as sudo if there are problems in stoping or symlinking.
# Stops casa os & docker services to symlink folders without problems.
systemctl stop casaos*
systemctl stop docker*
# Change this to actual path of external hard drive
externalstorage="/media/devmon/sdb1-usb-Seagate_One_Touc"
# Creates DATA sub folder in external storage inside which Casa OS's sub folders will be symlinked.
mkdir -p $externalstorage/DATA/
folders=("Media AppData Documents Downloads Gallery")
for folder in $folders
do
mv /DATA/$folder $externalstorage/DATA/$folder
# If you are copying first then moving the contents, you may need this to copy the permissions also.
# chmod --reference=/DATA/$folder $externalstorage/DATA/$folder
ln -s $externalstorage/DATA/$folder /DATA/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment