mke2fs to format partitions
mke2fs -i 8825 /dev/hda7
This formats /dev/hda7 with a particular number of inodes per group.
From the mke2fs manpage:
-i bytes-per-inode
Specify the bytes/inode ratio. mke2fs creates an inode for every bytes-per-inode bytes of space on the disk. The larger the bytes-per-inode ratio, the fewer inodes will be created. This value generally shouldn't be smaller than the blocksize of the filesystem, since then too many inodes will be made. Be warned that is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter.
I wanted two partitions formatted similarly with respect to certain parameters. The number of block groups will differ based on the size of the partition, but the number of inodes in each block group had to be the same in both partitions. This is needed to avoid problems while copying datablocks from the src partition to the dest partition. When I copy an inode (with inode number 'n' say) from srcDisk to destDisk, I will look for the offset of inode 'n' in the dest disk using the information read from the superblock of the destination partition. But when I find a block number say '100' in inode 'n' and try to copy that block's contents in the source disk to block '100' of the destination disk, I do not want to overwrite some inodes' contents of the destination disk in the process. So, we can make sure that if block 100 stores data in the source disk, block 100 of the destination disk also stores data, and not inodes or other control structures.
The magic number 8825 is for one particular case. I had to find that number by trial and error.
0 Comments:
Post a Comment
<< Home