Skip to contentSkip to conversation

Is it a bug or not?

DISCUSSION Bastian Kruse 2 participants 2 messages Sep 30, 2003

lore
Share & tools
lore
#0 lore raw

Hello,
I have tried:
dd if=/dev/hda bs=6400k | gzip -v1 > /windows/bak/hda.img
After it the reiserfs is broken on /dev/hda3 which is root and I can not repair it using reiserfsck --rebuild-tree or --fix-fixable
System is as follows:
/dev/hda1 : ntfs
/dev/hda2 : ntfs
/dev/hda3 : reiserfs (/)
/dev/hda4 : swap
/dev/hdb1 : reiserfs (mounted at /windows/bak/)
I don´t think that I´m using the latest reiserfsprogs, as Suse 8.1 is installed. I would like to accent that the problems arise when I reboot after I have copied an image to /windows/bak and that no data is written back from the image to /dev/hda sofar. Bastian
P.S. dd if=/dev/hda of=/dev/hdb bs=6400 works great without any problems. Both harddisk can be used as wished containing the same data.

_____________________________________________________________
Registrieren auch Sie Ihre kostenlose Email-Adresse bei <a href="http://www.postdienst.net" target="_top">postdienst.net</a><br>Internet-Services by Herbert Krems<p><a href="http://www.schadenbearbeitung.de" target="_top">schadenbearbeitung.de</a><br><a href="http://www.praxisleitfaden.de" target="_top">Praxisleitfaden bei Versicherungsschaden</a><br><a href="http://www.hilfsprojekte.de" target="_top">Private Hilfsprojekte</a><br>

#1 lore raw
Quoted 6 lines · Bastian Kruse

Hello,
I have tried:
dd if=/dev/hda bs=6400k | gzip -v1 > /windows/bak/hda.img After it the reiserfs is broken on /dev/hda3 which is root and I can not repair it using reiserfsck --rebuild-tree or --fix-fixable System is as follows:

hi,

reiserfsck does not allow to fix a mounted filesystem, so you can only check it. to be able to fix such a partition you will need this reiserfsprogs patch -- obtain the latest reiserfsprogs please (3.6.11) from our ftp site and apply the patch.
this patch is going to be included into the coming reiserfsprogs pre-release, but for now it is not well tested yet.

Signature · 2 lines
Thanks,
Vitaly Fertman
Quoted 12 lines

/dev/hda1 : ntfs
/dev/hda2 : ntfs
/dev/hda3 : reiserfs (/)
/dev/hda4 : swap
/dev/hdb1 : reiserfs (mounted at /windows/bak/)
I donб╢t think that Iб╢m using the latest reiserfsprogs, as Suse 8.1 is installed. I would like to accent that the problems arise when I reboot after I have copied an image to /windows/bak and that no data is written back from the image to /dev/hda sofar. Bastian
P.S. dd if=/dev/hda of=/dev/hdb bs=6400 works great without any problems. Both harddisk can be used as wished containing the same data.

Quoted 9 lines

_____________________________________________________________
Registrieren auch Sie Ihre kostenlose Email-Adresse bei <a href="http://www.postdienst.net" target="_top">postdienst.net</a><br>Internet-Services by Herbert Krems<p><a href="http://www.schadenbearbeitung.de" target="_top">schadenbearbeitung.de</a><br><a href="http://www.praxisleitfaden.de" target="_top">Praxisleitfaden bei Versicherungsschaden</a><br><a href="http://www.hilfsprojekte.de" target="_top">Private Hilfsprojekte</a><br>

===== fsck/main.c 1.68 vs edited =====

fsck/main.c renamed from reiserfsprogs/fsck/main.c +23 -32
@@ -9,6 +9,7 @@
 
 #include "../include/config.h"
 #include "../version.h"
+#include <sys/mman.h>
 
 extern int screen_width;
 extern int screen_savebuffer_len;
@@ -742,6 +743,11 @@
 
     mark_filesystem_consistent (fs);
     clear_buffer_do_not_flush (fs->fs_super_bh);
+    
+    if (is_mounted_read_only(fs->fs_file_name)) {
+	reiserfs_warning(stderr, "\nThe partition is mounted ro. It is better "
+			 "to umount and mount it again.\n\n");
+    }
 
     /* write all dirty blocks */
     fsck_progress ("Syncing..");
@@ -751,33 +757,17 @@
     fsck_progress ("finished\n");
 }
 
+extern void prepare_fs_for_check(reiserfs_filsys_t * fs);
 
-static void rebuild_tree (reiserfs_filsys_t * fs)
-{
+static void rebuild_tree (reiserfs_filsys_t * fs) {
     time_t t;
     int ret;
 
-    if (is_mounted (fs->fs_file_name)) {
-	fsck_progress ("rebuild_tree: Cannot rebuild tree of mounted filesystem\n");
-	exit(EXIT_USER);
-    }
-
     init_rollback_file (state_rollback_file(fs), &fs->fs_blocksize, 
 	fsck_data(fs)->log);
     
-    reiserfs_reopen (fs, O_RDWR);
-
-    if (!fsck_skip_journal (fs)) {
-       if (reiserfs_journal_params_check(fs)) {
-	    reiserfs_close(fs);
-	    exit(EXIT_FATAL);
-	}
-
-	/* rebuild starts with journal replaying */
-	if (!fsck_skip_journal (fs))
-	    reiserfsck_replay_journal (fs);
-    }
-
+    prepare_fs_for_check(fs);
+    
     ret = reiserfs_open_ondisk_bitmap (fs);
     if (ret < 0) {
         fsck_progress ("reiserfsck: Could not open bitmap\n");
@@ -821,7 +811,7 @@
     }
 
     close_rollback_file ();
-    
+       
     time (&t);
     fsck_progress ("###########\n"
 		   "reiserfsck finished at %s"
@@ -829,10 +819,8 @@
     exit (EXIT_OK);
 }
 
-
 /* check umounted or read-only mounted filesystems only */
-static void prepare_fs_for_check(reiserfs_filsys_t * fs) 
-{
+void prepare_fs_for_check(reiserfs_filsys_t * fs) {
     /* The method could be called from auto_check already. */
     if (fs->fs_flags == O_RDWR) 
 	return;
@@ -840,20 +828,23 @@
     reiserfs_reopen (fs, O_RDWR);
     
     if (is_mounted (fs->fs_file_name)) {
-	/* filesystem seems mounted. */
-        if (fsck_mode (fs) == FSCK_CLEAN_ATTRIBUTES) {
-	    fsck_progress ("Partition %s is mounted, cannot clean attributes "
-		"on mounted device\n", fs->fs_file_name);
-	    reiserfs_close (fs);
-	    exit(EXIT_USER);
-        }
-
 	if (!is_mounted_read_only (fs->fs_file_name)) {
 	    fsck_progress ("Partition %s is mounted with write permissions, "
 		"cannot check it\n", fs->fs_file_name);
 	    reiserfs_close (fs);
 	    exit(EXIT_USER);
 	}
+	
+	/* If not CHECK mode, lock the process in the memory. */
+	if (fsck_mode (fs) != FSCK_CHECK) {
+	    if (mlockall(MCL_CURRENT)) {
+		    reiserfs_warning (stderr, "Failed to lock the process to "
+				      "fsck the mounted ro partition. %s.\n", 
+				      strerror(errno));
+		    exit(EXIT_OPER);
+	    }
+	}
+	
 	if (!reiserfs_journal_opened (fs)) {
 	    /* just to make sure */
 	    reiserfs_panic ("Journal is not opened");