Hi all, Somehow I managed to mess with a RAID array containing an ext3 partition. Parenthesis, if it matters: I disconnected physically a drive while the array was online. Next thing, I lost the right order of the drives in the array. While trying to re-create it, I overwrote the raid superblocks. Luckily, the array was RAID5 degraded, so whenever I re-created it, it didn't go into sync; thus, everything besides the RAID superblocks is preserved (or so I think). Now, I am trying to re-create the array in the proper order. It takes me countless attempts, through hundreds of permutations. I am doing it programatically, but I don't think I have the right tool. Now, after creating the array and mounting it with mount -t ext3 -n -r /dev/md2 /media/olddepot I issue an: e2fsck -n -f /media/olddepot However, I cycled through all the permutations without apparent success. I.e., in all combinations it just refused to check it, saying something about "short read" and, of course, about invalid file systems. Does anybody know a better tool to check whether the mounted partition is a slightly damaged ext3 file system? I am thinking about dumping ext3 superblocks, but I don't know how that works. Thanks. (I am on the latest openSuSE, 11.2, with the latest mdadm available.)
On Tue, 8 Dec 2009 at 11:48, Lucian ?andor wrote:> Now, after creating the array and mounting it with > mount -t ext3 -n -r /dev/md2 /media/olddepot > I issue an: > e2fsck -n -f /media/olddepotHuh? Normally you'd want to run fsck agains the blockdevice: $ umount /media/olddepot $ fsck.ext3 -nvf /dev/md2 If this still does not succeed, you could try specifying a different superblock (-b). But the important thing will be to get your raid in the right order, otherwise fsck could do more harm than helping. Christian. -- BOFH excuse #25: Decreasing electron flux
Lucian ?andor wrote:> Hi all, > > Somehow I managed to mess with a RAID array containing an ext3 partition. > > Parenthesis, if it matters: I disconnected physically a drive while > the array was online. Next thing, I lost the right order of the drives > in the array. While trying to re-create it, I overwrote the raid > superblocks. Luckily, the array was RAID5 degraded, so whenever I > re-created it, it didn't go into sync; thus, everything besides the > RAID superblocks is preserved (or so I think). > > Now, I am trying to re-create the array in the proper order. It takes > me countless attempts, through hundreds of permutations. I am doing it > programatically, but I don't think I have the right tool. > Now, after creating the array and mounting it with > mount -t ext3 -n -r /dev/md2 /media/olddepot > I issue an: > e2fsck -n -f /media/olddepot > However, I cycled through all the permutations without apparent > success. I.e., in all combinations it just refused to check it, saying > something about "short read" and, of course, about invalid file > systems.As Christian pointed out, use the device not the mountpoint for the fsck arg: [tmp]$ mkdir dir [tmp]$ e2fsck -fn dir/ e2fsck 1.41.4 (27-Jan-2009) e2fsck: Attempt to read block from filesystem resulted in short read while trying to open dir/ Could this be a zero-length partition? :) -Eric
On Tue, Dec 08, 2009 at 11:48:18AM -0500, Lucian ?andor wrote:> > Now, I am trying to re-create the array in the proper order. It takes > me countless attempts, through hundreds of permutations. I am doing it > programatically, but I don't think I have the right tool.Something that may help is to use the findsuper program, in the e2fsprogs sources; it's not built by default, but you can build it by hand. Each of the backup superblocks has a group number in one of the fields, if it was created with a relatively modern mke2fs, so you can use it to get information like this: byte_offset byte_start byte_end fs_blocks blksz grp last_mount_time sb_uuid label 1024 0 95999229952 23437312 4096 0 Thu Dec 10 00:24:39 2009 fd5210bd 134217728 0 95999229952 23437312 4096 1 Wed Dec 31 19:00:00 1969 fd5210bd 402653184 0 95999229952 23437312 4096 3 Wed Dec 31 19:00:00 1969 fd5210bd 671088640 0 95999229952 23437312 4096 5 Wed Dec 31 19:00:00 1969 fd5210bd The group number information should help you determine the order of the disks in the raid array. Good luck! - Ted