1. Field of the Invention
The present invention relates to an electronic device having a file restore function and a method thereof. More particularly, the present invention relates to an electronic device having a file restore function and a method thereof, which can restore a file to its original state after the storage medium on which the file exists has been formatted by unformatting the formatted file.
2. Description of the Related Art
A file system refers to a method or software supporting the method, which names a file and indicates where to logically position the file in order to store or retrieve the file. Most operating systems such as DOS, Windows, Linux, Unix, Macintosh, and so forth, support a file allocation table (FAT) file system.
FIG. 1 is a view illustrating the structure of a general file system.
The file system as illustrated in FIG. 1 has the structure of a FAT file system which includes a reserved region, a FAT region, a root region, and a data region.
The reserved region is a region which is not in use and is reserved for future use, or in which special information desired by a user is recorded. The FAT region is a region for storing or retrieving a file, and in the FAT region, tables for managing clusters in the data region are gathered. The FAT region includes a first FAT region and a second FAT region that is a backup copy of the first FAT region.
The root region is a region in which a directory entry including the name, start cluster, and size of a root folder is stored. In FAT12 or FAT16, the root region exists separately. However, in FAT32, the root region does not exist separately, but the directory entry of the root folder is stored in a region corresponding to one cluster among a part of the data region, the position of which is the same as that of the root region in FAT12 or FAT16.
The data region is a region from/in which actual data is read/written in the logical unit of a cluster. In the case of a sub-folder, the directory entry of the sub-folder is stored after one cluster of the data region.
In order to initialize the file system as described above, full formatting or quick formatting is performed. Full formatting initializes the whole storage region of a recording medium, and thus it is impossible to restore data after a full formatting is performed. Quick formatting initializes only a part of the whole region, and thus it may be possible to restore data after a quick formatting is performed, depending on circumstances.
FIG. 2 is a flowchart explaining a general file formatting method.
In FIG. 2, quick formatting is exemplified. If a format command is inputted to an electronic device at step (S10), a reserved region is initialized at step (S30). In other words, data recorded in the reserved region is deleted. A FAT region is initialized at step (S50). That is, tables for managing clusters recorded in the FAT region are deleted.
Last, a root region or a part of a data region that corresponds to the root region is initialized at step (S70). That is, in the case of FAT12 or FAT16, the directory entry recorded in the root region is deleted, while in the case of FAT32, data recorded in a region that corresponds to one cluster of the data region is deleted.
As described above, in the formatting process, the directory entry including the name, start cluster, and size of a root folder is deleted, and the tables for managing the clusters of the data region are all deleted. Accordingly, it is impossible for a user to restore the data recorded in the data region, and thus the user may lose his/her important information.
In the case of a sub-folder, since the directory entry is stored after one cluster of the data region, they are not deleted during the formatting process, but the tables for managing the clusters recorded in the FAT region are all deleted. Accordingly, it is impossible for a user to restore the data unless the data is backed up by the user before being formatted.