How to recover a file you accidentally deleted?

If you $HOME is on a ZFS file system[1] you can easily retrieve files you deleted from an automatic snapshot created by the system.

Just cd into the hidden .zfs directory and select one snapshot:
cd ~/.zfs/snapshot/
ls

Under each of the directories you will see your $HOME as it looked like at some point in the past. Just copy the wanted files from there to your actual $HOME and all should be alright again.

[1] Easy to find out with this command
mount | grep $(whoami)

If the line starts with a server named like s09. if it starts with hsm or the line contains qsm this will not work for you.

-- CarstenAulbert - 23 Jul 2010

DocumentationForm edit

Title How to recover a deleted file yourself
Description Use ZFS's snapshots to recover a file you accidentelly deleted
Tags zfs, file, recovery
Category User
This topic: ATLAS > WebHome > GeneralDocumentation > RecoverDeletedFiles
Topic revision: 10 Feb 2012, ArthurVarkentin
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback