1. A method for managing a flash storage system, comprising: reading a plurality of flash data units from flash memory into a buffer, wherein each of the plurality of flash data units includes one or more host data units; determining an identifier for each of the host data units read into the buffer; selecting a set of unique identifiers from the determined identifiers based on a number of host data units that share the respective unique identifiers; and for each unique identifier in the set of unique identifiers: designating a first host data unit sharing the unique identifier as a master data unit, wherein a logical address of the first host data unit is mapped to a first physical address in the flash memory in a lookup table; remapping, in the lookup table, respective logical addresses of one or more second host data units sharing the unique identifier from respective second physical addresses in the flash memory to the first physical address in the flash memory; and invalidating data stored at the respective second physical addresses in the flash memory.