Skip to content

recovering deleted files

0

How can I restore deleted files on a SageMaker Notebook instance? I think the deleted files are somewhere in a directory such as ~/.local/share/Trash/files/ since the '/dev/nvme2n1' utilization did not change after I deleted the files.

asked 3 years ago5.6K views

2 Answers
0
Accepted Answer

I found the deleted files tracking the files with large size. The path is: /home/ec2-user/SageMaker/.Trash-1000/files

answered 3 years ago

0

If you've deleted files in a SageMaker Notebook instance and suspect they might be in the trash directory, you can attempt to recover them using the following steps:

1. Access the Terminal in SageMaker:

  • Open your Jupyter or JupyterLab interface on the SageMaker Notebook instance.
  • Launch a terminal. In Jupyter, you can find this option in the "New" dropdown menu as "Terminal". In JupyterLab, it's in the "Launcher" tab.

2. Navigate to the Trash Directory: In the terminal, navigate to the trash directory by entering: cd ~/.local/share/Trash/files/

3. List the Files: Check to see if your deleted files are present: ls -la

4.Recover the Files: If you find your files, you can move them back to the desired location using the mv command. For example, to move a file named file.txt back to your home directory: mv file.txt ~/file.txt

5. Clear the Trash (Optional): If you're concerned about disk space, once you've confirmed that you've successfully recovered all necessary files, you can empty the trash: rm -rf ~/.local/share/Trash/files/*

6. Note: If you're using a different file browser or tool within SageMaker (or a custom environment), the trash location might be different. The above steps assume a standard Jupyter/JupyterLab setup.

7. Backup Important Files: As a best practice, always backup important files and data. SageMaker notebook instances are ephemeral, and any data stored on them can be lost if the instance is stopped or terminated.

If you've tried the above steps and can't find your files, it's possible they've been permanently deleted or are stored in a different trash or temporary location. In such cases, unless you have backups, the data might be irretrievable.

answered 3 years ago

  • Thanks for the comments. I have already tried to navigate to the Trash file as explained in the 2nd step but got 'No such file or directory' message. Most probably the files have been stored in a different trash or temporary location which is out of reach.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.