As I understand it, flash drives use wear leveling to spread the writing burden over many sectors of the disk. So each time I overwrite the same sector, say logical sector 100, the data goes to a different spot on the drive. That makes sense.
However, suppose I fill up the drive with data, then free half of it. My question is: how does the drive know that half its sectors are free again for use in wear leveling? As far as the drive knows, all of its sectors still hold data from when the drive was full, and no sectors are available for levelling purposes.
Is there some protocol for telling the drive that "sectors x, y, z are now free"? Or does the drive itself understand the disk layout of the zillions of different filesystems out there?