This application claims all benefits accruing under 35 U.S.C. §119 from China Patent Application No. 201310222967.X, filed on Jun. 6, 2013 in the State Intellectual Property Office of China, entire contents of which are hereby incorporated by reference.
1. Technical Field
The disclosure generally relates to storage devices, and particularly relates to systems and methods for converting a hard disk drive (HDD) of a first disk partition format into a second disk partition format.
2. Description of Related Art
Most computers store data in hard disk drives (HDDs). Generally, an HDD is divided into multiple logic storage units referred to as partitions. There are two major disk partition formats: the master boot record (MBR) format and the globally unique identifier partition table (GPT) format. However, converting the HDD of one partition format into another partition format often results in data loss.
Therefore, there is room for improvement within the art.
Many aspects of the embodiments can be better understood with reference to the following drawings. The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the embodiments. Moreover, in the drawings, like reference numerals designate corresponding parts throughout the views.
The disclosure is illustrated by way of example and not by way of limitation in the figures of the accompanying drawings, in which like reference numerals indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references can mean “at least one.”
In general, the word “module,” as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language such as Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an erasable-programmable read-only memory (EPROM). The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media are compact discs (CDs), digital versatile discs (DVDs), Blu-Ray discs, Flash memory, and hard disk drives.
In the illustrated embodiment of
The processor 101 may be implemented or performed with a general purpose processor, a content addressable memory, a digital signal processor, an application specific integrated circuit, a field programmable gate array, any suitable programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination designed to perform the functions described herein.
The memory 102 may be realized as RAM memory, flash memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. The memory 102 is coupled to the processor 101 such that the processor 101 can read information from, and write information to, the memory 102. The memory 102 can be used to store computer-executable instructions. The computer-executable instructions, when read and executed by the processor 101, cause the electronic device 10 to perform certain tasks, operations, functions, and processes described in more detail herein.
The display 103 is suitably configured to enable the electronic device 10 to render and display various screens, GUIs, GUI control elements, menus, texts, or images, for example. Of course, the display 103 may also be utilized for the display of other information during the operation of the electronic device 10, as is well understood.
The input device 104 provides an input interface between the electronic device 10 and a user. The input device 104 can be a mouse, a keyboard, a touchpad, a joystick, or any other suitable type of input device.
The hard disk interface 105 may provide connectivity channels for reading/writing data from/to the HDD 106. The hard disk interface 105 may represent a serial advanced technology attachment (SATA) controller or a small computer system interface (SCSI), for example.
The disk partition format conversion system 20 may be implemented in the electronic device 10 using software, firmware, or other computer programming technologies. In the embodiment, the disk partition format conversion system 20 may convert the HDD 106 of the master boot record (MBR) format into the globally unique identifier partition table (GPT) format, or vice versa.
The DPT reading module 201 reads a first DPT from the HDD 106 of a first disk partition format via the hard disk interface 105. The first DPT is in compliance with the first disk partition format. When the first disk partition format is the GPT format, the DPT reading module 201 further reads information regarding a total number of sectors of a logic block from a GPT header of the HDD 106.
The DPT conversion module 202 converts the first DPT into a second DPT in compliance with a second disk partition format.
When the first disk partition format is the MBR format and the second disk partition format is the GPT format, the DPT conversion module 202 obtains a starting logic block address and an ending logic block address pointing to a disk partition, according to the following equations:
Wherein A1 represents the starting logic block address, A2 represents the ending logic block address, S1 represents a starting sector address pointing to the disk partition, S2 represents a total number of sectors of the disk partition, and L represents a total number of sectors of a logic block.
When the first disk partition format is the GPT format and the second disk partition format is the MBR format, the DPT conversion module 202 obtains a starting sector address pointing to a disk partition and a total number of sectors of the disk partition, according to the following equations:
S
1
=A
1
*L,
S
2=(A2−A1±1)*L,
Wherein S1 represents the starting sector address, S2 presents the total number of sectors of the disk partition, A1 represents a starting logic block address of the disk partition, A2 represents an ending logic block address of the disk partition, and L represents a total number of sectors of a logic block.
The partition format conversion module 203 converts the HDD 106 of the first disk partition format into the second disk partition format. In some embodiments, the partition format conversion module 203 utilizes a known partition format conversion command line interface (CLI), such as “Diskpart,” to perform the partition format conversion.
When the partition format conversion module 203 has completed the partition format conversion, the DPT writing module 204 writes the second DPT into the HDD 106 via the hard disk interface 105. When the second partition format is the GPT format, the DPT writing module 202 further writes information regarding the total number of sectors of a logic block into the GPT header of the HDD 106.
In step S501, the DPT reading module 201 reads a first DPT from the HDD 106 of a first disk partition format via the hard disk interface 105. The first DPT is in compliance with the first disk partition format. When the first disk partition format is the GPT format, the DPT reading module 201 reads information regarding a total number of sectors of a logic block from a GPT header of the HDD 106.
In step S501, the DPT conversion module 202 converts the first DPT into a second DPT in compliance with a second disk partition format.
When the first disk partition format is the MBR format and the second disk partition format is the GPT format, the DPT conversion module 202 obtains a starting logic block address and an ending logic block address pointing to a disk partition, according to the following equations:
Where A1 represents the starting logic block address, A2 represents the ending logic block address, S1 represents a starting sector address pointing to the disk partition, S2 presents a total number of sectors of the disk partition, and L represents a total number of sectors of a logic block.
When the first disk partition format is the GPT format and the second disk partition format is the MBR format, the DPT conversion module 202 obtains a starting sector address pointing to a disk partition and a total number of sectors of the disk partition by using the following equations:
S
1
=A
1
*L,
S
2=(A2−A1±1)*L,
Where S1 represents the starting sector address, S2 presents the total number of sectors of the disk partition, A1 represents a starting logic block address of the disk partition, A2 represents an ending logic block address of the disk partition, and L represents a total number of sectors of a logic block.
In step S503, the partition format conversion module 203 converts the HDD 106 of the first disk partition format into the second disk partition format.
In step S504, the DPT writing module 204 writes the second DPT into the HDD 106 via the hard disk interface 105. When the second partition format is the GPT format, the DPT writing module 202 writes information regarding the total number of sectors of a logic block into the GPT header of the HDD 106.
Although numerous characteristics and advantages have been set forth in the foregoing description of embodiments, together with details of the structures and functions of the embodiments, the disclosure is illustrative only, and changes may be made in detail, especially in the matters of arrangement of parts within the principles of the disclosure to the full extent indicated by the broad general meaning of the terms in which the appended claims are expressed.
Number | Date | Country | Kind |
---|---|---|---|
201310222967X | Jun 2013 | CN | national |