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

Thread: Can I undelete files from ext4?

  1. #1
    Join Date
    Jul 2010
    Beans
    166

    Can I undelete files from ext4?

    I accidentally deleted everything on a ext4 hard drive. It was deleted not formated. Not a single byte has been written to it since.

    Is there a tool to recover the files to another hdd?

  2. #2
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

  3. #3
    Join Date
    Nov 2008
    Beans
    Hidden!

    Re: Can I undelete files from ext4?

    I have successfully used TestDisk for this

    http://www.cgsecurity.org/wiki/TestDisk

  4. #4
    Join Date
    Jul 2010
    Beans
    166

    Re: Can I undelete files from ext4?

    Testdisk seems really cool but I don't see a "Linux" partition table type?

    Code:
    Please select the partition table type, press Enter when done.
    [Intel  ]  Intel/PC partition
    [EFI GPT]  EFI GPT partition map (Mac i386, some x86_64...)
    [Mac    ]  Apple partition map
    [None   ]  Non partitioned media
    [Sun    ]  Sun Solaris partition
    [XBox   ]  XBox partition
    [Return ]  Return to disk selection

  5. #5
    Join Date
    Nov 2008
    Beans
    Hidden!

    Re: Can I undelete files from ext4?

    too bad, not going to happen with testdisk. there are other ways, perhaps you can find one that will work for you...search here.

  6. #6
    Join Date
    Jul 2010
    Beans
    166

    Re: Can I undelete files from ext4?

    Quote Originally Posted by jerrrys View Post
    too bad, not going to happen with testdisk. there are other ways, perhaps you can find one that will work for you...search here.

    Why can it not happen with testdisk?

    I was "testing" testdisk on a 100% good ext4 linux hdd. I just don't see a "Linux" partition table type listed below...

    Code:
    Please select the partition table type, press Enter when done.
    [Intel  ]  Intel/PC partition
    [EFI GPT]  EFI GPT partition map (Mac i386, some x86_64...)
    [Mac    ]  Apple partition map
    [None   ]  Non partitioned media
    [Sun    ]  Sun Solaris partition
    [XBox   ]  XBox partition
    [Return ]  Return to disk selection
    But the wiki you listed
    http://www.cgsecurity.org/wiki/TestDisk

    says it works on ext4 formated partitions.

    Copy files from deleted FAT, exFAT, NTFS and ext2/ext3/ext4 partitions.
    I can not find the "Linux" option for the life of me? All I see is Intel, EFI GPT, Mac, None, Sun, and Xbox.

    -
    Last edited by Keypel; July 14th, 2011 at 06:17 PM.

  7. #7
    Join Date
    Nov 2008
    Beans
    Hidden!

    Re: Can I undelete files from ext4?

    because the two times i needed it, it just worked in about 30 seconds. with you, it did not and i do not know what else can be done from there...goodluck
    Last edited by jerrrys; July 14th, 2011 at 06:13 PM.

  8. #8
    Join Date
    Apr 2010
    Location
    England
    Beans
    3,286

    Re: Can I undelete files from ext4?

    There is no such thing as a Linux partition table type. You're most likely using an Intel partition table, unless you've specifically formatted the disk to use a GPT partition table, or are using a Mac.

    Note that "partition table" does not mean "partition". As you can probably guess, partitions sit within the partition table.
    http://xkcd.com/293/
    There are 10 kinds of people in this world: Those who understand ternary, those who don't, and those who confuse it with binary.

  9. #9
    Join Date
    Jul 2010
    Beans
    166

    Re: Can I undelete files from ext4?

    Quote Originally Posted by WorMzy View Post
    There is no such thing as a Linux partition table type. You're most likely using an Intel partition table, unless you've specifically formatted the disk to use a GPT partition table, or are using a Mac.

    Note that "partition table" does not mean "partition". As you can probably guess, partitions sit within the partition table.
    Thanks for the useful reply.

    Is there a way to tell if a hdd is mbr or gpt?

  10. #10
    Join Date
    Mar 2010
    Location
    Woonsocket, RI USA
    Beans
    3,195

    Re: Can I undelete files from ext4?

    To elaborate a bit on what WorMzy wrote, a typical hard disk contains several levels of data structures:


    • Partition table -- This controls the way partitions are defined -- their start points, end points, type code, etc. The most common partition table types are the Master Boot Record (MBR; aka MSDOS partitions, Intel partitions, BIOS partitions; used on most PCs), the Apple Partition Map (APM; used on 680x0- and PowerPC-based Macs), and the GUID partition Table (GPT; used on Intel-based Macs and a few PCs and some other platforms).
    • Filesystems -- These reside inside partitions and provide the means to locate individual files. Examples include ext2/3/4fs, ReiserFS, XFS, JFS, Btrfs, FAT, NTFS, HFS, and HFS+. Any filesystem can exist on a partition defined using any partition table type. Filesystem data structures are much more complex than are partition table data structures.
    • File types -- Files on a filesystem have their own formats, such as ASCII text, JPEGs, MP3s, MS Word files, Linux executable program files, etc. Any file type can reside on any filesystem, although filesystems sometimes impose limits, such as file-size limits, that can be relevant.



    It's unclear to me precisely what Keypel did, but it sounds like it was deleting files within the ext4 filesystem, in which case the partition table was unaffected. If this is what happened, then TestDisk will be useless, since it's designed to recover a filesystem whose partition table entry has been lost. Instead, PhotoRec may be useful; it can recover files that have been deleted from healthy filesystems or from filesystems that have been damaged. PhotoRec won't recover everything to exactly its original state, though; it'll take a lot of manual effort to figure out what each and every recovered file actually is. Thus, PhotoRec can be good at recovering personal files, but if you want to recover a bootable Linux system, re-installation is a better choice. (If you need to do both, though, be sure to recover your personal files before you re-install! If you do it the other way around, the re-installation may overwrite your personal files, making it impossible to recover them.)

    Quote Originally Posted by Keypel
    Is there a way to tell if a hdd is mbr or gpt?
    Yes. Many disk utilities will display this information. For instance:

    Code:
    $ sudo parted /dev/sda print
    Model: ATA Hitachi HDP72505 (scsi)
    Disk /dev/sda: 500GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    I've omitted additional input; but note that last line, which identifies the partition table type. Many other partitioning tools provide this information in one way or another, but it's highly specific to the particular program.

    I don't think this is really very important to your problem, though, unless I've misunderstood what's happened. I recommend you elaborate on what happened:


    [list][*]How did you accidentally delete everything? Did you use a file manager and drag-and-drop files to the Trash? Did you use "rm -r"? Did you use "mkfs /dev/sda{whatever}"? Did you use "dd if=/dev/zero of=/dev/sda{whatever}"? Did you use a really powerful magnet?[*]What do you want to recover -- personal files, the OS installation, or both?[*]What output results when you type "sudo fdisk -lu"? (Please post the results between [code] and [/code] tags or it will become difficult to interpret.)[*]What output results when you type "sudo blkid"?
    If I've suggested a solution to a problem and you're not the original poster, do not try my solution! Problems can seem similar but be different, and a good solution to one problem can make another worse. Post a new thread with your problem details.

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
  •