LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   ext3 (Superblock) damage while partition extend (https://www.linuxquestions.org/questions/linux-general-1/ext3-superblock-damage-while-partition-extend-4175488536/)

datashredder 12-19-2013 04:54 AM

ext3 (Superblock) damage while partition extend
 
I lost the ext3 File system after resizing the Partition on an md raid device. The whole story:

I added an SSD and freshly installed Centos 6. The Raid devices for the former / and swap had to be deleted and the Data Partition should receive the entier disc capacity. I started with two hard disks, having three partitions type fd and three raid1 devices.

Code:

/dev/sdb1        50G        Linux raid auto
/dev/sdb2        240G        Linux raid auto
/dev/sdb3        4G        Linux raid auto

Code:

/dev/sdc1        50G        Linux raid auto
/dev/sdc2        240G        Linux raid auto
/dev/sdc3        4G        Linux raid auto

Code:

md125:active raid1 sdc1[1] sdb1[2] [UU]  ext3 (previously mounted on /)
md126:active raid1 sdc2[1] sdb2[2] [UU]  provided to KVM guest as raw device (virtual file server)
md127:active raid1 sdc3[1] sdb3[2] [UU]  swap (not in use anymore)

The new setup had no /etc/mdadm.conf - the md devices were run automatically. I deleted /dev/md125 and /dev/md127 and removed one disk from md126

Code:

mdadm /dev/md126 --fail /dev/sdb2 --remove /dev/sdb2
using fdisk i deleted all partitions on /dev/sdb and created

Code:

/dev/sdb1        320G        Linux raid auto
then i ran

Code:

mdadm -a /dev/md126 /dev/sdb1
and waited for the sync to finish. After that, the same procedure on /dev/sdc removing, creating, adding and syncing /dev/sdc1 wth the entier disc capacity. Last step on the array was to

Code:

mdadm --grow /dev/md126 -z max
That done, i had /dev/md126 up and running with 310GB capacity containing the partition /dev/md126p1 having 240GB and an ext3 Filesystem. Mountable, unsable, perfect.

Next step was to extend the partition /dev/md126p1. Using fdsik /dev/md126 i deleted the partition (form 1 to 32028) and created an new one (form 1 to last). From that moment on, the ext3 is not detected as ext3 anymore and unusable even with -t ext3. It always says "wrong fs type, bad option, bad superblock"

I tried to use backup superblocks displayed by mke2fs -n via fsck as well as via mount -o sb=1234 - nothing.

Can someone help me finding the Data?

thanks,
datashredder

datashredder 12-20-2013 02:41 AM

meanwhile is set up a perl script

Code:

foreach (30000..30000000){
        @back = `mount -t ext3 -o ro,sb=$_  /dev/md126 /mnt/temp`;
}

Its still running, but it doesnt look as if there is any usable buperblock.

Any idea, please?

datashredder

syg00 12-20-2013 03:09 AM

Normal response when screwing with partitions - restore from the backup you took before you started screwing around.
No, I'm not being flippant.

That said, it looks like what you did is sane - I'd blame fdisk. Recent versions align partitions differently for compatibility with the newer 4k sector drives - if the old alignment was to cylinder 1 (as in sector 63), the filesystem won't align to the start of the new partition. So your filesystem would be ok, but you won't be able to find it. "fdisk -l" should tell you.

(I didn't reply earlier as I didn't want to pull you off the "0 reply" list).

datashredder 12-20-2013 05:21 AM

Thanks for your reply, syg00. Ok - i found in the web, that fdisk since v. 2.17.1 (i used 2.17.2) aligns the partition begin to a sector divisible by 1024, if the DOS compatibility mode is disabled. But i can see the partition beginning at sector 1. Are the more new behaviours? I think, i give an old recue disk a try to recreate the partition.

thanks

datashredder

rknichols 12-20-2013 07:17 PM

The only partitioning tool I know that will do exactly what you tell it to do is sfdisk when run with the "--force" option, but you will have to put up with a non-interactive user interface that sometimes doesn't seem to have been intended for humans.

datashredder 12-21-2013 04:00 AM

Thank you guys,

after using an old fdisk, that didnīt help, i decided to restore the backup. It might be very interesting to find out, what happened, but i have neither enough disks nor sufficient time.

datashredder


All times are GMT -5. The time now is 05:58 PM.