1

I have an image-file of an ext4 file system (filesystem.img). I am extracting sections sections of the filsystem. Is there a way to manually calculate the the checksum of the sections just with a given byte dump of the section. Given the the superblock according to the documentation the checksum is calculated by using the algorithm CRC32C over the superblock ignoring the checksum field. I have tried to do it in python with the function checksum = crc32c.crc32c(superblock) but with no success yet. Has anybody managed to do this or know what I have to do there?

Any help would be appreciated. Thanks

1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Mar 18 at 13:35

1 Answer 1

1

Firstly, you should preferably use libext2fs for doing direct ext2/3/4 filesystem access. This has handling for the checksums and you don't need to worry about such details yourself.

That said, the metadata checksum mechanism is described in the ext4 kernel doc: https://docs.kernel.org/filesystems/ext4/overview.html#checksums

The important thing you are missing is that each metadata checksum is initially seeded with the checksum of the filesystem UUID and (depending on what is being checksummed) the inode number and generation. This ensures that if an inode is written in the wrong location, or an extent block is referenced by the wrong inode, it will have the wrong checksum.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.