1. A magnetic disk device comprising: a disk that includes a plurality of tracks and magnetically stores therein data; a magnetic head that reads and writes data on the tracks; a voice coil motor that moves the magnetic head to select an arbitrary track from the tracks; a read/write channel that modulates the data read and written by the magnetic head; a servo control circuit that controls a position of the tracks; a controller that includes a micro processing unit and performs control; an error check and correct circuit that corrects the data; an interface circuit that connects the magnetic disk device to an external device; a data writing unit that classifies sectors along one track into a plurality of sector groups and writes to a physical address of each of the sector groups data of a logical address that is different from a logical address corresponding to the physical address in same track; a first nonvolatile memory that stores therein a conversion table of the logical address and the physical address; a second nonvolatile memory that stores therein a data valid flag that indicates whether the data written on the disk is valid data; an input unit that receives a write invalid command, which indicates that the data written on the disk is already invalid, and address and size indicating an effective range of the write invalid command, from an external interface; and a changing unit that changes the data valid flag based on the write invalid command and the address and size.