Re: How does the superblock/mount -t auto work? (was: Synching volumes on logout -- tune2fs)
On Fri, 26 Dec 2003 16:08:42 -0700, Monique Y. Herman wrote:
> On Fri, 26 Dec 2003 at 21:15 GMT, Paul Morgan penned:
>>
>> With "auto", mount will probe the superblock to get the filesystem
>> type. cf. "man mount"
>>
>
> I'm not sure how to take a peek at the superblock myself, but the
> relevant output of tune2fs -l is:
>
> Filesystem magic number: 0xEF53
> Filesystem features: has_journal filetype needs_recovery
> sparse_super
>
> Now, here's what I wonder about. As I understand it, ext3 is really
> just ext2 with some added features. So then, is the magic number for
> both the same, and is the fact that I have has_journal under "filesystem
> features" the same as saying that it's actually *using* the journal?
>
> Or in other words, is the superblock actually going to look any
> different between ext2 and ext3? My naive guess is that the superblock
> would be the same, and therefore that 'auto' would mount an ext3
> partition as ext2, but I just don't know.
>
> I've been trying to come up with a good google search that would
> demistify this stuff for me, but so far most searches just come up with
> superblock/magic number *errors*, not explanations.
>
>
> So it appears that, if I knew for sure that a filesystem could be seen
> as more than one type, I could give mount hints. More importantly, I
> should really explicitly set it to 'ext3,ext2' for the root partition
> (and will, when I get home). But I'd really like to understand how all
> of this filesystem stuff works.
The magic number is part of the superblock. tune2fs -l is showing you the
superblock. The magic number is the same for ext2 and ext3, but the
features are different (has_journal for ext3). This is very useful:
Suppose you have an ext3 root filesystem. If your kernel is ext3-aware
(i.e. ext3 support compiled in or module on initrd), it will mount root as
ext3. If your kernel is not ext3-aware, it will mount root as ext2.
ext3 is just ext2 with a file (the journal) which is used by the ext3
driver. Apart from that, it is a standard ext2 filesystem. You can also
mount an ext3 filesystem explicitly as ext2. Of course, you temporarily
lose the journalling feature, but it'll work OK.
I use exclusively ext3 but just for you I created an ext2 example :)
pooh:~# mke2fs /dev/vgtst/lvtst
mke2fs 1.35-WIP (21-Aug-2003)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
[...]
pooh:~# tune2fs -l /dev/vgtst/lvtst
tune2fs 1.35-WIP (21-Aug-2003)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: f356a832-a589-4a47-a17b-fad98263f491
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: filetype sparse_super
[...]
--
....................paul
Reply to: