@@ -34,3 +34,51 @@ Backup option (future directions if you even run out of GCP credits - not needed
[Azure Directions](azure/README.md). At the time these directions
were written, Microsoft offers students $100/year of credit per year.
These directions might be a bit stale.
# **Note:** How to Stop and Start your VM
**Important: Before you begin this process, make sure to save all your progress by pushing it to your Git repository. If you are unsure how to do this, refer to the [git-workflows](../../git-workflows/README.md) document for guidance.**
Throughout the semester, you might run out of RAM on your VM. RAM (Random Access Memory) is different from the persistent storage (disk space) on your VM, which is much larger. RAM is the memory used to run programs and handle active processes on your VM, while storage is where files and data are saved permanently.
Running out of RAM can happen for multiple reasons, such as running large programs or running them for extended periods, as they can accumulate data in memory. In our case, the most common reason for running out of RAM is Jupyter Notebook. While it is constantly running to maintain the SSH tunnel to your browser, it accumulates a large amount of metadata, which can consume significant memory over time.
To check how much memory (RAM) you have left on your VM, run the command `htop` in the terminal. You will see an output similar to this:
<imgsrc="img/htop.png"/>
At the top, look for the bar labeled **"Mem"**. If you notice this bar is nearly full, it might be a good time to stop and restart your VM. In the example above, the memory usage is almost at its limit.
**Note:** Stopping your VM will terminate all processes running on it. If you have active processes, stopping the VM could result in data loss or corruption. **Make sure to save your work before proceeding.**
## Steps to Stop and Resume Your VM
1. Open your browser and go to **Google Cloud > Console > Compute Engine > VM Instances**.
2. Locate your VM under "VM Instances."
<imgsrc="img/vm.png"/>
3. Click on the three vertical dots next to your VM.
<imgsrc="img/options.png"/>
4. Select **"Stop"** from the dropdown menu.
5. You will see a warning about potential data loss. Confirm by clicking **"Stop"** again.
Wait a few minutes for your VM to shut down. You can monitor its status under the "Status" column. Once it shows **Stopped**:
6. Click on the three vertical dots again and select **"Start/Resume."**
<imgsrc="img/options.png"/>
**Note:** After restarting, your VM will have a new external IP address. You will need this updated IP to SSH into your VM.
## Reconnecting and Restarting JupyterLab
Once your VM is running again:
1. SSH into your VM using the new external IP.
2. Run the following commands to restart JupyterLab: