1

I was creating a new file system in my external HDD. While formatting, I had to format this partition to the remaining available partition which is somewhere around 850GB. Now, I created an ext3 file system in this partition. This is the output of my mkfs.ext3 command.

mkfs.ext3 /dev/sdb3
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
52060160 inodes, 208234530 blocks
10411726 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
6355 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Can someone help me debug the information as am not clear on what these values actually represent?

Ramesh
  • 39,297

1 Answers1

1

First, let us use the bytes notation to understand the concepts. Now, the actual size of the external HDD was 850GB which translates to 912680550400 bytes.

Block size and fragment size

The block size specifies the size that the file-system will use to read and write data. Here the default block size of 4096 bytes is used. The ext3 file system doesn't support block fragmentation so a one byte file will use a whole 4096 block. This can be modified by specifying the -f in the mkfs command but it is not suggested as the file systems today have enough capacity.

Total blocks possible = 912680550400/4096 = 222822400 blocks

So in our command output we have actually got 208234530 blocks which is pretty close to our calculation and because there will always be some blocks that cannot be used.

Total inodes in this example = 208234530/4 = 52058632.5 inodes

As per derobert's comment, the total inodes is the number that mkfs is actually creating. inodes on ext2/3/4 are created at mkfs time. We can change how many it creates with several options (-i, -N) and different -T options do so implicitly.

It is always a heuristic and so the total inodes possible as per our command is 52060160 inodes.

Maximum file system size possible = 4294967296 * 4096 (block size)

So theoretically the file system size can be upto 16 TB but however, it is not true.

The size of a block group is specified in sb.s_blocks_per_group blocks, though it can also calculated as 8 * block_size_in_bytes. So total block groups possible could be,

total block groups = 208234530/32768 = 6354.81 

So it is close to 6355 groups as per our command output.

Total inodes per group = 32768/4 = 8192 inodes

References

http://www.redhat.com/archives/ext3-users/2004-December/msg00001.html

https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout

https://serverfault.com/a/117598

What is a fragment size in an ext3 filesystem?

Ramesh
  • 39,297
  • Please verify the answer and if there is something wrong, let me know. If there are any contents worth adding, you are welcome to add it too :) – Ramesh Jun 18 '14 at 04:22
  • It's not total inodes possible, it's the number that mkfs is actually creating. inodes on ext2/3/4 are created a mkfs time. You can change how many it creates with several options (-i, -N) and different -T options do so implicitly. Also, it should probably be 2³²-1 (4294967295)... – derobert Jun 19 '14 at 18:22
  • @derobert, thanks for providing the information. I have added the information you gave and edited the answer. – Ramesh Jun 19 '14 at 22:07