0

I'm confused about the partitions size of a flash memory in my embedded linux device:

/ # cat /proc/partitions
major minor  #blocks  name

 240        0      93184 ndda
 240        1      85168 ndda1
 240        2       7000 ndda2
 240        3       1000 ndda3

I know the partitions corresponding to ndda2 and ndda3 were created to have 7000 kB and 1000 kB of size respectively.

I see ndda is 16 kB larger than the sizes of ndda1 + ndda2 + ndda3.

That is, 93184 - (85168 + 7000 + 1000) = 16.

What is responsible for those 16 kB and where can I get to know more about it?

Now, if I mount ndda1 on a directory, called /nand1, I get:

/ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
tmpfs                    27044         0     27044   0% /dev/shm
/dev/ndda1               84928     64288     20640  76% /nand1

Its size (84928 kB?) is 240 kB less than what is reported by /proc/partitions.

Again, what structure is responsible for that?

The partition was mounted as vfat.

0

Partitions are generally started on a boundary of 2MB to align the filesystem blocks with the physical blocks (which may be 16kB, 64kB or even larger, depending on the device). Misaligned blocks mean that when one filesystem block is updated, two device blocks need to be fetched, the last part of the first block gets updated, and the first part of the second block gets updated, and both blocks are written back. This is two block reads and one block write more than with a properly aligned filesystem.

At the very beginning of the device, you find the partition table itself. That is why the first partition can't begin at block 0.

As to your second question (why is the filesystem smaller than the device): the filesystem needs its management data (e.g. list of free blocks) which is reserved space, and hence not available for direct data storage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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