In long-term deployments of Wireless Sensor Networks, it is often more efficient to store sensor readings locally at each device and transmit those readings to the user only when requested (i.e., in response to a user query). Many of the techniques that collect information from a sensor network require that the data is sorted on some attribute (e.g., range queries, top-k queries, join queries, etc.) Yet, the underlying storage medium of these devices (i.e., Flash media) presents some unique characteristics which renders traditional diskbased sorting algorithms inefficient in this context. In this paper we devise the FSort algorithm, an efficient external sorting algorithm for flash-based sensor devices with a small memory footprint. FSort minimizes the expensive write/delete operations of flash memory minimizing in that way the consumption of energy. In particular, FSort uses a top-down replacement selection algorithm in order to produce sorted runs on flash media in a log-based ma...