1. A memory controller for a nonvolatile memory, the controller comprising: a counter configured to count a number of valid pages in a block comprising a page to be disabled upon writing, when data is written in the nonvolatile memory; an adding module configured to set the block as an object of compaction when the number of valid pages counted by the counter is smaller than a threshold number; and a compaction candidate management table configured to store an information indicating an object block of compaction by the adding module, wherein the compaction candidate management table is accessible from hardware and firmware.