cgsecurity / testdisk

TestDisk & PhotoRec
https://www.cgsecurity.org/
GNU General Public License v2.0
1.52k stars 189 forks source link

ReiserFS support install instruction #142

Closed mkgrgis closed 10 months ago

mkgrgis commented 10 months ago

Hello @cgsecurity ! Your utility have helped me many times with data recovery, but now I am frustrated around simple and yet implemented function - list ReserFS 3.6 files. In other cases after List files I can copy data to a safe place, but in my case .deb maintainer turned ReiserFS support off and I am trying to compile testdisk with ReiserFS functions.

According to https://www.cgsecurity.org/wiki/TestDisk_Compilation_FR

Bibliothèque ReiserFS Téléchargez progsreiserfs-0.3.1-rc8.tar.gz à partir de https://git.kernel.org/pub/scm/linux/kernel/git/jeffm/reiserfsprogs.git

My problem is progsreiserfs-0.3.1-rc8.tar.gz is very old and doesn't detect modern processors for gcc compilation. Contemporary stable versions look like reiserfsprogs-3.6.27.tar.gz. Also testdisk ./configure doesn't think there is -lreiserfs or libreserfs if I have latest stable reiserfsprogs in my system libreiserfscore.a, is it normal? Hence I can not base neither on .deb tesdisk, nor on progsreiserfs-0.3.1-rc8.tar.gz.

Could you please actualise compilation instruction and check compilation process of testdisk with some of modern progsreiserfs ReiserFS support?

Note: Old related issue https://github.com/cgsecurity/testdisk/issues/10

mkgrgis commented 10 months ago

Additional information about environment

cgsecurity commented 10 months ago

progsreiserfs and reiserfsprogs are not the same library. ReiserFS is deprecated in the Linux kernel and AFAIK nobody want to maintain progsreiserfs or reiserfsprogs.

It may be easier to put the disk(s) in an x86-64 computer and run the testdisk-7.2-WIP binary provided on www.cgsecurity.org

mkgrgis commented 10 months ago

progsreiserfs and reiserfsprogs are not the same library.

Thanks, @cgsecurity , I haven't knew.

ReiserFS is deprecated in the Linux kernel and AFAIK nobody want to maintain progsreiserfs or reiserfsprogs.

Yes, there is old and mainly stable non updatable functional in this packages. Only 2 crashes during 15+ years.

It may be easier to put the disk(s) in an x86-64 computer and run the testdisk-7.2-WIP binary provided on www.cgsecurity.org

Thanks, @cgsecurity , I' ll write about result.

mkgrgis commented 10 months ago

@cgsecurity , thanks for fast reply! testdisk-7.2-WIP works fine. Thanks for x86-64 compilation model and exec files. I consider you to publish full corresponding to x86-64 archive for aarch64 architecture, because there is only archive with libssp.so.0 unavailable on Ubuntu, Mint, Debian and Fedora.

In testdisk-7.2-WIP there is support of ReiserFS and it is detected on unpartitioned image with message "need recover", but list files gives only message about possible damage. My Unknown code er3k 127 in reiserfsck or other programs is popular message after 2019. Does testdisk supports some standard algorithms for this case or better switch to https://github.com/google/rescue-tools-reiserfs ?

cgsecurity commented 10 months ago

As testdisk is unable to list your files, you can try rescue-tools-reiserfs and/or photorec (shipped with testdisk).

mkgrgis commented 10 months ago

Hello, @cgsecurity !

My solution

  1. Unknown code er3k 127 and other unknown codes from ReiserFS programs is because ReiserFS signature sector was damaged, other data is around normal state.
  2. Make a file with 00 from /dev/zero with some large size (100Mb..1Gb).
  3. Format this file as ReiserFS with mkreiserfs -f.
  4. Install hexedit.
  5. View a file of new ReiserFS void image. Before 10000hex byte should be 00 only, then ReiserFS signature.
  6. Edit backup image of damaged disk partition and copy exact signature from file of void ReiserFS image. Partition size will be not correct, but this will not a problem later.
  7. reiserfsck --rebuild-sb - rebuild ReiserFS superblock and journal. There will be little problems or no problems.
  8. reiserfsck --rebuild-tree -S - repair inode stricture, search lost files and directories. Usually there will be little problems or no problems.
  9. Some usual reiserfsck cycles and mount repaired image to a place for data extracting and comparing.

Note: after step 7 testdisk also can list files from ReiserFS.

Note 2: rescue-tools-reiserfs and/or photorec wasn't usefully because ReserFS can repair itself ;-) Also technological data from SQLite haven't good signatures for photorec. Photorec is wonderful tool for standard image format data extract from HDDs and SSDs.

Thanks for wonderful tools and many years of work with neuritic people who have risk of data loss or have already lost it, but have not come to terms with it!