{"id":7817,"date":"2019-01-11T14:57:04","date_gmt":"2019-01-11T14:57:04","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=7817"},"modified":"2019-01-12T08:56:35","modified_gmt":"2019-01-12T08:56:35","slug":"recover-deleted-files-on-debian-and-ubuntu","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/01\/11\/recover-deleted-files-on-debian-and-ubuntu\/","title":{"rendered":"Recover Deleted Files on Debian and Ubuntu"},"content":{"rendered":"<h1 class=\"post-title\">ext3grep \u2013 Recover Deleted Files on Debian and Ubuntu<\/h1>\n<p>ext3grep is a simple program for recovering files on an EXT3 filesystem. It is an investigation and recovery tool that is useful in forensics investigations. It helps to show information about files that existed on a partition and also recover accidentally deleted files.<\/p>\n<p>In this article, we will demonstrate a useful trick, that will help you to recover accidentally deleted files on ext3 filesystems using ext3grep in Debian and Ubuntu.<\/p>\n<h4>Testing Scenario<\/h4>\n<ul>\n<li>Device name:\u00a0<strong>\/dev\/sdb1<\/strong><\/li>\n<li>Mount point:\u00a0<strong>\/mnt\/TEST_DRIVE<\/strong><\/li>\n<li>Filesystem type:\u00a0<strong>EXT3<\/strong><\/li>\n<\/ul>\n<h3>How to Recover Deleted Files Using ext3grep Tool<\/h3>\n<p>To\u00a0<a href=\"https:\/\/www.tecmint.com\/recover-deleted-file-in-linux\/\" target=\"_blank\" rel=\"noopener\">recover deleted files<\/a>, first you need to install\u00a0<strong>ext3grep<\/strong>\u00a0program on your Ubuntu or Debian system using\u00a0<a href=\"https:\/\/www.tecmint.com\/apt-advanced-package-command-examples-in-ubuntu\/\" target=\"_blank\" rel=\"noopener\">APT package manager<\/a>\u00a0as shown.<\/p>\n<pre>$ sudo apt install ext3grep\r\n<\/pre>\n<p>Once installed, now we will demonstrate how to recover deleted files on a ext3 filesystem.<\/p>\n<p>First, we will create some files for testing purpose in the mount point\u00a0<code>\/mnt\/TEST_DRIVE<\/code>\u00a0of the ext3 partition\/device i.e.\u00a0<code>\/dev\/sdb1<\/code>\u00a0in this case.<\/p>\n<pre>$ cd \/mnt\/TEST_DRIVE\r\n$ sudo touch files[1-5]\r\n$ ls -l\r\n<\/pre>\n<div id=\"attachment_31520\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/Create-Testing-Files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31520\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/Create-Testing-Files.png\" alt=\"Create Files in Mount Point\" width=\"652\" height=\"211\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Create Files in Mount Point<\/p>\n<\/div>\n<p>Now we will remove one file called\u00a0<code>file5<\/code>\u00a0from the mount point\u00a0<code>\/mnt\/TEST_DRIVE<\/code>\u00a0of the ext3 partition.<\/p>\n<pre>$ sudo rm file5\r\n<\/pre>\n<div id=\"attachment_31521\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/remove-a-file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31521\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/remove-a-file.png\" alt=\"Remove a File in Linux\" width=\"652\" height=\"192\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Remove a File in Linux<\/p>\n<\/div>\n<p>Now we will see how to recover deleted file using\u00a0<strong>ext3grep<\/strong>\u00a0program on the targeted partition. First, we need to unmount it from the mount point above (note that you have to use\u00a0<a href=\"https:\/\/www.tecmint.com\/cd-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">cd command<\/a>\u00a0to switch to another directory for the unmount operation to work, otherwise the\u00a0<strong>umount<\/strong>\u00a0command will show the error \u201c<strong>that target is busy<\/strong>\u201c).<\/p>\n<pre>$ cd\r\n$sudo umount \/mnt\/TEST_DRIVE\r\n<\/pre>\n<p>Now that we have deleted one of the files (which we\u2019ll assume was done accidentally), to view all the files that existed in the device, run the\u00a0<code>--dump-name<\/code>\u00a0option (replace\u00a0<code>\/dev\/sdb1<\/code>\u00a0with the actual device name).<\/p>\n<pre>$ ext3grep --dump-name \/dev\/sdb1\r\n<\/pre>\n<div id=\"attachment_31522\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/view-all-files-that-existed-in-ext3-partition-before-deletion.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31522\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/view-all-files-that-existed-in-ext3-partition-before-deletion.png\" alt=\"View Files on Partition\" width=\"658\" height=\"692\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">View Files on Partition<\/p>\n<\/div>\n<p>To recover the above deleted file i.e.\u00a0<code>file5<\/code>, we use the\u00a0<code>--restore-all<\/code>\u00a0option as shown.<\/p>\n<pre>$ ext3grep --restore-all \/dev\/sdb1\r\n<\/pre>\n<p>Once the recovery process is complete, all recovered files will be written to the directory\u00a0<strong>RESTORED_FILES<\/strong>, you can check if the deleted file is recovered or not.<\/p>\n<pre>$ cd RESTORED_FILES\r\n$ ls \r\n<\/pre>\n<div id=\"attachment_31523\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/restore-deleted-file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31523\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/restore-deleted-file.png\" sizes=\"auto, (max-width: 822px) 100vw, 822px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/restore-deleted-file.png 822w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/restore-deleted-file-768x463.png 768w\" alt=\"Recover a Deleted File\" width=\"822\" height=\"496\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Recover a Deleted File<\/p>\n<\/div>\n<p>We may specify a particular file to recover, for example the file called\u00a0<code>file5<\/code>\u00a0(or specify the full path of the file within the ext3 device).<\/p>\n<pre>$ ext3grep --restore-file file5 \/dev\/sdb1 \r\nOR\r\n$ ext3grep --restore-file \/path\/to\/some\/file \/dev\/sdb1 \r\n<\/pre>\n<p>In addition, we can also restore files within a given period of time. For example, simply specify the correct date and time frame as shown.<\/p>\n<pre>$ ext3grep --restore-all --after `date -d 'Jan 1 2019 9:00am' '+%s'` --before `date -d 'Jan 5 2019 00:00am' '+%s'` \/dev\/sdb1 \r\n<\/pre>\n<p>For more information, see the ext3grep man page.<\/p>\n<pre>$ man ext3grep\r\n<\/pre>\n<p>That\u2019s it!\u00a0<strong>ext3grep<\/strong>\u00a0is a simple and useful tool to investigate and recover deleted files on an ext3 filesystem. It is one of the the best programs to recover files on Linux. If you have any questions or any thoughts to share, reach us via the feedback form below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/ext3grep-recover-deleted-files-on-ubuntu-debian\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ext3grep \u2013 Recover Deleted Files on Debian and Ubuntu ext3grep is a simple program for recovering files on an EXT3 filesystem. It is an investigation and recovery tool that is useful in forensics investigations. It helps to show information about files that existed on a partition and also recover accidentally deleted files. In this article, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/01\/11\/recover-deleted-files-on-debian-and-ubuntu\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Recover Deleted Files on Debian and Ubuntu&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7817","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/7817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=7817"}],"version-history":[{"count":3,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/7817\/revisions"}],"predecessor-version":[{"id":7947,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/7817\/revisions\/7947"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=7817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=7817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=7817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}