Neil Brown <[EMAIL PROTECTED]> writes:

> On Monday May 15, [EMAIL PROTECTED] wrote:
>> I accidentally ran mkswap on an md raid1 device which had a mounted
>> ext3 filesystem on it.  I also did a swapon, but I don't think
>> anything was written to swap before I noticed the mistake.  How much
>> of the partition is toast, and is it something e2fsck might fix?
>
> I think (and an strace seems to confirm) that mkswap only writes in
> the first 4k of the device.  This will have held the superblock, but
> there is always at least one backup - I think it is as block 8193.
> But 'fsck -n' should help you out, though you might need
> 'fsck.ext2 -n' as 'fsck' might think it is a swap device...

Thanks for the quick response!  I tried e2fsck, and it found the
backup superblock on its own.  I answered yes to dozens of questions,
and the filesystem is now intact.

> Ofcourse, if the filesystem is mounted, then unmounting the filesystem
> should write the superblock, which might fix any corruption you
> caused..

I decided to do a Alt-Sysrq-u Alt-Sysrq-b reboot to minimize what
was written to disk when things were already messed up.

> Adrian:  You seem to be the MAINTAINER of mkswap.. any chance of 
> opening for O_EXCL as well as O_RDWR.  That would make it a lot safer.

That would have saved me lots of worry!

Thanks again,

Dan

-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to