linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Christensen <jdc@uwo.ca>
To: linux-raid@vger.kernel.org
Cc: Adrian Bunk <bunk@stusta.de>
Subject: Re: recovery from mkswap on mounted raid1 ext3 filesystem?
Date: Mon, 15 May 2006 23:22:03 -0400	[thread overview]
Message-ID: <87d5eeu010.fsf@uwo.ca> (raw)
In-Reply-To: 17513.15336.921542.232057@cse.unsw.edu.au

Neil Brown <neilb@suse.de> writes:

> On Monday May 15, jdc@uwo.ca 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


      reply	other threads:[~2006-05-16  3:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-16  2:19 recovery from mkswap on mounted raid1 ext3 filesystem? Dan Christensen
2006-05-16  2:41 ` Neil Brown
2006-05-16  3:22   ` Dan Christensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d5eeu010.fsf@uwo.ca \
    --to=jdc@uwo.ca \
    --cc=bunk@stusta.de \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).