Re: FS size sanity check

Theodore Y. Ts'o (tytso@MIT.EDU)
Wed, 11 Feb 1998 00:16:49 -0500


Date: Wed, 11 Feb 1998 03:44:47 +0530 (IST)
From: ganesh@cse.iitb.ernet.in

Shouldn't there be a sanity check somewhere to see that the
filesystem size is <= device size before mounting ? It seems that
this is not done, at least for msdos. We just had a case where a dos
fs which thought it was 2GB was actually sitting in a 1 GB partition
with the rest of the disk being linux, leading to a lot of grief when
it overran into the linux partitions. Looks like someone had
repartitioned the disk for installing linux without bothering to use
fips or reformatting the dos side. Although the situation was
definitely caused by user stupidity, I think there should at least be
a warning somewhere while mounting such a "dangerous" fs. The
question is, should it be in userspace (mount), or in the kernel ? If
in the kernel, each fs should probably do the check in its read_super
since there are some fs's like compressed fs's whose advertised size
legitimately exceeds the block device size.

This check is already done by e2fsck; so if an ext2 filesystem is bigger
than the partition, you will get a warning during the boot sequence.

It would probably be a good idea to put a check in the kernel for this
sort of thing, though. Especially for filesystems like FAT and VFAT,
where we don't have filesystem checkers which get run at boot time.

- Ted

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu