====== ReiserFS & Linux ====== ===== Troubleshooting ===== ==== Basic rules of fixing b0rken ReiserFS partion ==== //The most important things I've learned while drinking with Hans Reiser and things that always saved my data on reiserfs.// * make sure you have "enough" RAM * **make sure you have working (not br0ken) RAM** * before running any --rebuild-sb or --rebuild-tree make sure you have backup! * have the latest reiserfsprogs tools * have a decent stable linux kernel and reiserfs support in it ==== REISERFS error (device dm-6): vs-7000 search_by_entry_key: search_by_key returned item position == 0 ==== ReiserFS: hdx1: found reiserfs format "3.6" with standard journal ReiserFS: hdx1: using ordered data mode ReiserFS: hdx1: journal params: device hda1, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30 ReiserFS: hdx1: checking transaction log (hda1) ReiserFS: hdx1: warning: vs-7000: search_by_entry_key: search_by_key returned item position == 0 ReiserFS: hdx1: found reiserfs format "3.6" with standard journal ReiserFS: hdx1: using ordered data mode ReiserFS: hdx1: journal params: device hda1, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30 ReiserFS: hdx1: checking transaction log (hda1) ReiserFS: hdx1: warning: vs-7000: search_by_entry_key: search_by_key returned item position == 0 reiserfsck --rebuild-sb /dev/hdx1 Reiserfs super block in block 16 on 0x301 of format 3.6 with standard journal Count of blocks on the device: 4883744 Number of bitmaps: 150 Blocksize: 4096 Free blocks (count of blocks - used [journal, bitmaps, data, reserved] blocks): 3430669 Root block: 4096104 Filesystem is clean Tree height: 5 Hash function used to sort names: not set Objectid map size 972, max 972 Journal parameters: Device [0x0] Magic [0x0] Size 8193 blocks (including 1 for journal header) (first block 18) Max transaction length 1024 blocks Max batch size 900 blocks Max commit age 30 Blocks reserved by journal: 0 Fs state field: 0x0: sb_version: 2 inode generation number: 2442403 UUID: bfd1afad-a173-40a6-bbbe-643dc9e68a23 LABEL: Set flags in SB: **Super block seems to be correct**, but here comes the trick .. mount -t reiserfs /dev/hda1 /media/restore mount: wrong fs type, bad option, bad superblock on /dev/hda1, missing codepage or other error In some cases useful info is found in syslog - try dmesg | tail or so Ok .. here is a workaround to make the partition mountable again it is enough to change one byte in the super block from 0 (hash is not set) to 3 (r5 hash). It can be done by a hex editor. hexdump -C of block #16 (reiserfs uses 4k-size blocks, numbers start with 0): ... 00000030 06 00 01 00 52 65 49 73 45 72 32 46 73 00 00 00 |....ReIsEr2Fs...| 00000040 03 00 00 00 05 00 c6 04 02 00 00 00 89 28 00 00 |......ф.....┴(..| ^^ this byte. ... Which can be done like .. I used dd to copy first 512Kb from disk, then modify them and copy back to disk: $ dd if=/dev/hdx1 count=1000 of=/tmp/hdx1dump then use your favourite Hexeditor to fix problem (position 0001:0040 in this file) --> write \"03\" in position 0001:0040 and copy it back to disk $ dd of=/dev/hdx1 count=1000 if=/tmp/hdx1dump