Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Recover deleted folders and their contents

  1. #1
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,270
    Distro
    Ubuntu 12.04 Precise Pangolin

    Recover deleted folders and their contents

    I know this has probably been asked before, but my head is spinning a bit and I need some gentle guidance…

    I have a partition formatted as ext4.

    1. I mounted the partition.
    2. I accidentally deleted three or four folders from the root of the partition.
    3. I did nothing else whatsoever on the partition (no creating files, no editing, nothing).
    4. I dismounted the partition.

    Then I repeated this process on my backup partition, so the backups are also gone!

    (Slaps head in frustration and cries out, "Doh!" This will teach me not to do backup work after I have taken my meds! )

    How can I recover those folders and their contents?
    Problems with WINE?
    Full Circle Magazine :: Confused "allot"? :: Cheap Linux stickers
    In my day, we had outdoors in which to run, play, and socialise. Now we have computers to do those.

  2. #2
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    9,108
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Recover deleted folders and their contents

    Paddy; Hi !

    I am aware of this that "might" get your files back. Might be to your good to spend the time and effort in the research and see if you think it is doable from ubuntu.
    http://linux.sys-con.com/node/117909?page=0,0

    I would say luck to ya -- but it is mental effort that rewards.
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubutu'n !

  3. #3
    Join Date
    Oct 2011
    Location
    ZZ9 Plural Z Alpha
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Recover deleted folders and their contents

    Hey Paddy;

    Guess you used rm to delete? (in other words, it's not as simple as checking Root's "trash"?)
    Testdisk may be your best option.

  4. #4
    Join Date
    Nov 2008
    Location
    Magdalena,New Mexico,USA
    Beans
    541
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Recover deleted folders and their contents

    take a look at testdisk...it may be what you need....go here:

    http://www.cgsecurity.org/wiki/TestDisk
    Registered Linux User # 529389
    Linux Mint 17.2 Rafaela, Fedora 22, Arch Linux
    my improved web page http://users.gilanet.com/~tfrost

  5. #5
    Join Date
    Jan 2012
    Beans
    753

    Re: Recover deleted folders and their contents

    Yeah, I'd go with testdisk as well. But be warned, it's hard, if not impossible, to completely recover files from an ext4 filesystem. Once I accidentally deleted everything in /home and tried using testdisk/photorec to recover the files... I got a few files, but no filenames, directories, etc. Just randomly named files and corrupt files. So I wouldn't get my hopes up on recovering everything back to the way it was.

  6. #6
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,270
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Recover deleted folders and their contents

    Thank you for all of your responses. Yes, it was a rm command — well, actually done with rsync.

    I'm about to try Test Disk, which I see is available on the standard repositories.

    Wish me luck. I'll post my results.
    Problems with WINE?
    Full Circle Magazine :: Confused "allot"? :: Cheap Linux stickers
    In my day, we had outdoors in which to run, play, and socialise. Now we have computers to do those.

  7. #7
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,270
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Recover deleted folders and their contents

    My results, unfortunately, are a big fat zero.

    Test Disk finds the deleted folders without any problem, but reports each folder as being completely empty.

    So, that means that I cannot restore the files.

    Unless you have any clever suggestions, I shall have to live with their loss. Thank heavens my critical files are all backed up in the "cloud". These files are inconvenient to lose, but not devastating.
    Problems with WINE?
    Full Circle Magazine :: Confused "allot"? :: Cheap Linux stickers
    In my day, we had outdoors in which to run, play, and socialise. Now we have computers to do those.

  8. #8
    Join Date
    Jan 2012
    Beans
    753

    Re: Recover deleted folders and their contents

    When you used TestDisk, the drive was mounted read-only, right? If it's mounted read-write then that can overwrite some of the deleted data you want to recover.

    Also here's a suggestion. Before you start using the drive again, back up the whole partition to another drive (which can fit it of course).
    Code:
    sudo dd if=/dev/sdb1 of=/media/backup/sdb1.img # assuming sdb1 is the partition which you accidentally deleted files from
    That way, if you ever in the future find a way to recover deleted files, you still have the drive image to work on. Low-level copying utilities like dd copy everything exactly as it is present on the disk, independent of the state of the filesystem (unlike commands like cp). This includes copying deleted files, corrupt date, filesystem errors, etc.

    Also did you try PhotoRec, or is that done automatically by TestDisk. TestDisk, if I remember correctly, is used for fixing corrupt partitions with damaged filesystems, etc, whereas PhotoRec is desiged to recover deleted files on a working filesystem.

  9. #9
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,270
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Recover deleted folders and their contents

    Quote Originally Posted by Stonecold1995 View Post
    Also did you try PhotoRec, or is that done automatically by TestDisk. TestDisk, if I remember correctly, is used for fixing corrupt partitions with damaged filesystems, etc, whereas PhotoRec is desiged to recover deleted files on a working filesystem.
    Thank you for that clarification; I was unaware of it. No, TestDisk does not run PhotoRec. TestDisk took mere seconds to run.

    I am busy running PhotoRec now, which (it says) has over three hours to go. I'll post back once it has completed.

    Edit: Well, it's 1¾ hours later and it says it still has 4 hours to go. I'll wait patiently
    Last edited by Paddy Landau; May 6th, 2013 at 12:03 PM.
    Problems with WINE?
    Full Circle Magazine :: Confused "allot"? :: Cheap Linux stickers
    In my day, we had outdoors in which to run, play, and socialise. Now we have computers to do those.

  10. #10
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,793
    Distro
    Xubuntu 15.04 Vivid Vervet

    Re: Recover deleted folders and their contents

    PhotoRec creates lots of numbered folders, with lots of numbered files in each folder. No file or folder names - just sequential numbers. It will find many thousands of gif images from your browser cache. Sorting through the recovered files is a nightmare. If you are just looking for a few important documents, you could be thinking about what file contents you could search for while photorec is working. Good luck.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •