Skip to contentSkip to conversation

Filesystem repair and Data Recovery

DISCUSSION Flora Dru 2 participants 15 messages Jul 1, 2005 – Jul 4, 2005

lore
Share & tools
lore

Flora Dru

author
#0 lore raw

Hi,

our reiserfs partition that holds our institutions mails got corrupted (27GB). A colleague that was around tried to recover it but failed. So he changed the filesystem to ext2 in /etc/fstab and rebooted. the partition came up but with some of its folders and files corrupted, some folders have become executables with strange owners and permissions that dont respond to cp, chmod, chown or mv commands.

We created an image of the corrupted files onto an ext2 partition and tried to repair it but files in lost+found had strange filenames.

We created another image file onto a remote host reiserfs partition using ( ssh corrupthost dd if=/dev/sda1 conv=noerror > sda1.img) and did the following:

losetup /dev/loop0 sda1.img
reiserfsck --rebuild-sb /dev/loop0
reiserfsck --rebuild-tree /dev/loop0

but it failes with "No reiserfs metadata" found error and the log file contains

####### Pass 0 #######
Could not find hash in use. Using "r5"
####### Pass 1 #######
####### Pass 2 #######

Please advise.

Thanks
Dru

#1 lore raw

Hello

Quoted 4 lines · Flora Dru

Hi,

our reiserfs partition that holds our institutions mails got corrupted (27GB).

Can you please provide more details? Does it refuse to mount? Do you get kernel warnings when you try to access files on it? Did it get unreadable blocks?

Quoted 9 lines

A colleague that was around tried to recover it but failed. So he
changed the filesystem to ext2 in /etc/fstab and rebooted. the partition came up but with some of its folders and files corrupted, some folders have become executables with strange owners and permissions that dont respond to cp, chmod, chown or mv commands.

We created an image of the corrupted files onto an ext2 partition and tried to repair it but files in lost+found had strange filenames.

Please run
reiserfsck /dev/sda2
and let us know what does it say.
please make sure that you have the most recent reiserfsck with reiserfsck -V. If it is not 3.6.19 - please upgrade:
ftp://ftp.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.6.19.tar.gz

Quoted 21 lines

We created another image file onto a remote host reiserfs partition using ( ssh corrupthost dd if=/dev/sda1 conv=noerror > sda1.img) and did the following:
losetup /dev/loop0 sda1.img
reiserfsck --rebuild-sb /dev/loop0
reiserfsck --rebuild-tree /dev/loop0

but it failes with "No reiserfs metadata" found error and the log file contains

####### Pass 0 #######
Could not find hash in use. Using "r5"
####### Pass 1 #######
####### Pass 2 #######

Please advise.

Thanks
Dru

author
#2 lore raw
Quoted 8 lines
Quoted 3 lines

our reiserfs partition that holds our institutions mails got corrupted (27GB).

Can you please provide more details? Does it refuse to mount? Do you get kernel warnings when you try to access files on it? Did it get unreadable blocks?

It failed to mount the first time after a on normal shutdown and reboot that is when my colleague tried to repair using rebuild-tree it failed (i unfortunately dont know what the errors were). This is when he modified the fstab, set fs as ext2, rebooted and it worked however some of the files and folders were corrupted with changed strange permissions and owners. See below:

?--xr-S-wx  25390 1701015401 574452853 1747074414 Jul  1  2025 admin.mak.ac.ug
?r--rw--w-  14641 741476913 173227333 1162692948 Jun  3  1975 agric.mak.ac.ug
?--xr----t  29295 543258944 1933339936 1869572193 Oct 23  2030 bookshop.mak.ac.ug
br-srw-r--  17418 925986415 959925040  54,  54 Jan  1  2018 mak.ac.ug 
Quoted 7 lines

Please run reiserfsck /dev/sda2
and let us know what does it say.
please make sure that you have the most recent reiserfsck with reiserfsck -V. If it is not 3.6.19 - please upgrade:
ftp://ftp.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.6.19.tar.gz

reiserfsck /dev/sdc1 failed when i tried it (thought it was bse the partion is now read as ext2), unfortunately i cant umount the partition because it is on a production server and i cant reboot it now. But i will owrk on that in the nite and post error message.

My kernel is linux 2.4.19 and reiserfsprogs-3.6.19.tar.gz is recommended for kernels 2.4.30 or later. Which one would your recommend for my kernel?

Thanks again
Florence

#3 lore raw

Hello

Quoted 4 lines · Flora Dru
Quoted 4 lines
Quoted 3 lines

our reiserfs partition that holds our institutions mails got corrupted (27GB).

Quoted 8 lines
Quoted 4 lines

Can you please provide more details? Does it refuse to mount? Do you get kernel warnings when you try to access files on it? Did it get unreadable blocks?

It failed to mount the first time after a on normal shutdown and reboot that is when my colleague tried to repair using rebuild-tree it failed (i unfortunately dont know what the errors were). This is when he modified the fstab, set fs as ext2,

Sorry, I am confused. If filesystem is reiserfs it can not be mounted as ext2.

please do
cat /proc/mounts
and let us know what did it say.
Which partition contains reiserfs which got corrupted? Is it root filesystem now?

Quoted 14 lines

rebooted and it worked however some of the files and
folders were corrupted with changed strange permissions and owners. See below:

?--xr-S-wx 25390 1701015401 574452853 1747074414 Jul 1 2025 admin.mak.ac.ug
?r--rw--w- 14641 741476913 173227333 1162692948 Jun 3 1975 agric.mak.ac.ug
?--xr----t 29295 543258944 1933339936 1869572193 Oct 23 2030 bookshop.mak.ac.ug
br-srw-r-- 17418 925986415 959925040 54, 54 Jan 1 2018 mak.ac.ug

Quoted 1 line
Quoted 8 lines
Quoted 7 lines

Please run
reiserfsck /dev/sda2
and let us know what does it say.
please make sure that you have the most recent reiserfsck with reiserfsck -V. If it is not 3.6.19 - please upgrade:
ftp://ftp.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.6.19.tar.gz

reiserfsck /dev/sdc1 failed when i tried it (thought it was bse

bse==because?

Quoted 8 lines

the partion
is now read as ext2), unfortunately i cant umount the partition because it is on a production server and i cant reboot it now. But i will owrk on that in the nite and post error message.

My kernel is linux 2.4.19 and reiserfsprogs-3.6.19.tar.gz is recommended for kernels 2.4.30 or later. Which one would your recommend for my kernel?

When you have chance - upgrade to 2.4.31.

Quoted 5 lines

Thanks again
Florence

author
#4 lore raw
Quoted 3 lines

please do
cat /proc/mounts and let us know what did it say.

cat /proc/mounts returns

rootfs / rootfs rw 0 0
/dev/root / reiserfs rw 0 0
proc /proc proc rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/sda2 /boot reiserfs rw 0 0
/dev/sda10 /home reiserfs rw 0 0
/dev/sda9 /data reiserfs rw 0 0
/dev/sda8 /opt reiserfs rw 0 0
/dev/sda6 /usr reiserfs rw 0 0
/dev/sda7 /var reiserfs rw 0 0
/dev/sdd1 /home/popmail reiserfs rw 0 0
shmfs /dev/shm shm rw 0 0
/dev/sdb5 /home/popmail/tech.mak.ac.ug reiserfs rw 0 0 /dev/sdb6 /home/popmail/agric.mak.ac.ug reiserfs rw 0 0 /dev/sdb7 /home/popmail/educ.mak.ac.ug reiserfs rw 0 0 /dev/sdc1 /mnt ext2 rw 0 0

The corrupted partition /dev/sdc1.

Quoted 2 lines

Which partition contains reiserfs which got corrupted? Is it root filesystem now?

It was initially a reiserfs as i told you and he remounted it as ext2. It is not a root filesystem it is a storage partition

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Please run reiserfsck /dev/sda2
and let us know what does it say.
please make sure that you have the most recent reiserfsck with reiserfsck -V. If it is not 3.6.19 - please upgrade:
ftp://ftp.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.6.19.tar.gz

Meanwhile I've run reiserfsck /dev/loop0 (an image of the corrupted filesystem that we transfered to another host) to which i get the error Bad root block 4294967295. (--rebuild-tree did not complete)

And reiserfsck --rebuild-tree /dev/loop0 fails with No reiserfs metadata found

thanks again

#5 lore raw

Hello

Quoted 6 lines · Flora Dru
Quoted 3 lines

please do
cat /proc/mounts
and let us know what did it say.

cat /proc/mounts returns

Quoted 17 lines

rootfs / rootfs rw 0 0
/dev/root / reiserfs rw 0 0
proc /proc proc rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/sda2 /boot reiserfs rw 0 0
/dev/sda10 /home reiserfs rw 0 0
/dev/sda9 /data reiserfs rw 0 0
/dev/sda8 /opt reiserfs rw 0 0
/dev/sda6 /usr reiserfs rw 0 0
/dev/sda7 /var reiserfs rw 0 0
/dev/sdd1 /home/popmail reiserfs rw 0 0
shmfs /dev/shm shm rw 0 0
/dev/sdb5 /home/popmail/tech.mak.ac.ug reiserfs rw 0 0 /dev/sdb6 /home/popmail/agric.mak.ac.ug reiserfs rw 0 0 /dev/sdb7 /home/popmail/educ.mak.ac.ug reiserfs rw 0 0 /dev/sdc1 /mnt ext2 rw 0 0

ls -l /mnt?

Quoted 8 lines

The corrupted partition /dev/sdc1.

Quoted 2 lines

Which partition contains reiserfs which got corrupted? Is it root filesystem now?

It was initially a reiserfs as i told you and he remounted it as ext2. It is not a root filesystem it is a storage partition

Can you umount /dev/sdc1 or remount readonly?

Quoted 19 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Please run
reiserfsck /dev/sda2
and let us know what does it say.
please make sure that you have the most recent reiserfsck with reiserfsck -V. If it is not 3.6.19 - please upgrade:
ftp://ftp.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.6.19.tar.gz

Meanwhile I've run reiserfsck /dev/loop0 (an image of the corrupted filesystem that we transfered to another host) to which i get the error Bad root block 4294967295. (--rebuild-tree did not complete)

And reiserfsck --rebuild-tree /dev/loop0 fails with No reiserfs metadata found

thanks again

author
#6 lore raw
Quoted 3 lines
Quoted 2 lines

ls -l /mnt?

rwx------ 109 popmail popmail 4096 Jun 16 11:27 finance.mak.ac.ug

drwx------  405 popmail  popmail      8192 May 16 11:21 forest.mak.ac.ug
?---rwS-wx  14132 1431505464 1245851954 1163544915 Jul 29  2002 hospital.mak.ac.ug
drwx------  121 popmail  popmail      4096 Jun 15 10:39 iace.mak.ac.ug
drwxr-xr-x  426 popmail  popmail      8192 Jun 18 16:33 ics.mak.ac.ug
?r-xr-Srw-  8308 544433262 1918984552 543649385 Aug 21  2021 iph.mak.ac.ug
drwx------  438 popmail  popmail      8192 May 17 10:23 isae.mak.ac.ug
drwx------   56 popmail  popmail      4096 Jun 16 10:41 law.mak.ac.ug
drwx------    2 root     root         4096 May 29 22:02 lost+found
br-srw-r--  17418 925986415 959925040  54,  54 Jan  1  2018 mak.ac.ug
drwx------   24 popmail  popmail      4096 Nov 25  2004 makdos.mak.ac.ug
drwx------  160 popmail  popmail      4096 Jun 27 14:54 masscom.mak.ac.ug
drwx------   69 popmail  popmail      4096 Jun 23 11:30 math.mak.ac.ug
drwx------  1463 popmail  popmail     28672 Jun 24 16:43 med.mak.ac.ug
?r-xrw---t  12109 1499101751 811806537 1868974179 Nov 30  2032 misr.mak.ac.ug
drwx------    6 popmail  popmail      4096 Apr 28 10:39 mubs.mak.ac.ug
drwx------   21 popmail  popmail      4096 Jun 24 09:50 mugs.mak.ac.ug
drwx------   63 popmail  popmail      4096 Oct 15  2004 muie.mak.ac.ug
drwx------   85 popmail  popmail      4096 May 30 11:28 muienr.mak.ac.ug
drwx------    7 popmail  popmail      4096 May 19  2004 muip.mak.ac.ug
drwxr-xr-x    3 popmail  popmail      4096 Apr  8 09:49 muklaw.ac.ug
drwx------  219 popmail  popmail      4096 Jun 16 14:00 mulib.mak.ac.ug
drwx------   15 popmail  popmail      4096 May 19  2004 muspgs.mak.ac.ug
drwx------   16 popmail  popmail      4096 May 19  2004 pdd.mak.ac.ug
drwx------   31 popmail  popmail      4096 Nov 23  2004 physics.mak.ac.ug
drwx------    3 popmail  popmail      4096 May 19  2004 printery.mak.ac.ug
drwx------   26 popmail  popmail      4096 Jun 17 14:29 projects.mak.ac.ug
?--xr-Sr--  25674 1714972282 1114916184 961691984 Dec  1  2033 sci.mak.ac.ug
drwx------   54 popmail  popmail      4096 Feb  1 09:11 sifa.mak.ac.ug
drwxr-xr-x  776 popmail  popmail     16384 Jun 12 14:09 ss.mak.ac.ug
drwxr-xr-x    7 popmail  popmail      4096 May 30 08:35 tech.mak.ac.ug
drwx------  500 popmail  popmail     12288 May 30 16:16 vetmed.mak.ac.ug
drwx------   54 popmail  popmail      4096 May  2 15:13 zoology.mak.ac.ug 
Quoted 1 line

Can you umount /dev/sdc1 or remount readonly?

umount and mount as readwrite are successful but mount readonly returns
mount: /dev/sdc1 already mounted or /mnt busy

Quoted 6 lines
Quoted 5 lines

thanks again

#7 lore raw

Hello

Quoted 30 lines · Flora Dru
Quoted 2 lines
Quoted 1 line

ls -l /mnt?

rwx------ 109 popmail popmail 4096 Jun 16 11:27 finance.mak.ac.ug
drwx------ 405 popmail popmail 8192 May 16 11:21 forest.mak.ac.ug
?---rwS-wx 14132 1431505464 1245851954 1163544915 Jul 29 2002 hospital.mak.ac.ug

drwx------  121 popmail  popmail      4096 Jun 15 10:39 iace.mak.ac.ug
drwxr-xr-x  426 popmail  popmail      8192 Jun 18 16:33 ics.mak.ac.ug
?r-xr-Srw-  8308 544433262 1918984552 543649385 Aug 21  2021 iph.mak.ac.ug
drwx------  438 popmail  popmail      8192 May 17 10:23 isae.mak.ac.ug
drwx------   56 popmail  popmail      4096 Jun 16 10:41 law.mak.ac.ug
drwx------    2 root     root         4096 May 29 22:02 lost+found
br-srw-r--  17418 925986415 959925040  54,  54 Jan  1  2018 mak.ac.ug
drwx------   24 popmail  popmail      4096 Nov 25  2004 makdos.mak.ac.ug
drwx------  160 popmail  popmail      4096 Jun 27 14:54 masscom.mak.ac.ug
drwx------   69 popmail  popmail      4096 Jun 23 11:30 math.mak.ac.ug
drwx------  1463 popmail  popmail     28672 Jun 24 16:43 med.mak.ac.ug
?r-xrw---t  12109 1499101751 811806537 1868974179 Nov 30  2032 
misr.mak.ac.ug
drwx------    6 popmail  popmail      4096 Apr 28 10:39 mubs.mak.ac.ug
drwx------   21 popmail  popmail      4096 Jun 24 09:50 mugs.mak.ac.ug
drwx------   63 popmail  popmail      4096 Oct 15  2004 muie.mak.ac.ug
drwx------   85 popmail  popmail      4096 May 30 11:28 muienr.mak.ac.ug
drwx------    7 popmail  popmail      4096 May 19  2004 muip.mak.ac.ug
drwxr-xr-x    3 popmail  popmail      4096 Apr  8 09:49 muklaw.ac.ug
drwx------  219 popmail  popmail      4096 Jun 16 14:00 mulib.mak.ac.ug
drwx------   15 popmail  popmail      4096 May 19  2004 muspgs.mak.ac.ug
drwx------   16 popmail  popmail      4096 May 19  2004 pdd.mak.ac.ug
drwx------   31 popmail  popmail      4096 Nov 23  2004 physics.mak.ac.ug
Quoted 9 lines
drwx------    3 popmail  popmail      4096 May 19  2004 printery.mak.ac.ug
drwx------   26 popmail  popmail      4096 Jun 17 14:29 projects.mak.ac.ug
?--xr-Sr--  25674 1714972282 1114916184 961691984 Dec  1  2033 sci.mak.ac.ug
drwx------   54 popmail  popmail      4096 Feb  1 09:11 sifa.mak.ac.ug
drwxr-xr-x  776 popmail  popmail     16384 Jun 12 14:09 ss.mak.ac.ug
drwxr-xr-x    7 popmail  popmail      4096 May 30 08:35 tech.mak.ac.ug
drwx------  500 popmail  popmail     12288 May 30 16:16 vetmed.mak.ac.ug
drwx------   54 popmail  popmail      4096 May  2 15:13 zoology.mak.ac.ug 

I guess /dev/sdc1 was formatted as ext2 before. That makes it mountable as ext2.

Please umount and try
mount /dev/sdc1 /mnt -t reiserfs

if it mounts: ls -l /mnt

Quoted 6 lines
Quoted 3 lines

Can you umount /dev/sdc1 or remount readonly?

umount and mount as readwrite are successful but mount readonly returns
mount: /dev/sdc1 already mounted or /mnt busy

If filesystem is mounted you can remount: mount -o remount,ro /mnt

If it is umounted, and mount -o ro /dev/sdc1 /mnt fails try dmesg to see what did kernel say why it could not mount it.

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

thanks again

author
#8 lore raw
Quoted 5 lines

Please umount and try
mount /dev/sdc1 /mnt -t reiserfs

if it mounts: ls -l /mnt

It fails with
mount: /dev/sdc1 already mounted or /mnt busy

Quoted 3 lines
Quoted 1 line

If it is umounted, and mount -o ro /dev/sdc1 /mnt fails try dmesg to see what did kernel say why it could not mount it.

This also fails with /dev/sdc1 already mounted or /mnt busy

dmesg has no error related with mount see what it returns (where else cld the kernel be logging?)

SuSE-FW-ACCEPT IN=eth0 OUT= MAC=00:02:a5:42:34:cb:00:10:dc:2b:f2:45:08:00 SRC=81.199.17.2 DST=81.199.17.15 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=56613 DF PROTO=TCP SPT=4507 DPT=80 WINDOW=16384 RES=0x00 SYN URGP=0 OPT (020405B401010402) SuSE-FW-ACCEPT IN=eth0 OUT= MAC=00:02:a5:42:34:cb:00:0a:41:11:c4:07:08:00 SRC=212.88.98.164 DST=81.199.17.15 LEN=60 TOS=0x00 PREC=0x00 TTL=60 ID=61303 DF PROTO=TCP SPT=53804 DPT=25 WINDOW=5840 RES=0x00 CWR ECE SYN URGP=0 OPT (020405B40402080A16C4D74E0000000001030300)

#9 lore raw

Hello

Quoted 18 lines · Flora Dru
Quoted 5 lines

Please umount and try
mount /dev/sdc1 /mnt -t reiserfs

if it mounts: ls -l /mnt

It fails with
mount: /dev/sdc1 already mounted or /mnt busy

Quoted 3 lines
Quoted 1 line

If it is umounted, and mount -o ro /dev/sdc1 /mnt fails try dmesg to see what did kernel say why it could not mount it.

This also fails with /dev/sdc1 already mounted or /mnt busy

dmesg has no error related with mount see what it returns (where else cld the kernel be logging?)

Quoted 9 lines

SuSE-FW-ACCEPT IN=eth0 OUT= MAC=00:02:a5:42:34:cb:00:10:dc:2b:f2:45:08:00 SRC=81.199.17.2 DST=81.199.17.15 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=56613 DF PROTO=TCP SPT=4507 DPT=80 WINDOW=16384 RES=0x00 SYN URGP=0 OPT (020405B401010402)
SuSE-FW-ACCEPT IN=eth0 OUT= MAC=00:02:a5:42:34:cb:00:0a:41:11:c4:07:08:00 SRC=212.88.98.164 DST=81.199.17.15 LEN=60 TOS=0x00 PREC=0x00 TTL=60 ID=61303 DF PROTO=TCP SPT=53804 DPT=25 WINDOW=5840 RES=0x00 CWR ECE SYN URGP=0 OPT (020405B40402080A16C4D74E0000000001030300)

ok, you said earlier that you can umount it.
Please umount and run
reiserfsck /dev/sdc1
and let us know what it says.

PS: I have to leave now. Let continue later. I am not sure when I will be at work. Maybe tomorrow, maybe on sunday.

Can you backup /dev/sdc1 locally? I am not sure that ssh corrupthost dd if=/dev/sdc1 > sdc1.img works as it is supposed to.

author
#10 lore raw

Good morning

Quoted 11 lines

ok, you said earlier that you can umount it.
Please umount and run
reiserfsck /dev/sdc1
and let us know what it says.

PS: I have to leave now. Let continue later. I am not sure when I will be at work. Maybe tomorrow, maybe on sunday.

Can you backup /dev/sdc1 locally? I am not sure that ssh corrupthost dd if=/dev/sdc1 > sdc1.img works as it is supposed to.

reiserfsck /dev/sdc1 returns
Do you want to run this program?[N/Yes] (note need to type Yes):Yes
reiserfs_open: neither new nor old reiserfs format found on /dev/sdc1
reiserfsck: could not open filesystem on "/dev/sdc1"

Aborted

Mount returns
/dev/sda1 on / type reiserfs (rw)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5) /dev/sda2 on /boot type reiserfs (rw) /dev/sda9 on /data type reiserfs (rw) /dev/sda8 on /opt type reiserfs (rw) /dev/sda6 on /usr type reiserfs (rw) /dev/sda7 on /var type reiserfs (rw)
shmfs on /dev/shm type shm (rw)
/dev/sdc1 on /mnt type ext2 (rw)

Thanks again
Florence Dru

#11 lore raw

Hello

Quoted 9 lines · Flora Dru

Good morning

Quoted 8 lines

ok, you said earlier that you can umount it.
Please umount and run
reiserfsck /dev/sdc1
and let us know what it says.

PS: I have to leave now. Let continue later. I am not sure when I will be at work. Maybe tomorrow, maybe on sunday.

Quoted 8 lines
Quoted 3 lines

Can you backup /dev/sdc1 locally? I am not sure that ssh corrupthost dd if=/dev/sdc1 > sdc1.img works as it is supposed to.

reiserfsck /dev/sdc1 returns
Do you want to run this program?[N/Yes] (note need to type Yes):Yes
reiserfs_open: neither new nor old reiserfs format found on /dev/sdc1
reiserfsck: could not open filesystem on "/dev/sdc1"

Lets try to find whether there is anything on /dev/sdc1 which looks like reiserfs.

Please compile the attached program
make myscan

and run it
./myscan /dev/sdc1

This program will look for reiserfs formatted nodes reiserfsck can try to re-build filesystem of.
If you see a lot of lines like:
block 34640 is reiserfs leaf
block 34654 is reiserfs leaf
block 34672 is reiserfs leaf

then you should make a copy of /dev/sdc1 and do:
reiserfsck --rebuild-sb /dev/copy
reiserfsck --rebuild-tree /dev/copy

Please also try this program on a backup you made over ssh and let us know the result.

Quoted 14 lines

Aborted

Mount returns
/dev/sda1 on / type reiserfs (rw)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5) /dev/sda2 on /boot type reiserfs (rw) /dev/sda9 on /data type reiserfs (rw) /dev/sda8 on /opt type reiserfs (rw) /dev/sda6 on /usr type reiserfs (rw) /dev/sda7 on /var type reiserfs (rw)
shmfs on /dev/shm type shm (rw)
/dev/sdc1 on /mnt type ext2 (rw)

If you are sure that /dev/sdc1 is reiserfs, you should have umounted it already.

Quoted 8 lines

Thanks again
Florence Dru

/* read file by 4 k blocks and try to recognize reiserfs blocks */

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <asm/types.h>
#include <sys/stat.h>

char buf[4096];

struct block_head {

	__u16 blk2_level;        /* Level of a block in the tree. */
	__u16 blk2_nr_item;      /* Number of keys/items in a block. */
	__u16 blk2_free_space;   /* Block free space in bytes. */
	__u16 blk_reserved;
	__u32 reserved [4];
};
struct key {
	__u32 k2_dir_id;
	__u32 k2_objectid;
	__u32 k_offset;
	__u32 k_uniqueness;
};

struct item_head

{
	struct key ih_key;
	union {
		__u16 ih2_free_space;
		__u16 ih2_entry_count;
	};
	__u16 ih2_item_len;
	__u16 ih2_item_location;
	__u16 ih_format;
};

int
leaf_count_ih(char *buf, int blocksize)

{
	struct item_head * ih;
	int prev_location;
	int nr;

	/* look at the table of item head */
	prev_location = blocksize;
	ih = (struct item_head *)(buf + sizeof(struct block_head));
	nr = 0;
	while (1) {
		if (ih->ih2_item_location + ih->ih2_item_len != prev_location)
			break;
		if (ih->ih2_item_location < sizeof(struct item_head) * (nr + 1) + sizeof(struct block_head))
			break;
		if (ih->ih2_item_len > (blocksize - sizeof(struct item_head) - sizeof(struct block_head)))
			break;
		prev_location = ih->ih2_item_location;
	/*
		printf("%d: key [%u %u %u %u], item len %d, location %d\n",
			nr, ih->ih_key.k2_dir_id, ih->ih_key.k2_objectid, 
			ih->ih_key.k_offset, ih->ih_key.k_uniqueness,
			ih->ih2_item_location, ih->ih2_item_len);
	*/	
		ih ++;
		nr ++;
	}
    
	return nr;
}

static int
leaf_free_space_estimate(char *buf, int blocksize)

{
	struct block_head * blkh;
	struct item_head * ih;
	int nr;
    
	blkh = (struct block_head *)buf;
	nr = blkh->blk2_nr_item;    
	ih = (struct item_head *)(buf + sizeof(struct block_head)) + nr - 1;
    
	return (nr ? ih->ih2_item_location : blocksize) - sizeof(struct block_head) - sizeof(struct item_head) * nr;
}

static int
leaf_blkh_correct(char *buf, int blocksize)

{
	struct block_head * blkh;
	unsigned int nr;

	blkh = (struct block_head *)buf;

	nr = blkh->blk2_nr_item;
	if (nr > ((blocksize - sizeof(struct block_head)) / (sizeof(struct item_head) + 1)))
		/* item number is too big or too small */
		return 0;

	return leaf_free_space_estimate(buf, blocksize) == blkh->blk2_free_space;
}

int
is_a_leaf(char *buf, int blocksize)

{
	struct block_head * blkh;
	int counted;
    
	blkh = (struct block_head *)buf;
	if (blkh->blk2_level != 1)
		return 0;

	if (!leaf_blkh_correct(buf, blocksize))
		return 0;

	counted = leaf_count_ih(buf, blocksize);

	return (counted == blkh->blk2_nr_item) ? 1 : 0;
}

int
main (int argc, char **argv)

{
	int fd;
	int i;

	fd = open(argv[1], O_RDONLY);
	if (fd == -1) {
		perror("open failed");
		return 1;
	}
	for (i = 0; ; i ++) {
		if (read(fd, buf, 4096) != 4096) {
			printf("failed to read block %d\n", i);
			break;
		}
		if (is_a_leaf(buf, 4096))
			printf("block %d is reiserfs leaf\n", i);
	}
	close(fd);
	return 0;
}
author
#12 lore raw

Hi

Quoted 8 lines

Lets try to find whether there is anything on /dev/sdc1 which looks like reiserfs.

Please compile the attached program make myscan

and run it
./myscan /dev/sdc1

it returns -- failed to read block 16394634

Quoted 7 lines

This program will look for reiserfs formatted nodes reiserfsck can try to re-build filesystem of.
If you see a lot of lines like:
block 34640 is reiserfs leaf
block 34654 is reiserfs leaf
block 34672 is reiserfs leaf

Quoted 7 lines

then you should make a copy of /dev/sdc1 and do:
reiserfsck --rebuild-sb /dev/copy
reiserfsck --rebuild-tree /dev/copy

Please also try this program on a backup you made over ssh and let us know the result.

failed to read block 8942372

Quoted 14 lines
Quoted 13 lines

Mount returns
/dev/sda1 on / type reiserfs (rw)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5) /dev/sda2 on /boot type reiserfs (rw) /dev/sda9 on /data type reiserfs (rw) /dev/sda8 on /opt type reiserfs (rw) /dev/sda6 on /usr type reiserfs (rw) /dev/sda7 on /var type reiserfs (rw)
shmfs on /dev/shm type shm (rw)
/dev/sdc1 on /mnt type ext2 (rw)

Quoted 3 lines

If you are sure that /dev/sdc1 is reiserfs, you should have umounted it already.

I mounted before i checked this.

regards
Florence

#13 lore raw

Hello

Quoted 5 lines · Flora Dru

Hi

Quoted 4 lines

Lets try to find whether there is anything on /dev/sdc1 which looks like reiserfs.

Quoted 8 lines
Quoted 5 lines

Please compile the attached program
make myscan

and run it
./myscan /dev/sdc1

it returns -- failed to read block 16394634

~67gb? You said earlier about 27gb.
What does 'fdisk -l /dev/sdc' say?

Am I correct that there were no lines like 'block 34640 is reiserfs leaf'?

Quoted 41 lines
Quoted 8 lines

This program will look for reiserfs formatted nodes reiserfsck can try to re-build filesystem of.
If you see a lot of lines like:
block 34640 is reiserfs leaf
block 34654 is reiserfs leaf
block 34672 is reiserfs leaf

Quoted 7 lines

then you should make a copy of /dev/sdc1 and do:
reiserfsck --rebuild-sb /dev/copy
reiserfsck --rebuild-tree /dev/copy

Please also try this program on a backup you made over ssh and let us know the result.

failed to read block 8942372

Quoted 14 lines
Quoted 13 lines

Mount returns
/dev/sda1 on / type reiserfs (rw)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5) /dev/sda2 on /boot type reiserfs (rw) /dev/sda9 on /data type reiserfs (rw) /dev/sda8 on /opt type reiserfs (rw) /dev/sda6 on /usr type reiserfs (rw) /dev/sda7 on /var type reiserfs (rw)
shmfs on /dev/shm type shm (rw)
/dev/sdc1 on /mnt type ext2 (rw)

Quoted 3 lines

If you are sure that /dev/sdc1 is reiserfs, you should have umounted it already.

I mounted before i checked this.

regards
Florence

author
#14 lore raw

Hi

~67gb? You said earlier about 27gb.
What does 'fdisk -l /dev/sdc' say?

The hard disk is 68gb but amount of data is 27gb

fdisk -l /dev/sdc

Disk /dev/sdc: 255 heads, 63 sectors, 8855 cylinders Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 8855 71127756 83 Linux

Am I correct that there were no lines like 'block 34640 is reiserfs leaf'?

Yes you are correct.

regards
Florence