linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mounting ext3 with another superblock doesn't work?
@ 2011-05-07  0:09 Christoph Anton Mitterer
  2011-05-07  5:56 ` Andreas Dilger
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Anton Mitterer @ 2011-05-07  0:09 UTC (permalink / raw)
  To: linux-fsdevel

Hi.

Few minutes ago, being too tired, I unfortunately did a mkfs.ext3 on an
already existing ext3 fs (instead of fsck.ext3).
It unfortunately didn't warn me that there's already an fs on it but
started right away with it's evil work[0] until I ^C-ed it[0] in panic.

I know this list is about devel, but unfortunately I don't know a better
place to ask experts (sorry).


When I scan the fs with testdisk it seems to find some superblocks, having
the old fs label:
superblock 32768, blocksize=4096 [data1]
superblock 98304, blocksize=4096 [data1]
superblock 163840, blocksize=4096 [data1]
superblock 229376, blocksize=4096 [data1]
superblock 294912, blocksize=4096 [data1]
superblock 819200, blocksize=4096 [data1]
superblock 884736, blocksize=4096 [data1]
superblock 1605632, blocksize=4096 [data1]
superblock 2654208, blocksize=4096 [data1]
superblock 4096000, blocksize=4096 [data1]

Could it be that these are still valid ones?

When I try to mount e.g.:
# mount -t ext3 -o sb=$((32768*4)) /dev/sdc1 /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

...it doesn't work however.

Any ideas?

Thanks,
Chris.

btw: Please CC me as I'm off list.


[0]mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
45793280 inodes, 183143000 blocks
9157150 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
5590 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000

Writing inode tables: ^C00/5590

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-07  0:09 mounting ext3 with another superblock doesn't work? Christoph Anton Mitterer
@ 2011-05-07  5:56 ` Andreas Dilger
  2011-05-07 22:03   ` Christoph Anton Mitterer
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Dilger @ 2011-05-07  5:56 UTC (permalink / raw)
  To: Christoph Anton Mitterer; +Cc: linux-fsdevel@vger.kernel.org



On 2011-05-06, at 6:09 PM, ChrAnton Mitterer <calestyo@scientia.net> wrote:

> Hi.
> 
> Few minutes ago, being too tired, I unfortunately did a mkfs.ext3 on an
> already existing ext3 fs (instead of fsck.ext3).
> It unfortunately didn't warn me that there's already an fs on it but
> started right away with it's evil work[0] until I ^C-ed it[0] in panic.
> 
> I know this list is about devel, but unfortunately I don't know a better
> place to ask experts (sorry).
> 
> 
> When I scan the fs with testdisk it seems to find some superblocks, having
> the old fs label:
> superblock 32768, blocksize=4096 [data1]
> superblock 98304, blocksize=4096 [data1]
> superblock 163840, blocksize=4096 [data1]
> superblock 229376, blocksize=4096 [data1]
> superblock 294912, blocksize=4096 [data1]
> superblock 819200, blocksize=4096 [data1]
> superblock 884736, blocksize=4096 [data1]
> superblock 1605632, blocksize=4096 [data1]
> superblock 2654208, blocksize=4096 [data1]
> superblock 4096000, blocksize=4096 [data1]
> 
> Could it be that these are still valid ones?
> 
> When I try to mount e.g.:
> # mount -t ext3 -o sb=$((32768*4))

There is no backup superblock at this offset. You should use one of the superblock locations given above, and also -B 4096 to set the blocksize. 

> /dev/sdc1 /mnt/
> mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
>       missing codepage or helper program, or other error
>       In some cases useful info is found in syslog - try
>       dmesg | tail  or so
> 
> ...it doesn't work however.
> 
> Any ideas?
> 
> Thanks,
> Chris.
> 
> btw: Please CC me as I'm off list.
> 
> 
> [0]mke2fs 1.41.12 (17-May-2010)
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> Stride=0 blocks, Stripe width=0 blocks
> 45793280 inodes, 183143000 blocks
> 9157150 blocks (5.00%) reserved for the super user
> First data block=0
> Maximum filesystem blocks=4294967296
> 5590 block groups
> 32768 blocks per group, 32768 fragments per group
> 8192 inodes per group
> Superblock backups stored on blocks: 
>    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
>    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
>    102400000
> 
> Writing inode tables: ^C00/5590
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-07  5:56 ` Andreas Dilger
@ 2011-05-07 22:03   ` Christoph Anton Mitterer
  2011-05-09 12:06     ` Jan Kara
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Anton Mitterer @ 2011-05-07 22:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-ext4, adilger, amir73il

Hi folks.

What I did then yesterday night, was a

fsck.ext3 -b 32768 -B4096 device

There were MANY errors... (nearly all of them, that wouldn't be
automatically corrected e.g. by -p).


"Something" actually came back, though I cannot say (and probably never
will, as there are millions) whether everything came back and/or whether
the files are internally corrupted.

The problem is that the old directory structure was not recovered, but
_everything_ went into lost+found, some files directly in it (not with
their correct names but #xxxxxx numbers) and also many directories (also
with #xxxxxx numbers as names).
The directories however do contain at least some subtrees of the original
filesystem hierarchy (I mean with the correct names).

I guess there's no (automatic) way now, to get the full directory
structure as before, is there?


Of course I have some backups but unfortunately dating back to last
October (yes, I know, I'm stupid and deserved it ^^)...

Will try now to use fdupes and/or rdfind, to sort out all files that are
equal between backup and rescue fs and manually check and move back the
others (a work of some months probably ^^).


It's not that I wanna blame others (I mean being stupid is my fault), but
e2fsprogs' mkfs is really missing a check whether any known
filesystem/partition type/container (luks, lvm, mdadm, etc.) is already on
device (and a -force switch),... IIRC xfsprogs already do this more or
less.


Thanks and cheers,
Chris.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-07 22:03   ` Christoph Anton Mitterer
@ 2011-05-09 12:06     ` Jan Kara
  2011-05-09 12:43       ` Rogier Wolff
                         ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jan Kara @ 2011-05-09 12:06 UTC (permalink / raw)
  To: Christoph Anton Mitterer; +Cc: linux-fsdevel, linux-ext4, adilger, amir73il

  Hi,

On Sat 07-05-11 22:03:39, Christoph Anton Mitterer wrote:
> What I did then yesterday night, was a
> 
> fsck.ext3 -b 32768 -B4096 device
> 
> There were MANY errors... (nearly all of them, that wouldn't be
> automatically corrected e.g. by -p).
> 
> 
> "Something" actually came back, though I cannot say (and probably never
> will, as there are millions) whether everything came back and/or whether
> the files are internally corrupted.
> 
> The problem is that the old directory structure was not recovered, but
> _everything_ went into lost+found, some files directly in it (not with
> their correct names but #xxxxxx numbers) and also many directories (also
> with #xxxxxx numbers as names).
> The directories however do contain at least some subtrees of the original
> filesystem hierarchy (I mean with the correct names).
> 
> I guess there's no (automatic) way now, to get the full directory
> structure as before, is there?
  No, not really. Actually, contents of the files should be generally OK
because mkfs overwrites only inodes. So you have lost some files and
directories but once you have a file, it should be OK.

> Of course I have some backups but unfortunately dating back to last
> October (yes, I know, I'm stupid and deserved it ^^)...
> 
> Will try now to use fdupes and/or rdfind, to sort out all files that are
> equal between backup and rescue fs and manually check and move back the
> others (a work of some months probably ^^).
> 
> It's not that I wanna blame others (I mean being stupid is my fault), but
> e2fsprogs' mkfs is really missing a check whether any known
> filesystem/partition type/container (luks, lvm, mdadm, etc.) is already on
> device (and a -force switch),... IIRC xfsprogs already do this more or
> less.
  Yes, that would be reasonable although it might break some people's
scripts. But probably worth it anyway.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-09 12:06     ` Jan Kara
@ 2011-05-09 12:43       ` Rogier Wolff
  2011-05-09 12:59       ` Christoph Anton Mitterer
  2011-05-09 13:28       ` Ted Ts'o
  2 siblings, 0 replies; 11+ messages in thread
From: Rogier Wolff @ 2011-05-09 12:43 UTC (permalink / raw)
  To: Jan Kara
  Cc: Christoph Anton Mitterer, linux-fsdevel, linux-ext4, adilger,
	amir73il

On Mon, May 09, 2011 at 02:06:08PM +0200, Jan Kara wrote:
> > e2fsprogs' mkfs is really missing a check whether any known
> > filesystem/partition type/container (luks, lvm, mdadm, etc.) is already on
> > device (and a -force switch),... IIRC xfsprogs already do this more or
> > less.

>   Yes, that would be reasonable although it might break some
>   people's scripts. But probably worth it anyway.

This is a difficult change.... 

Some GUI install things already perform this check and after asking
confirmation from the user will just execute:

	mkfs.ext3 /dev/....

and expect it to make the filesystem. 

So you could add an option: 
	--check _for_existing_filesystem

But then it is quite likely that people running it manually will
forget to add the option....

	Roger. 

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. 
Does it sit on the couch all day? Is it unemployed? Please be specific! 
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-09 12:06     ` Jan Kara
  2011-05-09 12:43       ` Rogier Wolff
@ 2011-05-09 12:59       ` Christoph Anton Mitterer
  2011-05-09 13:10         ` Jan Kara
  2011-05-09 13:18         ` Lukas Czerner
  2011-05-09 13:28       ` Ted Ts'o
  2 siblings, 2 replies; 11+ messages in thread
From: Christoph Anton Mitterer @ 2011-05-09 12:59 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, linux-ext4

On Mon, 2011-05-09 at 14:06 +0200, Jan Kara wrote:
> Actually, contents of the files should be generally OK
> because mkfs overwrites only inodes. So you have lost some files and
> directories but once you have a file, it should be OK.
This is really some good news!! :-)
Are you sure with that? And wouldn't mean, that inodes are always
located at the same block locations?


> > It's not that I wanna blame others (I mean being stupid is my fault), but
> > e2fsprogs' mkfs is really missing a check whether any known
> > filesystem/partition type/container (luks, lvm, mdadm, etc.) is already on
> > device (and a -force switch),... IIRC xfsprogs already do this more or
> > less.
>   Yes, that would be reasonable although it might break some people's
> scripts. But probably worth it anyway.
IMHO the breakage is really justified then :-)

Especially as some of those scripts might actually do their own checks
for some filesystems, but perhaps completely forget about other
containter types (partitions, LUKS, mdadm, etc. etc.)


Cheers,
Chris.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-09 12:59       ` Christoph Anton Mitterer
@ 2011-05-09 13:10         ` Jan Kara
  2011-05-09 13:47           ` Christoph Anton Mitterer
  2011-05-09 13:18         ` Lukas Czerner
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Kara @ 2011-05-09 13:10 UTC (permalink / raw)
  To: Christoph Anton Mitterer; +Cc: Jan Kara, linux-fsdevel, linux-ext4

On Mon 09-05-11 14:59:29, Christoph Anton Mitterer wrote:
> On Mon, 2011-05-09 at 14:06 +0200, Jan Kara wrote:
> > Actually, contents of the files should be generally OK
> > because mkfs overwrites only inodes. So you have lost some files and
> > directories but once you have a file, it should be OK.
> This is really some good news!! :-)
> Are you sure with that? And wouldn't mean, that inodes are always
> located at the same block locations?
  Well, the block size is most likely the same (4 KB) in both the old and
the new fs (unless you tinkered with it but I don't expect that). That
defines size of a block group and thus position of inodes, bitmaps, etc.
Another variable is a number of inodes (per group). If you have an old
superblock you can compare the old and the new number of inodes and you
can be sure. Otherwise you rely on whether the math in the mkfs with which
you've originally created the fs is the same as the math in your current
mkfs (and you didn't specify any special options regarding this)...

								Honza
 
> > > It's not that I wanna blame others (I mean being stupid is my fault), but
> > > e2fsprogs' mkfs is really missing a check whether any known
> > > filesystem/partition type/container (luks, lvm, mdadm, etc.) is already on
> > > device (and a -force switch),... IIRC xfsprogs already do this more or
> > > less.
> >   Yes, that would be reasonable although it might break some people's
> > scripts. But probably worth it anyway.
> IMHO the breakage is really justified then :-)
> 
> Especially as some of those scripts might actually do their own checks
> for some filesystems, but perhaps completely forget about other
> containter types (partitions, LUKS, mdadm, etc. etc.)
> 
> 
> Cheers,
> Chris.
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-09 12:59       ` Christoph Anton Mitterer
  2011-05-09 13:10         ` Jan Kara
@ 2011-05-09 13:18         ` Lukas Czerner
  1 sibling, 0 replies; 11+ messages in thread
From: Lukas Czerner @ 2011-05-09 13:18 UTC (permalink / raw)
  To: Christoph Anton Mitterer; +Cc: Jan Kara, linux-fsdevel, linux-ext4

On Mon, 9 May 2011, Christoph Anton Mitterer wrote:

> On Mon, 2011-05-09 at 14:06 +0200, Jan Kara wrote:
> > Actually, contents of the files should be generally OK
> > because mkfs overwrites only inodes. So you have lost some files and
> > directories but once you have a file, it should be OK.
> This is really some good news!! :-)
> Are you sure with that? And wouldn't mean, that inodes are always
> located at the same block locations?
> 
> 
> > > It's not that I wanna blame others (I mean being stupid is my fault), but
> > > e2fsprogs' mkfs is really missing a check whether any known
> > > filesystem/partition type/container (luks, lvm, mdadm, etc.) is already on
> > > device (and a -force switch),... IIRC xfsprogs already do this more or
> > > less.
> >   Yes, that would be reasonable although it might break some people's
> > scripts. But probably worth it anyway.
> IMHO the breakage is really justified then :-)
> 
> Especially as some of those scripts might actually do their own checks
> for some filesystems, but perhaps completely forget about other
> containter types (partitions, LUKS, mdadm, etc. etc.)

Well, it really is not justified!. We all have testing scripts where we
just create filesystem over and over again because it is how it works,
consider xfstests for example, there are even some tests which clears
MKFS_OPTIONS completely (which should be fixet btw).

However I do agree that the change should be made, but we should
probably just print an warning first and then after some time, when
people notice that something is going to change, make that change to
refuse mkfs on existing filesystem without "-F" option.

Thanks!
-Lukas

> 
> 
> Cheers,
> Chris.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-09 12:06     ` Jan Kara
  2011-05-09 12:43       ` Rogier Wolff
  2011-05-09 12:59       ` Christoph Anton Mitterer
@ 2011-05-09 13:28       ` Ted Ts'o
  2 siblings, 0 replies; 11+ messages in thread
From: Ted Ts'o @ 2011-05-09 13:28 UTC (permalink / raw)
  To: Jan Kara
  Cc: Christoph Anton Mitterer, linux-fsdevel, linux-ext4, adilger,
	amir73il

On Mon, May 09, 2011 at 02:06:08PM +0200, Jan Kara wrote:
>   Yes, that would be reasonable although it might break some people's
> scripts. But probably worth it anyway.

I wouldn't object to a patch to e2fsprogs which changes mke2fs to do
this check and refuses to blow away a file system if:

[defaults]
    check_for_prexisting_fs = true

was in /etc/mke2fs.conf.

I'd also suggest that mke2fs -f NOT enable mke2fs to blow away file
systems, but that we add a new utility --- probably to util-linux-ng
--- with the destroy_partition, which a system administrator has to
explicitly run to blow away a partition.

I'd really rather not train people that mke2fs -f is the way to get
the utility to !@#@! shut up.  It's exactly the same problem with why
"alias rm 'rm -i'" doesn't work.  System administrators just get in
the habit of typing return, 'y', return, and in the end things still
just get lost.

If we have a separate utility, destroy_filesystem, which checks to see
if there is a tty, and if so, prints the details of what is on the
partition, and then forces the user to type "YES<return>", then we
have a unified way of protecting against careless sysadmins.  We can
also have that utility do clever things, such as simply telling the
hard drive to reinitiailize its crypto keys if it supports FDE, or
tell it to TRIM the entire disk if it supports TRIM/DISCARD, etc.

							- Ted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-09 13:10         ` Jan Kara
@ 2011-05-09 13:47           ` Christoph Anton Mitterer
  2011-05-09 14:08             ` Jan Kara
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Anton Mitterer @ 2011-05-09 13:47 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, linux-ext4

On Mon, 9 May 2011 15:10:27 +0200, Jan Kara <jack@suse.cz> wrote:
>   Well, the block size is most likely the same (4 KB) in both the old
and
> the new fs (unless you tinkered with it but I don't expect that). That
> defines size of a block group and thus position of inodes, bitmaps, etc.
> Another variable is a number of inodes (per group). If you have an old
> superblock you can compare the old and the new number of inodes and you
> can be sure. Otherwise you rely on whether the math in the mkfs with
which
> you've originally created the fs is the same as the math in your current
> mkfs (and you didn't specify any special options regarding this)...

Well I didn't change them but maybe Debian has modified the defaults in
mke2fs.conf since I created the fs initially.
inode_size = 256 could be a candidate. Unfortunately I don't remember
which Debian/e2fsprogs I've used to create the fs originally.

Was this ever set to 128 (i mean as a default for e2fsprogs itself, when
it was not set in mke2fs.conf)?


If the values would have actually changed, wouldn't this mean that all
data was then gone?


Cheers,
Chris

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mounting ext3 with another superblock doesn't work?
  2011-05-09 13:47           ` Christoph Anton Mitterer
@ 2011-05-09 14:08             ` Jan Kara
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Kara @ 2011-05-09 14:08 UTC (permalink / raw)
  To: Christoph Anton Mitterer; +Cc: Jan Kara, linux-fsdevel, linux-ext4

On Mon 09-05-11 13:47:41, Christoph Anton Mitterer wrote:
> On Mon, 9 May 2011 15:10:27 +0200, Jan Kara <jack@suse.cz> wrote:
> >   Well, the block size is most likely the same (4 KB) in both the old
> and
> > the new fs (unless you tinkered with it but I don't expect that). That
> > defines size of a block group and thus position of inodes, bitmaps, etc.
> > Another variable is a number of inodes (per group). If you have an old
> > superblock you can compare the old and the new number of inodes and you
> > can be sure. Otherwise you rely on whether the math in the mkfs with
> which
> > you've originally created the fs is the same as the math in your current
> > mkfs (and you didn't specify any special options regarding this)...
> 
> Well I didn't change them but maybe Debian has modified the defaults in
> mke2fs.conf since I created the fs initially.
> inode_size = 256 could be a candidate. Unfortunately I don't remember
> which Debian/e2fsprogs I've used to create the fs originally.
> 
> Was this ever set to 128 (i mean as a default for e2fsprogs itself, when
> it was not set in mke2fs.conf)?
  Yes it was although relatively long time ago (several years).

> If the values would have actually changed, wouldn't this mean that all
> data was then gone?
  Not really because we store extended attributes in the additional 128
bytes of inode space and unless we see proper magic value we ignore the
contents. So you'd just silently loose every second inode I think.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-05-09 14:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-07  0:09 mounting ext3 with another superblock doesn't work? Christoph Anton Mitterer
2011-05-07  5:56 ` Andreas Dilger
2011-05-07 22:03   ` Christoph Anton Mitterer
2011-05-09 12:06     ` Jan Kara
2011-05-09 12:43       ` Rogier Wolff
2011-05-09 12:59       ` Christoph Anton Mitterer
2011-05-09 13:10         ` Jan Kara
2011-05-09 13:47           ` Christoph Anton Mitterer
2011-05-09 14:08             ` Jan Kara
2011-05-09 13:18         ` Lukas Czerner
2011-05-09 13:28       ` Ted Ts'o

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).