2006-11-05 03:01:09

by Chuanwen Wu

[permalink] [raw]
Subject: How to change my fs's magic number?

Hi,everybody!

I am learning how to add my file system.
Now ,i have add my fs called "myext2" with the magic number 0x6666
(" #define MYEXT2_SUPER_MAGIC 0x6666" in the file
include/linux/myext2_fs.h)to the kernel .
Myext2 is similar with ext2 but the name.
And i compiled kernel successfully.
And then i created my "myfs" in the type myext2

#dd if=/dev/zero of=myfs bs=1M count=1
#mkfs.ext2 myfs

The problem is after "#mkfs.ext2 myfs" ,how i can change myfs's magic
number to 0x6666 but not 0xEF53 which is used by ext2?

Thanks in advanced!
--
wcw


2006-11-16 06:18:01

by Fawad Lateef

[permalink] [raw]
Subject: Re: How to change my fs's magic number?

Hello,

On 11/5/06, Chuanwen Wu <[email protected]> wrote:
> Hi,everybody!
>
> I am learning how to add my file system.
> Now ,i have add my fs called "myext2" with the magic number 0x6666
> (" #define MYEXT2_SUPER_MAGIC 0x6666" in the file
> include/linux/myext2_fs.h)to the kernel .
> Myext2 is similar with ext2 but the name.
> And i compiled kernel successfully.
> And then i created my "myfs" in the type myext2
>
> #dd if=/dev/zero of=myfs bs=1M count=1
> #mkfs.ext2 myfs
>
> The problem is after "#mkfs.ext2 myfs" ,how i can change myfs's magic
> number to 0x6666 but not 0xEF53 which is used by ext2?
>

I am assuming that you changed EXT2 filesystem in a way that only name
of the filesystem and magic number is changed by you, now when you are
creating filesystem through mkfs.ext2 it is writting the magic number
of EXT2 in your file/drive so you must change mkfs.ext2 utility too
means it should write your specified magic number on file/drive during
filesystem creation and you will be able to mount it. You can get the
source of mkfs and other ext2 related utilties from e2fsprogs (just
google for it).

--
Fawad Lateef