Jörg Ries, Dienstag, 14. Januar 2003 20:33:
bin am verzweifeln. Habe mir soeben versehntlich wichtige Dateien auf einer ReiserFS-Partition gelöscht.
Gibt es eine Möglichkeit da wieder dran zu kommen?
Aaaaalso, nachdem hier ja doch mittlerweile einige Beiträge zu diesem Thread aufgelaufen sind, habe ich heute mal den Experimentierkasten ausgepackt. An meinen Ergebnissen will ich euch teilhaben lassen ;) Gegenstand der Begierde: /dev/hdb1, eine Partition mit 50 MB. Umgebung: SuSE 7.3 Als erstes sorge ich dafür, daß im Falle eines Falles nicht allzuviele Leichen im lost+found auftauchen: scarabaeus:/home/andy # dd if=/dev/zero of=/dev/hdb1 dd: Schreiben in »/dev/hdb1«: Auf dem Gerät ist kein Speicherplatz mehr verfügbar 112393+0 Records ein 112392+0 Records aus Als nächstes ein Reiserfs draufpacken: scarabaeus:/home/andy # mkreiserfs /dev/hdb1 <-------------mkreiserfs, 2001-------------> reiserfsprogs 3.x.0k-pre9 mkreiserfs: Guessing about desired format.. mkreiserfs: Kernel 2.4.16-4GB is running. [=> komplette Ausgabe hier [1]] So, jetzt mounte ich die Partition und kopier mal ein paar Dateien drauf: scarabaeus:/home/andy # dir -R /mnt /mnt: insgesamt 4 drwxr-xr-x 4 root root 55 Jan 18 23:00 . drwxr-xr-x 20 root root 4096 Jan 18 2003 .. drwxr-xr-x 2 root root 175 Jan 18 23:00 Test /mnt/Test: insgesamt 7578 drwxr-xr-x 2 root root 175 Jan 18 23:00 . drwxr-xr-x 4 root root 55 Jan 18 23:00 .. -rwxrwxrwx 1 root root 2340092 Jan 3 15:45 img_8116.jpg -rwxrwxrwx 1 root root 1253790 Jan 3 17:28 img_8121.jpg -rwxrwxrwx 1 root root 1435703 Jan 3 17:28 img_8123.jpg -rwxrwxrwx 1 root root 1311368 Jan 3 17:28 img_8124.jpg -rwxrwxrwx 1 root root 1397276 Jan 3 17:29 img_8127.jpg Und jetzt: scarabaeus:/ # rm -r /mnt/Test/ scarabaeus:/ # umount /mnt Jetzt schaun wir mal, was noch übrig ist: scarabaeus:/ # reiserfsck --rebuild-tree --scan-whole-partition /dev/hdb1 <-------------reiserfsck, 2001-------------> reiserfsprogs 3.x.0k-pre9 [Fortsetzung siehe [2]] Jetzt wieder mounten: scarabaeus:/ # mount /dev/hdb1 /mnt Inhalt angucken: scarabaeus:/mnt # dir insgesamt 4 drwxr-xr-x 5 root root 79 Jan 18 23:05 . drwxr-xr-x 20 root root 4096 Jan 18 2003 .. drwxr-xr-x 2 root root 399 Jan 18 23:00 01 drwx------ 2 root root 35 Jan 18 23:07 lost+found Immerhin, plötzlich ist ein lost+found da, und ein Ordner 01, der eigentlich Test hätte heißen sollen. Schauen wir genauer nach: scarabaeus:/mnt # dir -R .: insgesamt 4 drwxr-xr-x 5 root root 79 Jan 18 23:05 . drwxr-xr-x 20 root root 4096 Jan 18 2003 .. drwxr-xr-x 2 root root 399 Jan 18 23:00 01 drwx------ 2 root root 35 Jan 18 23:07 lost+found ./01: insgesamt 17714 drwxr-xr-x 2 root root 399 Jan 18 23:00 . drwxr-xr-x 5 root root 79 Jan 18 23:05 .. -rwxrwxrwx 1 root root 2340092 Jan 3 15:45 img_8116.jpg -rwxrwxrwx 1 root root 1253790 Jan 3 17:28 img_8121.jpg -rwxrwxrwx 1 root root 1435703 Jan 3 17:28 img_8123.jpg -rwxrwxrwx 1 root root 1311368 Jan 3 17:28 img_8124.jpg -rwxrwxrwx 1 root root 1397276 Jan 3 17:29 img_8127.jpg ./lost+found: insgesamt 0 drwx------ 2 root root 35 Jan 18 23:07 . drwxr-xr-x 5 root root 79 Jan 18 23:05 .. So, wir hätten also die Dateien an sich wieder. Allerdings: nur eine einzige Datei war zur Hälfte noch in Ordnung (also das Bild), alle anderen Dateien wollte kuickshow mir nicht mehr decodieren. Mit anderen Worten: eine sichere Sache ist das nicht, aber unmöglich ist eine Wiederherstellung auch nicht. Vielleicht liegt die geringe Trefferquote an meiner Minipartition, wo das Journal größer ist als die Nutzdatenmenge. Jetzt habe ich nochmal genau dasselbe wie oben gemacht, also 1) dd if=/dev/zero of=/dev/hdb1 2) mkreiserfs /dev/hdb1 3) ein paar Dateien draufschieben, sodann löschen 4) sodann: scarabaeus:/ # reiserfsck --rebuild-tree /dev/hdb1 Also im Unterschied zu vorher kein --scan-whole-partition Ergebnis: scarabaeus:/mnt # dir -R .: insgesamt 4 drwxr-xr-x 4 root root 61 Jan 18 23:18 . drwxr-xr-x 20 root root 4096 Jan 18 2003 .. drwx------ 2 root root 35 Jan 18 23:18 lost+found ./lost+found: insgesamt 0 drwx------ 2 root root 35 Jan 18 23:18 . drwxr-xr-x 4 root root 61 Jan 18 23:18 .. Mit anderen Worten: ohne die option --scan-whole-partition kommt überhaupt nix mehr zurück. Dies ist also, was einige Beiträge dieses Threads erwartet hätten: weg ist weg, jedenfalls wenn man nur das Journal zurückspielt. Soweit mein Beitrag für heute. Wenn noch jemand was genauer wissen will, dann raus mit der Sprache, die HDD liegt noch drin und will getestet werden ;) Andy [1] <-------------mkreiserfs, 2001-------------> reiserfsprogs 3.x.0k-pre9 mkreiserfs: Guessing about desired format.. mkreiserfs: Kernel 2.4.16-4GB is running. 13107k will be used Block 16 (0x341) contains super block of format 3.5 with standard journal Block count: 14049 Bitmap number: 1 Blocksize: 4096 Free blocks: 5837 Root block: 8211 Tree height: 2 Hash function used to sort names: "r5" Objectid map size 2, max 1004 Journal parameters: Device [0x0] Magic [0x1b4918f7] Size 8193 (including journal header) (first block 18) Max transaction length 1024 Max batch size 900 Max commit age 30 Space reserved by journal: 0 Correctness checked after mount 1 Fsck field 0x0 ATTENTION: YOU SHOULD REBOOT AFTER FDISK! ALL DATA WILL BE LOST ON '/dev/hdb1'! Continue (y/n):y Initializing journal - 0%....20%....40%....60%....80%....100% Syncing..ok ReiserFS core development sponsored by SuSE Labs (suse.com) Journaling sponsored by MP3.com. To learn about the programmers and ReiserFS, please go to http://namesys.com Have fun. [2] scarabaeus:/ # reiserfsck --rebuild-tree --scan-whole-partition /dev/hdb1 <-------------reiserfsck, 2001-------------> reiserfsprogs 3.x.0k-pre9 This is an experimental version of reiserfsck, MAKE A BACKUP FIRST! Don't run this program unless something is broken. Some types of random FS damage can be recovered from by this program, which basically throws away the internal nodes of the tree and then reconstructs them. This program is for use only by the desperate, and is of only beta quality. Email reiserfs@devlinux.com with bug reports. Will rebuild the filesystem (/dev/hdb1) tree Will put log info to 'stdout' Do you want to run this program?[N/Yes] (note need to type Yes):Yes 13107k will be used Replaying journal.. 0 transactions replayed ########### reiserfsck --rebuild-tree started at Sat Jan 18 23:07:04 2003 ########### Pass 0: ####### Pass 0 ####### Whole device (14049 blocks) is to be scanned Skipping 8211 blocks (super block, journal, bitmaps) 5838 blocks will be read 0%....20%....40%....60%....80%....100% left 0, 1946 /sec "r5" got 22 hits "r5" hash is selected Flushing..done Read blocks (but not data blocks) 5838 Leaves among those 8 Objectids found 16 Pass 1 (will try to insert 8 leaves): ####### Pass 1 ####### Looking for allocable blocks .. ok 0%....20%....40%....60%....80%....100% left 0, 0 /sec Flushing..done 8 leaves read 5 inserted - pointers in indirect items pointing to metadata 2 (zeroed) 3 not inserted non-unique pointers to leaves or non-unique (zeroed) 1077 ####### Pass 2 ####### Pass2: 0%....20%....40%....60%....80%....100% left 0, 0 /sec Flushing..done Tree is built. Checking it - done Leaves inserted item by item 3 Pass 3 (semantic): ####### Pass 3 ######### /01/img_8152.jpgfile 3 15 has wrong sd_blocks 3568, has to be 3552 /img_8155.jpgfile 3 16 has wrong sd_blocks 2832, has to be 2392 name "img_8161.jpg" in directory 2 3 points to nowhere 3 17 - removed name "img_8162.jpg" in directory 2 3 points to nowhere 3 18 - removed dir 2 3 has wrong sd_size 175, has to be 399 name "Test" in directory 1 2 points to nowhere 2 3 - removed dir 1 2 has wrong sd_size 35, has to be 79 Files found: 13 Directories found: 3 Names pointing to nowhere (removed): 3 Pass 3a (looking for lost dir/files): ####### Pass 3a (lost+found pass) ######### Looking for lost directories: Pass 4 - done left 4, 0 /sec Flushing..done Syncing..done ########### reiserfsck finished at Sat Jan 18 23:07:07 2003 ########### -- Andreas Feile www.feile.net