Recover accidently deleted Libreoffice document .odt files using Scalpel

  10 years ago

Scalpel is a very handy tool for recovering accidently deleted Libre Office Document .odt files. Although it can also be used for recovering other files but this tutorial is confined for recovering .odt files.


1. Install Scalpel from Software Centre or by typing following command in terminal:

sudo apt-get install scalpel


2. By default, scalpel does not have provision for recovering files having extension .odt So scalpel config file has to be modified a little bit to achieve this. Add these lines in the end of scalpel configuration file located at /etc/scalpel/scalpel.conf.


# Added to end of /etc/scalpel/scalpel.conf
    odt y   20000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.textPK META-INF/manifest.xmlPK????????????????????
    ods y   10000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.spreadsheetPK  META-INF/manifest.xmlPK????????????????????
    odp y   10000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.presentationPK META-INF/manifest.xmlPK????????????????????
#    odg y   10000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.graphicsPK META-INF/manifest.xmlPK????????????????????
#    odc y   10000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.chartPK    META-INF/manifest.xmlPK????????????????????
#    odf y   10000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.formulaPK  META-INF/manifest.xmlPK????????????????????
#    odi y   10000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.imagePK    META-INF/manifest.xmlPK????????????????????
#    odm y   10000000    PK????????????????????????????mimetypeapplication/vnd.oasis.opendocument.text-masterPK  META-INF/manifest.xmlPK????????????????????
#    sxw y   10000000    PK????????????????????????????mimetypeapplication/vnd.sun.xml.writerPK  META-INF/manifest.xmlPK????????????????????

Uncoment the file types which you want to recover by removing # in front of it. In this case, its odt. All other should be commented by putting # in front of them as this will reduce time and save disk space to get blotted by unwanted stuff.  Read instructions given in configuration file for further assistance.


3. Find the location of the partition (whose files are to be recovered) by typing following command or by any other method you know


For this tutorial I am taking /dev/sdb1 which is my pen drive.


4. Create a folder where recovered files have to be placed. Folder must be in some other partition and that partition should have abundant free space. For this tutorial, I am creating folder scalpel-recovered-files in partition /dev/sda8. Also find the mount point for that partition which will be used in next step. My mount point is /media/sda8.


5. Now open terminal and run the following command:

sudo scalpel /dev/sdb1 -b -o /media/sda8/scalpel-recovered-files

Here /dev/sdb1 is the partition from where files are are deleted accidently and /media/sda8/scalpel-recovered-files is the location of recovered files i.e. Files will be recovered in folder scalpel-recovered-files located at sda8 partition. Note that I have written /media/sda8 instead of /dev/sda8 because location has to be specified with respect to mount point.

I have written this tutorial by using my own partition structure and mount points.. Your addresses will vary according to your system's partition table.


6. Next step is to find the required file. This is difficult and time consuming process but if file is really important, these things doesn't matter. After recovery process, lot of files will be recovered in different folders. The number may vary from tens to thousands of files depending on partition size and other factors. Files will not have the same name. They will be named differently. To find the required file, you may have to open each file and look for data in it to recognize it. Even one file may have many recovered files for it depending upon number of times you have saved the file and number of times it is autosaved. For example if a file is saved 5 times during editing, there might be 5 recovered files for that single file and each file will contain data upto its saving point. You have to pick the file carefully among similar ones so that it is the last one saved.



1. While running scalpel command (see 5th step) use /dev/xxxy for describing partition whose files are lost and /media/exact/mount/point for partition being used for storing recovered files. If /media/xxxy is used in describing partition whose files are deleted or /dev/xxy is written for recovery partition,  scalpel may not work. So follow the pattern properly.

2. Partition used for recovered files must be different from the partition containing deleted items. If same partition is given for recovered files, there are chances that deleted files still stored somewhere on disk space might get overwritten by recovered files, thereby reducing the chance of recovery.

3. (Not For new users) File size limit has been set to 20 MB (20000000bytes) in above lines (second column). Change the size if deleted file is larger than 20 MB or reduce it to use it as filter to avoid recovering large files For example, if file size is set to 1 MB, it will recover only those files which arefiles less than 1 MB in size.


Original Tutorial:

Uttareshwar 8 years ago

Nice one

jahid_0903014 10 years ago

i need to try this...