Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I tried to view the superblock by command "dd" in ext3 file system.

dd if=/dev/sda3 bs=4096 skip=1 count=1 of=superblock

But the result in superblock file is not correct(I compare the value of Inodes count I got from dumpe2fs). The device file /dev/sda3 is started at the boot block and then the superblock of the group0? And another question is the boot block and superblock's size are both BLOCKSIZE(here is 4096)? The disk format of ext2/ext3(I think they are the same) are shown below:

alt text

share|improve this question

migrated from stackoverflow.com Feb 23 '10 at 16:57

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

Boot block of the ext2/ext3 filesystem is 1024 bytes long, not 4096. Use

  $ sudo tune2fs -l /dev/sda3

to see filesystem parameters as block size, and

  $ sudo dumpe2fs -hx /dev/sda3

to get the superblock. Also

  $ sudo dd if=/dev/sda3 bs=1k skip=1 count=4

will get the superblock.

share|improve this answer
add comment

Thanks for dtmilano's answer. I had already tried it before asking the question. But I think the result is wrong. The problem is I forget to convert the little endian!!

Below I write down my steps for your reference:

$ sudo dd if=/dev/sda3 bs=1k skip=1 count=4

The first line in the superblock is: 0000000: 0000 3a04 fdc4 3904 a616 3600 45f6 fc00 ..:...9...6.E...

So according to the struct ext3_super_block declarision in ext3_fs.h: /00/ __le32 s_inodes_count; /* Inodes count */ __le32 s_blocks_count; /* Blocks count */

The inodes count is 043a0000 = 70909952 (0000 3a04 should be convert to 043a0000) The blocks count is 0439c4fd = 70894845

It's same as the output from dumpe2fs: Inode count: 70909952 Block count: 70894845

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.