How to Recover Deleted Files in AWS SageMaker Notebook
Hello, I'm Dang, an AI and machine learning engineer at Knowledgelabo, Inc. We provide a service called "Manageboard," which helps aggregate, analyze, and manage corporate data scattered throughout our organization. Manageboard is set to enhance its AI capabilities in the future. In my articles, I will share the challenges and solutions we encountered during our research and development.
The Risks of File Deletion
AWS SageMaker is one of the frequently used services for validating machine learning models and algorithms. However, when using JupyterLab in SageMaker notebooks, it's common to experience delays during the execution of heavy tasks. This delay can disrupt workflows and increase the risk of accidentally deleting important files. In particular, many users face issues related to file deletion.
There are several reasons for the delays that occur when executing heavy tasks. These can include insufficient computing resources, slow data loading speeds, and competition with other processes. These factors become especially noticeable when dealing with large datasets. Users may find it challenging to focus on other tasks while waiting for the execution of their current task to complete.
When delays occur, managing files becomes difficult, increasing the risk of accidentally deleting important files. Many sources recommend checking the directory ~/.local/share/Trash/files/
to recover deleted files. However, this directory does not exist in our environment.
Discovering an Alternative Solution
We found another directory, ~/SageMaker/.Trash-1000/files/, which retains deleted files. By using this directory, you can easily recover files that were accidentally deleted. The specific steps are as follows:
- Open the Terminal: Launch the terminal in your SageMaker notebook.
- Navigate to the Trash Directory: Enter the following command to move to the directory where deleted files are stored.
cd ~/SageMaker/.Trash-1000/files/
- Check for files: Display a list of the deleted files.
ls
- Recover the files: Once you find the necessary files, copy them back to their original location.
mv [filename] ~/SageMaker/
Conclusion
Working in SageMaker notebooks is incredibly powerful, but it can come with challenges related to delays and file management. Particularly, accidentally deleting files during the execution of heavy tasks can significantly impact your workflow. However, by utilizing the alternative solution provided by ~/SageMaker/.Trash-1000/files/
, you can easily recover deleted files. I hope this information proves helpful to other users facing the same issue.
Discussion