11 years, 4 months ago.

Why file's Blocks size > file's actual size

I'm writing data into SD card,I found out that the total blocks transferred in turn of size always greater than the file itself. I also found out that extra blocks(total blocks - file size/512) is not always proportional to file's size.

int SDFileSystem::disk_write(const char *buffer, int block_number) {
    // set write address for single block (CMD24)
    if(_cmd(24, block_number * 512) != 0) {
        return 1;
    }

    // send the data block
    _write(buffer, 512);    
    return 0;    
}

So, I'm wondering is there any extra information in it or some parts of data get repeated ? Does this relate to cluster size on my SD card?

Be the first to answer this question.