Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detector for Ephemeral Home Directory [Will Open Pull Request Soon] #658

Open
StanHatko opened this issue Aug 28, 2024 · 0 comments
Open

Comments

@StanHatko
Copy link
Contributor

I have working code that detects persistent vs. non-persistent home directories. It warns users which places are persistent and which do not persist between reboots.

We should add this bash script to the system and invoke it in .bashrc (I already verified this works). Already at least one person was confused about conda environments disappearing and this should greatly reduce users not remembering and losing files.

I will add this to the system and open a pull request soon (today or tomorrow), I just need to check again where things like this are added in the pipeline.

The code is:

#!/bin/bash
#Checks if home drive is not mounted and raises warning in that case.

home_mount_fs=$(df /home/jovyan/ | tail -n 1 | perl -pe 's/.* \//\//')

if [[ "$home_mount_fs" == "/home/jovyan" ]]; then
    echo "The home directory /home/jovyan (aliased to ~) is saved on a workspace volume."
    echo "The contents of this directory persist between reboots. This includes installed packages, virtual environments, conda environments, etc."
    echo "Anything saved outside this folder will be deleted between reboots."
    echo "It's still strongly recommended to backup all important files (for instance, pushing code changes to GitLab)."
elif [[ "$home_mount_fs" == "/" ]]; then
    echo "WARNING: The home directory is not persistent as a workspace volume has not been set."
    echo "All contents of this server (including the home directory /home/jovyan, aliased to ~) will be deleted when the server is rebooted."
    echo "This includes installed packages, virtual environments, conda environments, etc. These will need to be reinstalled every time the server is rebooted."
    echo "Any files or data you wish to keep need to be backed up outside the server (for instance, pushing code changes to GitLab)."
    echo "If this is not desired, please create a new notebook server that includes a workspace volume."
else
    echo "Unable to detect if home directory is persistent (/home/jovyan, aliased to ~)."
    echo "If the server is rebooted, it's possible the contents of that folder (along with everything else) could be lost, so be sure to save anything of value outside the server."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant