Disk partition management method and device, equipment and storage medium
By automatically backing up data in unmounted disk partitions on the Linux platform and performing disk partition management operations, the problem of immature disk partition expansion technology on the Linux platform is solved, and the security and convenience of disk partition management are improved.
Patent Information
- Application Number
- CN202311716375.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-13
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, the disk partition expansion technology of the Linux platform is not mature enough and it is not easy to retain partition data, resulting in the partition expansion operation requiring professional and technical personnel to perform, which easily leads to system crashes and data loss.
Provides a disk partition management method, which automatically backs up data in unmounted disk partitions after receiving data backup instructions, and automatically performs disk partition management operations after data backup is completed, ensuring data security and operation convenience.
It improves the security and convenience of disk partition management, lowers the technical threshold for operators, saves time and labor costs, and avoids the risks of data loss and system crashes.
Smart Images

Figure CN120144041A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of disk management, and in particular to a disk partition management method, device, equipment and storage medium. Background Art
[0002] Whether for professional technicians or engineering operators, there will always be a problem of insufficient space in a certain disk partition. Therefore, there is a great demand for the partition expansion function. However, in some operating systems, for example, the Linux platform, its partition expansion technology is not as mature as that of the Windows platform, and it is not easy to retain partition data. This makes most of the partition expansions under Linux require professional technicians to complete the operation. Once non-professional technicians operate improperly, it is easy to cause serious consequences such as system crashes and data loss. Moreover, the partition expansion technology directly operates on disk sectors, which is extremely likely to cause data damage or loss in the partition with reduced capacity, thus giving users the illusion that it is not easy to expand partitions and retain data. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a disk partition management method, device, equipment and storage medium, which can automatically start the backup operation of data in the unmounted disk partition after receiving a data backup instruction, in order to prevent data loss during the disk partition management process, and automatically execute the disk partition management operation after data backup, improving the security and convenience of disk partition management. The specific solutions are as follows:
[0004] In the first aspect, the present application provides a disk partition management method, including:
[0005] Determine at least one unmounted disk partition in the current operating system;
[0006] If a data backup instruction is received, back up the data in each of the unmounted disk partitions;
[0007] Delete each of the unmounted disk partitions and determine the disk capacity to be allocated based on the disk capacity corresponding to the deleted partition, and create at least one disk partition to be allocated;
[0008] Allocate disk capacity for each of the disk partitions to be allocated based on the disk capacity to be allocated.
[0009] Optionally, the determining at least one unmounted disk partition in the current operating system includes:
[0010] Determine the operating mode of the current operating system, and determine at least one existing disk partition corresponding to the disk partition selection instruction from the current operating system;
[0011] If the operating mode is the safe mode, determine the existing disk partition as the unmounted disk partition;
[0012] If the operating mode is the normal mode, unmount the existing disk partition to obtain the corresponding unmounted disk partition.
[0013] Optionally, after determining at least one unmounted disk partition in the current operating system, it further includes:
[0014] Display a tab on the current display screen for prompting whether to back up data;
[0015] If the data backup instruction is not received within the preset time or a data cancellation backup instruction is received through the tab, directly trigger the step of deleting each of the unmounted disk partitions.
[0016] Optionally, backing up the data in each of the unmounted disk partitions includes:
[0017] Display a storage device external connection prompt message on the current display screen through a pop-up window;
[0018] When an external storage device is recognized, determine the mounting path of the external storage device in response to the current operating system;
[0019] Back up the data in each of the unmounted disk partitions to the external storage device based on the mounting path.
[0020] Optionally, determining the mounting path of the external storage device in response to the current operating system includes:
[0021] Determine the device name of the external storage device through the virtual file management system in the current operating system;
[0022] Trigger the process virtual file system in the current operating system, and based on a preset command for checking disk mounting conditions and the device name, determine the mounting path of the external storage device in response to the current operating system.
[0023] Optionally, allocating disk capacity for each of the to-be-allocated disk partitions based on the to-be-allocated disk capacity includes:
[0024] Determine the disk partition capacity corresponding to each of the to-be-allocated disk partitions from the to-be-allocated disk capacity based on a partition capacity allocation instruction, so as to allocate disk capacity for each of the to-be-allocated disk partitions respectively, and obtain the corresponding allocated disk partitions;
[0025] Determine the last disk partition and other disk partitions from each of the disk partitions after allocation; the last disk partition is the last disk partition among the disk partitions to be allocated for which disk capacity is allocated;
[0026] Use the file system expansion tool to increase the partition capacity of the other disk partitions, and use the file detection and repair tool based on the extended file system to repair the tracks of the last disk partition.
[0027] Optionally, determining the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction includes:
[0028] Determine the first disk partition to be allocated and the corresponding disk partition capacity from the disk partitions to be allocated based on the partition capacity allocation instruction;
[0029] Determine the disk partition capacity corresponding to the second disk partition to be allocated based on the disk capacity to be allocated and the disk partition capacity corresponding to the first disk partition to be allocated;
[0030] Wherein, the disk partitions to be allocated are composed of the first disk partition to be allocated and the second disk partition to be allocated.
[0031] Optionally, determining the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction includes:
[0032] Directly determine the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction.
[0033] Optionally, the method further includes:
[0034] Determine the disk partitions after allocation corresponding to each of the disk partitions to be allocated after disk capacity allocation. If the data in each of the unmounted disk partitions has been backed up, determine the backup data volume corresponding to each of the disk partitions after allocation based on the backup data;
[0035] Determine the target partition capacity corresponding to the target disk partition, and compare the target partition capacity with the target backup data volume corresponding to the target disk partition to obtain a comparison result; wherein, the target disk partition is any one of the disk partitions after allocation;
[0036] If the comparison result indicates that the target backup data volume is greater than the target partition capacity, send a prompt message indicating that the backup data restoration has failed;
[0037] If the comparison result indicates that the target backup data volume is less than or equal to the target partition capacity, restore the backup data corresponding to the target disk partition to the target disk partition.
[0038] In a second aspect, the present application provides a disk partition management device, including:
[0039] A partition determination module, configured to determine at least one unmounted disk partition in the current operating system;
[0040] A data backup module, configured to back up the data in each of the unmounted disk partitions if a data backup instruction is received;
[0041] A partition deletion module, configured to delete each of the unmounted disk partitions, determine the disk capacity to be allocated based on the disk capacity corresponding to the deleted partition, and create at least one disk partition to be allocated;
[0042] A capacity allocation module, configured to allocate disk capacity to each of the disk partitions to be allocated based on the disk capacity to be allocated.
[0043] In a third aspect, the present application provides an electronic device, including:
[0044] A memory, configured to store a computer program;
[0045] A processor, configured to execute the computer program to implement the foregoing disk partition management method.
[0046] In a fourth aspect, the present application provides a computer-readable storage medium, configured to store a computer program, and when the computer program is executed by a processor, implement the foregoing disk partition management method.
[0047] In the embodiments of the present application, at least one unmounted disk partition in the current operating system is determined; if a data backup instruction is received, the data in each unmounted disk partition is backed up; each unmounted disk partition is deleted, and the disk capacity to be allocated is determined based on the disk capacity corresponding to the deleted partition, and at least one disk partition to be allocated is created; the disk capacity is allocated to each disk partition to be allocated based on the disk capacity to be allocated. It can be seen that after receiving the data backup instruction, the backup operation of the data in the unmounted disk partition is automatically started to prevent data loss or damage during the disk partition management process, and there is no need for the user to manually back up the data in advance before preparing for disk partitioning; further, after the data backup is completed, the unmounted disk partition is automatically deleted and the disk capacity allocation operation is automatically performed using the disk capacity to be allocated, so that not only can the data be retained during the disk partition management process, the technical threshold of the operator can be reduced, but also time and labor costs can be saved, the security and convenience of disk partition management can be improved, and the user experience of the operator can be enhanced. Brief Description of the Drawings
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on the provided drawings.
[0049] Figure 1 It is a flowchart of a disk partition management method disclosed in an embodiment of the present application;
[0050] Figure 2 It is a flowchart of disk capacity allocation disclosed in an embodiment of the present application;
[0051] Figure 3 It is a flowchart of backup data restoration disclosed in an embodiment of the present application;
[0052] Figure 4 It is a flowchart of disk partition management disclosed in an embodiment of the present application;
[0053] Figure 5 It is a schematic structural diagram of a disk partition management device disclosed in an embodiment of the present application;
[0054] Figure 6 It is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application. Detailed Embodiments
[0055] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0056] Currently, the partition expansion technology directly operates on disk sectors, which is extremely likely to cause data damage or loss in the partition with reduced capacity, thus giving users the illusion that it is difficult to expand the partition and retain the data. For this reason, the present application provides a disk partition management method. After receiving a data backup instruction, it automatically starts the backup operation of the data in the unmounted disk partition to prevent data loss during the disk partition management process, eliminating the need for users to manually back up the data in advance before preparing to perform disk partition management; and after the data backup is completed, it automatically executes the disk partition management operation, improving the security and convenience of disk partition management.
[0057] See Figure 1As shown in the figure, an embodiment of the present invention discloses a disk partition management method, which can be applied to electronic devices such as ultrasonic devices. The method includes:
[0058] Step S11: Determine at least one unmounted disk partition in the current operating system.
[0059] In this embodiment, the current operating system may include operating systems such as Linux with immature partition expansion technologies; an unmounted disk partition means that the disk partition no longer loads and runs application programs, and other programs are not allowed to be mounted on this disk partition either.
[0060] Considering that in the current disk partition expansion solutions, most only support the partition expansion of non-retained data when the operating system runs in the normal mode, where the normal mode means the operating system runs normally; in specific scenarios, such as when the system freezes or the operating system is extremely stuck due to excessive capacity occupation of a certain partition in the normal mode, if you want to solve this problem through partition capacity expansion, it is almost impossible on a completely frozen machine. Most users can only choose to format the disk and reinstall the operating system to solve this problem, but this will cause all the configurations and data of the running machine to be lost, and it is time-consuming and laborious. Therefore, in order to achieve disk partition expansion even when the operating system freezes or is extremely stuck, the embodiment of this application designs to directly perform partition expansion operations through the operating system image and other means when the operating system runs in the safe mode, so as to realize the management of disk partitions. Taking the operating system of an ultrasonic device as an example, the safe mode is a startup option in which the operating system starts in the diagnostic mode instead of the normal mode. Through the safe mode, the computer can be started without loading third-party device drivers, and the computer runs in the minimum mode of the operating system; specifically, the safe mode is similar to the WinPE (Windows Preinstall Environment) disk of the Windows system, the official installation ISO (Isolation) image of the Linux system, etc.
[0061] In this embodiment, when a user triggers a disk partition management operation on an electronic device such as an ultrasound device, that is, when the electronic device such as an ultrasound device receives a disk partition management instruction, since different operating system running modes correspond to different disk partition management operations, it is necessary to first determine the running mode of the current operating system, and then obtain a disk partition selection instruction. The disk partition selection instruction contains the disk partitions selected by the user for management. Based on the obtained disk partition selection instruction, at least one corresponding existing disk partition can be determined from all the disk partitions of the current operating system; if the running mode of the current operating system is the safe mode, the existing disk partition is directly determined as an unmounted disk partition; if the running mode of the current operating system is the normal mode, the existing disk partition is unmounted to obtain the corresponding unmounted disk partition. It should be noted that the main difference between the safe mode and the normal mode is that in the safe mode, the disk partition can be directly operated without unmounting the disk partition; while in the normal mode, the disk partition needs to be unmounted first, and after the unmounting is completed, the disk partition can be operated. Among them, disk partition unmounting is mainly to end the use of the disk partition by the running processes and prohibit other processes from mounting with the disk partition, but the data in the disk partition is not deleted at this time and is still saved in the disk partition.
[0062] For example, from all the disk partitions (A, B, C) of the current operating system, the existing disk partitions B and C corresponding to the disk partition selection instruction are determined. If the running mode of the current operating system is the safe mode, the existing disk partitions B and C are directly determined as unmounted disk partitions; if the running mode of the current operating system is the normal mode, the existing disk partitions B and C are unmounted respectively to obtain the corresponding unmounted disk partitions.
[0063] Step S12: If a data backup instruction is received, back up the data in each unmounted disk partition.
[0064] In this embodiment, regardless of whether the running mode of the operating system is the safe mode or the normal mode, after the unmounted disk partition is determined, a tab for prompting whether to back up the data will be displayed on the current display screen. If a data backup instruction is received through the tab, the data in each unmounted disk partition will be backed up based on the data backup instruction.
[0065] In a specific implementation manner, a tab for prompting whether to back up the data is displayed on the current display screen through a pop-up window to prompt the user whether to perform a data backup operation on the unmounted disk partition. If the electronic device receives a data backup instruction, the data in each unmounted disk partition can be backed up to the cloud disk or other disks in the operating system that have not been managed for disk partitioning based on the data backup instruction.
[0066] In another specific embodiment, a tab for prompting whether to back up data is displayed in a pop-up window on the current display screen to prompt the user whether to perform a data backup operation for the unmounted disk partition. If the electronic device receives a data backup instruction and recognizes an external storage device, it indicates that the user has inserted an external storage device. At this time, the data in the unmounted disk partition can be backed up using the external storage device. If the electronic device receives a data backup instruction but does not recognize an external storage device, a storage device external connection prompt message is displayed in a pop-up window on the current display screen to prompt the user to insert an external storage device, and when an external storage device is recognized, the data in the unmounted disk partition is backed up using the external storage device.
[0067] In some embodiments, it is also possible to default to backing up the data in each unmounted disk partition, that is, after determining at least one unmounted disk partition in the current operating system, without the need for user operation, it is defaulted to receive a data backup instruction, and then the data in each unmounted disk partition is directly backed up.
[0068] Specifically, for backing up the data in the unmounted disk partition using an external storage device, it is necessary to first automatically determine the mounting path of the external storage device in response to the current operating system, and based on the mounting path, back up the data in each unmounted disk partition to the external storage device. Among them, the external storage device includes, but is not limited to, a USB flash drive (USB flash disk), a portable hard drive, etc.
[0069] Furthermore, for determining the mounting path of the external storage device in response to the current operating system, it is necessary to first determine the device name of the inserted external storage device through the virtual file management system in the current operating system, and then trigger the process virtual file system in the current operating system. Based on a preset command for checking the disk mounting situation and the device name, find the mounting path of the external storage device in response to the current operating system. Among them, the virtual file management system includes the sys file system; the process virtual file system includes the proc file system; the preset command includes the df command, and the df command can not only check the disk space occupancy of the file system, but also view the disk mounting situation.
[0070] Step S13: Delete each unmounted disk partition, determine the disk capacity to be allocated based on the disk capacity corresponding to the deleted partition, and create at least one disk partition to be allocated.
[0071] In this embodiment, the unmounted disk partitions are deleted through a hard disk partitioning tool. After the unmounted disk partitions are deleted, the unmounted disk partitions no longer exist in the current operating system. Then, the disk capacity to be allocated is determined based on the disk capacity corresponding to the deleted partitions, and at least one disk partition to be allocated is created to allocate disk capacity to each newly created disk partition to be allocated based on the disk capacity to be allocated. Optionally, the disk capacity obtained by adding the disk capacities corresponding to the deleted partitions is determined as the disk capacity to be allocated.
[0072] It should be noted that for the partition numbers of the disk partitions to be allocated, they can be the same as or different from the partition numbers of the unmounted disk partitions, which is not limited here; for the number of disk partitions to be allocated, it can be the same as or different from the number of unmounted disk partitions. Among them, the hard disk partitioning tool includes the fdisk tool. For example, the unmounted disk partitions B and C are deleted through the fdisk tool, and the disk capacity to be allocated is determined to be 500G based on the disk capacity of 200G corresponding to the deleted partition B and the disk capacity of 300G corresponding to the deleted partition C.
[0073] It should be noted that after at least one unmounted disk partition in the current operating system is determined, a tab for prompting whether to back up data will be displayed on the current display screen. If a data cancellation backup instruction is received through the tab or no data backup instruction is received within a preset time, that is, the user selects to cancel the backup or the user does not make any selection within a period of time, the data in each unmounted disk partition will not be backed up, and the step of directly triggering the deletion of each unmounted disk partition will be performed to determine the disk capacity to be allocated based on the disk capacity corresponding to the deleted partition, and to allocate disk capacity to each newly created disk partition to be allocated based on the disk capacity to be allocated.
[0074] Step S14: Allocate disk capacity to each disk partition to be allocated based on the disk capacity to be allocated.
[0075] In this embodiment, after the disk capacity to be allocated is determined, it is necessary to perform an operation to allocate disk capacity to each disk partition to be allocated based on the disk capacity to be allocated to obtain the corresponding disk partitions after allocation. Then, it is necessary to perform corresponding operations to increase the partition capacity and repair the tracks for each disk partition after allocation, so as to complete the management of the disk partitions this time.
[0076] Specifically, refer to Figure 2As shown, allocating disk capacities for each disk partition to be allocated based on the disk capacity to be allocated includes: S21. Determining the disk partition capacities corresponding to each disk partition to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction, so as to allocate disk capacities to each disk partition to be allocated respectively, and obtaining the corresponding disk partitions after allocation; S22. Determining the last disk partition and other disk partitions from each disk partition after allocation; wherein, the last disk partition is the disk partition that is the last to have its disk capacity allocated among all the disk partitions to be allocated; S23. Increasing the partition capacity for other disk partitions through the file system expansion tool, and repairing the tracks for the last disk partition through the file detection and repair tool based on the extended file system.
[0077] In a specific implementation manner, for step S21, the partition capacity allocation instruction input by the user is obtained through the partition capacity allocation page. The partition capacity allocation instruction contains the disk partition capacities corresponding to a part of the disk partitions to be allocated. Thus, based on the partition capacity allocation instruction, the corresponding first disk partition to be allocated and the disk partition capacity corresponding to the first disk partition to be allocated are determined from all the disk partitions to be allocated; based on the total disk capacity to be allocated and the disk partition capacity corresponding to the first disk partition to be allocated, the disk partition capacity corresponding to the second disk partition to be allocated can be determined; wherein, the second disk partition to be allocated is another part of the disk partitions to be allocated, that is, the disk partitions to be allocated consist of the first disk partition to be allocated and the second disk partition to be allocated. It should be noted that if the number of partitions of the second disk partition to be allocated is greater than 1, for the determination of the disk partition capacity corresponding to the second disk partition to be allocated, it can be divided by a preset ratio or equally divided, etc., which is not limited herein.
[0078] Specifically, if the number of partitions of the second disk partition to be allocated is 1, the difference between the total disk capacity to be allocated and the disk partition capacity corresponding to the first disk partition to be allocated can be calculated, and this difference is determined as the disk partition capacity corresponding to the second disk partition to be allocated. For example, if the disk capacity to be allocated is 500G, and the disk partitions to be allocated are B and C, based on the partition capacity allocation instruction including allocating 400G of disk partition capacity to the disk partition B to be allocated, the first disk partition to be allocated B and the corresponding disk partition capacity of 400G are determined from the disk partitions B and C to be allocated, and the disk partition capacity corresponding to the second disk partition to be allocated C is automatically determined as 100G based on the difference between the disk capacity to be allocated and the disk partition capacity corresponding to the first disk partition to be allocated.
[0079] In another specific embodiment, for step S21, a partition capacity allocation instruction input by the user is obtained through a partition capacity allocation page. The partition capacity allocation instruction contains the disk partition capacities corresponding to all the disk partitions to be allocated. Thus, based on the partition capacity allocation instruction, the disk partition capacities corresponding to all the disk partitions to be allocated can be directly determined from the total disk capacity to be allocated. For example, if the disk capacity to be allocated is 500G, and the disk partitions to be allocated are B and C, a partition capacity allocation instruction is obtained that includes allocating 400G of disk partition capacity to the disk partition B to be allocated and allocating 100G of disk partition capacity to the disk partition C to be allocated. Then, based on the partition capacity allocation instruction, the disk partition capacities corresponding to the disk partitions B and C to be allocated are directly determined from the disk capacity to be allocated.
[0080] Further, for step S22 and step S23, after performing disk capacity allocation on the corresponding disk partitions to be allocated based on the disk partition capacities corresponding to each disk partition to be allocated to obtain the allocated disk partitions, an expansion file system tool, such as the resizefs tool, is used to perform a partition capacity increase operation on other disk partitions except the last disk partition among the allocated disk partitions to increase or decrease the size of the unmounted "ext2 / ext3 / ext4" file system. At the same time, a file detection and repair tool based on the extended file system, such as the e2fsck tool, is used to perform a track repair operation on the last disk partition among the allocated disk partitions, thereby completing the management of the disk partitions this time. Among them, the last disk partition is the last disk partition among the disk partitions to be allocated that undergoes disk capacity allocation, and the role of track repair is mainly to avoid damaging the original tracks of the disk partition and at the same time avoid damaging the original data in the disk partition. For example, by directly deleting the last two partitions on the disk using the fdisk tool, and determining the disk capacity to be allocated based on the disk capacity corresponding to the deleted partitions, the capacity of the penultimate partition is re-expanded to the expansion size specified by the user based on the disk capacity to be allocated, and the remaining capacity in the disk capacity to be allocated is allocated to the last partition. Then, the resizefs tool is used to perform a partition capacity increase operation on the penultimate partition, and the e2fsck tool is used to perform a track repair operation on the last partition, thereby completing the management operation of the last two partitions on the disk.
[0081] In this embodiment, after performing disk capacity allocation for each disk partition to be allocated based on the disk capacity to be allocated, and performing corresponding partition capacity increase and track repair operations for each allocated disk partition, it is necessary to further determine whether the data in the unmounted disk partitions has been backed up. If it has been backed up, the backup data will be automatically restored to the corresponding allocated disk partitions. It should be noted that when the number of disk partitions to be allocated is the same as the number of unmounted disk partitions, the restoration operation of the backup data can be automatically performed; when the number of disk partitions to be allocated is different from the number of unmounted disk partitions, a prompt message indicating that the backup data cannot be automatically restored due to the change in the number of disk partitions will be sent.
[0082] Specifically, as Figure 3 shown, the automatic restoration of the backup data includes: S31. Determine the allocated disk partitions corresponding to each disk partition to be allocated after disk capacity allocation. If the data in each unmounted disk partition has been backed up, determine the amount of backup data corresponding to each allocated disk partition based on the backup data; S32. Determine the target partition capacity corresponding to the target disk partition, and compare the target partition capacity with the target backup data amount corresponding to the target disk partition to obtain a comparison result; where the target disk partition is any one of the allocated disk partitions;
[0083] S33. If the comparison result indicates that the target backup data amount is greater than the target partition capacity, send a prompt message indicating that the backup data restoration has failed; S34. If the comparison result indicates that the target backup data amount is less than or equal to the target partition capacity, restore the backup data corresponding to the target disk partition to the target disk partition.
[0084] It can be understood that after completing the disk capacity allocation to obtain the allocated disk partitions corresponding to each disk partition to be allocated respectively, it is determined whether to automatically trigger the backup data restoration operation according to whether the data in each unmounted disk partition has been backed up. If the data in the unmounted disk partition has not been backed up, it indicates that the operation of disk partition management has ended here, and there is no need to trigger the backup data restoration operation. At the same time, a relevant interface can be popped up on the current display screen to prompt the user with a prompt message indicating that the disk partition management has ended. If the data in each unmounted disk partition has been backed up and the number of partitions of the disk partitions to be allocated is the same as the number of partitions of the unmounted disk partitions, the backup data restoration operation is automatically triggered, and the backup data volume corresponding to each allocated disk partition is determined based on the backup data. For any one of the allocated disk partitions, denoted as the target disk partition, it is judged whether the backup data volume of the target disk partition is greater than its own disk partition capacity. If the backup data volume of the target disk partition is greater than its own disk partition capacity, it indicates that the backup data volume is too large and it is not easy to restore all of it to the target disk partition. If forced restoration is carried out, it is easy to damage the consistency of the backup data. Therefore, a prompt message indicating that the backup data restoration fails due to the excessive backup data volume will be sent to the user. If the backup data volume of the target disk partition is less than or equal to its own disk partition capacity, the operation of restoring the backup data corresponding to the target disk partition to the target disk partition is automatically executed, and after the backup data restoration is completed, a prompt message indicating that the backup data restoration is completed will be sent to the user.
[0085] As Figure 4 shown, taking the disk partition management of the data partition and the application partition in the operating system as an example, the running mode of the current operating system is determined, and it is judged whether the running mode of the current operating system is the safe mode or the normal mode, so as to execute different partition management processes according to different running modes. If the running mode is the safe mode, the data partition and the application partition determined based on the disk partition selection instruction are directly used as the unmounted data partition and application partition. If the running mode is the normal mode, the data partition and the application partition are unmounted to obtain the corresponding unmounted data partition and application partition.
[0086] Whether in safe mode or normal mode, after determining the unmounted data partition and application partition, a data backup prompt message will be displayed in a pop-up window on the current display screen, and it will be determined whether a data backup instruction is received; if a data backup instruction is received, a storage device external connection prompt message will be displayed in a pop-up window, and when an external storage device is recognized, the data in the unmounted data partition and application partition will be backed up, and the backup data will be stored in the external storage device, and then the unmounted data partition and application partition will be deleted and the disk capacity to be allocated will be determined based on the disk capacity corresponding to the deleted partition. If no data backup instruction is received or a data backup cancellation instruction is received within a preset time period, the unmounted data partition and application partition will be directly deleted and the disk capacity to be allocated will be determined based on the disk capacity corresponding to the deleted partition.
[0087] After determining the disk capacity to be allocated, a data partition to be allocated and an application partition to be allocated with the same partition numbers as the unmounted data partition and application partition are created, and the disk capacity of the data partition to be allocated is reduced and the disk capacity of the application partition to be allocated is expanded based on the disk capacity to be allocated, so as to obtain the allocated data partition and application partition. According to whether the data in the unmounted data partition and application partition has been backed up, it is determined whether to automatically trigger the backup data restoration operation. If the data in the unmounted data partition and application partition has been backed up, the backup data restoration operation is automatically triggered, and when an external storage device is mounted, the amount of backup data corresponding to the allocated data partition and application partition is determined based on the backup data, and it is determined whether the amount of backup data of any disk partition is greater than its own disk partition capacity. If it is greater, a prompt message indicating that the backup data restoration fails due to the excessive amount of backup data is sent; if it is less than or equal to, the backup data restoration operation is automatically executed, and after the backup data restoration is completed, a prompt message indicating that the backup data restoration is completed is sent to the user.
[0088] It can be seen that the disk partition management method provided by the embodiment of the present application determines the running mode of the current operating system, and in the case that the running mode is safe mode, the disk partition management operation can still be executed even if the operating system has problems such as crashing or freezing; moreover, after receiving a data backup instruction, the backup operation of the data in the unmounted disk partition can be automatically started to prevent data loss or damage during the disk partition management process. Further, after the data backup is completed, the unmounted disk partition is automatically deleted and the disk capacity allocation operation is automatically executed using the disk capacity to be allocated, so that not only can data be retained during the disk partition management process, the technical threshold of the operator can be reduced, but also time and labor costs can be saved, the security and convenience of disk partition management can be improved, and the user experience of the operator can be enhanced.
[0089] See Figure 5 As shown, an embodiment of the present invention discloses a disk partition management device, including:
[0090] A partition determination module 11, configured to determine at least one unmounted disk partition in the current operating system;
[0091] A data backup module 12, configured to back up the data in each of the unmounted disk partitions if a data backup instruction is received;
[0092] A partition deletion module 13, configured to delete each of the unmounted disk partitions, determine the disk capacity to be allocated based on the disk capacity corresponding to the deleted partition, and create at least one disk partition to be allocated;
[0093] A capacity allocation module 14, configured to allocate disk capacity to each of the disk partitions to be allocated based on the disk capacity to be allocated.
[0094] It can be seen that the disk partition management device provided by the embodiment of the present application automatically starts the backup operation of the data in the unmounted disk partition after receiving the data backup instruction, in order to prevent data loss and damage during the disk partition management process. Further, after the data backup is completed, the unmounted disk partition is automatically deleted and the disk capacity allocation operation is automatically executed using the disk capacity to be allocated, so that not only can the data be retained during the disk partition management process, the technical threshold of the operator can be reduced, but also time and labor costs can be saved, the security and convenience of disk partition management can be improved, and the user experience of the operator can be enhanced.
[0095] In some specific embodiments, the partition determination module 11 includes:
[0096] An operation mode determination unit, configured to determine the operation mode of the current operating system and determine at least one existing disk partition corresponding to the disk partition selection instruction from the current operating system;
[0097] An unmounted partition determination unit, configured to determine the existing disk partition as the unmounted disk partition if the operation mode is the safe mode;
[0098] A disk partition unloading unit, configured to unload the existing disk partition to obtain the corresponding unmounted disk partition if the operation mode is the normal mode.
[0099] In some specific embodiments, the disk partition management device further includes:
[0100] A tab display unit, configured to display a tab on the current display screen for prompting whether to back up data;
[0101] A step trigger unit, configured to directly trigger the step of deleting each unmounted disk partition if the data backup instruction is not received within a preset time or a data cancellation backup instruction is received through the tab.
[0102] In some specific embodiments, the data backup module 12 includes:
[0103] A prompt message display unit, configured to display a storage device external connection prompt message through a pop-up window on the current display screen;
[0104] A mounting path determination sub-module, configured to determine the mounting path of the external storage device in response to the current operating system when an external storage device is recognized;
[0105] A data backup unit, configured to back up the data in each unmounted disk partition to the external storage device based on the mounting path.
[0106] In some specific embodiments, the mounting path determination sub-module includes:
[0107] A device name determination unit, configured to determine the device name of the external storage device through the virtual file management system in the current operating system;
[0108] A mounting path determination unit, configured to trigger the process virtual file system in the current operating system, and determine the mounting path of the external storage device in response to the current operating system based on a preset command for checking disk mounting conditions and the device name.
[0109] In some specific embodiments, the capacity allocation module 14 includes:
[0110] A disk capacity allocation sub-module, configured to determine the disk partition capacity corresponding to each to-be-allocated disk partition from the to-be-allocated disk capacity based on a partition capacity allocation instruction, so as to perform disk capacity allocation on each to-be-allocated disk partition respectively, and obtain corresponding allocated disk partitions;
[0111] A disk partition determination unit, configured to determine the last disk partition and other disk partitions from each of the allocated disk partitions; the last disk partition is the last disk partition for which disk capacity allocation is performed among all the to-be-allocated disk partitions;
[0112] A track repair unit, configured to increase the partition capacity for the other disk partitions through an extended file system tool, and repair the tracks for the last disk partition through a file detection and repair tool based on the extended file system.
[0113] In some specific embodiments, the disk capacity allocation sub-module includes:
[0114] A first partition determination unit, configured to determine a first disk partition to be allocated and a corresponding disk partition capacity from the disk partitions to be allocated based on the partition capacity allocation instruction;
[0115] A second partition determination unit, configured to determine the disk partition capacity corresponding to the second disk partition to be allocated based on the disk capacity to be allocated and the disk partition capacity corresponding to the first disk partition to be allocated;
[0116] Wherein, the disk partitions to be allocated are composed of the first disk partition to be allocated and the second disk partition to be allocated.
[0117] In some specific embodiments, the disk capacity allocation sub-module includes:
[0118] A partition capacity determination unit, configured to directly determine the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction.
[0119] In some specific embodiments, the disk partition management device further includes:
[0120] A backup amount determination unit, configured to determine the allocated disk partitions corresponding to each of the disk partitions to be allocated after disk capacity allocation. If the data in each of the unmounted disk partitions has been backed up, determine the backup data amount corresponding to each of the allocated disk partitions based on the backup data;
[0121] A comparison result determination unit, configured to determine the target partition capacity corresponding to the target disk partition, and compare the target partition capacity with the target backup data amount corresponding to the target disk partition to obtain a comparison result; wherein, the target disk partition is any one of the allocated disk partitions;
[0122] A prompt message sending unit, configured to send a prompt message indicating that the backup data restoration fails if the comparison result indicates that the target backup data amount is greater than the target partition capacity;
[0123] A backup data restoration unit, configured to restore the backup data corresponding to the target disk partition to the target disk partition if the comparison result indicates that the target backup data amount is less than or equal to the target partition capacity.
[0124] It should be noted that the disk partition management device provided in the embodiments of the present application corresponds to the foregoing embodiments of the disk partition management method, and the specific implementation manners can be referred to each other, and details are not described herein again.
[0125] Further, an embodiment of the present application also discloses an electronic device, Figure 6 which is a structural diagram of an electronic device 20 shown according to an exemplary embodiment. The content in the figure should not be considered as any limitation on the scope of use of the present application.
[0126] Figure 6 This is a schematic structural diagram of an electronic device 20 provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the disk partition management method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0127] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of the present application, and no specific limitation is imposed on it here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application needs, and no specific limitation is made here.
[0128] In addition, the memory 22, as a carrier for resource storage, may be a read-only memory, a random access memory, a disk, or an optical disc, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0129] Among them, the operating system 221 is used to manage and control each hardware device on the electronic device 20 and the computer program 222, and it may be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the disk partition management method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.
[0130] Further, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the disk partition management method disclosed above is implemented. For the specific steps of this method, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.
[0131] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method section.
[0132] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0133] The steps of the methods or algorithms described in combination with the embodiments disclosed in this article can be directly implemented by hardware, software modules executed by a processor, or a combination of both. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.
[0134] Finally, it should also be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
[0135] The technical solutions provided in this application have been introduced in detail above. Specific examples have been used in this article to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A disk partition management method, characterized in that, it includes: Determine at least one unmounted disk partition in the current operating system; If a data backup instruction is received, back up the data in each of the unmounted disk partitions; Delete each of the unmounted disk partitions and determine the disk capacity to be allocated based on the disk capacity corresponding to the deleted partition, and create at least one disk partition to be allocated; Allocate disk capacity to each of the disk partitions to be allocated based on the disk capacity to be allocated.
2. The disk partition management method according to claim 1, characterized in that, The determination of at least one unmounted disk partition in the current operating system includes: Determine the operating mode of the current operating system, and determine at least one existing disk partition corresponding to the disk partition selection instruction from the current operating system; If the operating mode is the safe mode, determine the existing disk partition as the unmounted disk partition; If the operating mode is the normal mode, unmount the existing disk partition to obtain the corresponding unmounted disk partition.
3. The disk partition management method according to claim 1, characterized in that, After determining at least one unmounted disk partition in the current operating system, it further includes: Display a tab on the current display screen for prompting whether to back up data; If the data backup instruction is not received within a preset time or a data cancellation backup instruction is received through the tab, directly trigger the step of deleting each of the unmounted disk partitions.
4. The disk partition management method according to claim 1, characterized in that, The backup of the data in each of the unmounted disk partitions includes: Display storage device external connection prompt information on the current display screen through a pop-up window; When an external storage device is recognized, determine the mounting path of the external storage device in response to the current operating system; Back up the data in each of the unmounted disk partitions to the external storage device based on the mounting path.
5. The disk partition management method according to claim 4, characterized in that, The determination of the mounting path of the external storage device in response to the current operating system includes: Determine the device name of the external storage device through the virtual file management system in the current operating system; Trigger the process virtual file system in the current operating system, and based on a preset command for checking disk mounting and the device name, determine the mounting path of the external storage device in response to the current operating system.
6. The disk partition management method according to claim 1, characterized in that, The allocation of disk capacity to each of the disk partitions to be allocated based on the disk capacity to be allocated includes: Determine the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction, so as to allocate disk capacity to each of the disk partitions to be allocated respectively, and obtain the corresponding disk partition after allocation; Determine the last disk partition and other disk partitions from each of the disk partitions after allocation; the last disk partition is the disk partition for which disk capacity allocation is performed last among all the disk partitions to be allocated. Increase the partition capacity for the other disk partitions through an extended file system tool, and repair the tracks for the last disk partition through a file detection and repair tool based on the extended file system.
7. The disk partition management method according to claim 6, characterized in that the determining of the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction includes: determining a first disk partition to be allocated and the corresponding disk partition capacity from the disk partitions to be allocated based on the partition capacity allocation instruction; determining the disk partition capacity corresponding to a second disk partition to be allocated based on the disk capacity to be allocated and the disk partition capacity corresponding to the first disk partition to be allocated; wherein, the disk partitions to be allocated are composed of the first disk partition to be allocated and the second disk partition to be allocated.
8. The disk partition management method according to claim 6, characterized in that the determining of the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction includes: directly determining the disk partition capacity corresponding to each of the disk partitions to be allocated from the disk capacity to be allocated based on the partition capacity allocation instruction.
9. The disk partition management method according to any one of claims 1 to 8, characterized in that further comprising: determining the disk partitions after allocation corresponding to each of the disk partitions to be allocated after disk capacity allocation, and if the data in each of the unmounted disk partitions has been backed up, determining the amount of backup data corresponding to each of the disk partitions after allocation based on the backup data; determining the target partition capacity corresponding to a target disk partition, and comparing the target partition capacity with the target amount of backup data corresponding to the target disk partition to obtain a comparison result; wherein, the target disk partition is any one of the disk partitions after allocation; if the comparison result indicates that the target amount of backup data is greater than the target partition capacity, sending a prompt message indicating that the backup data restoration has failed; if the comparison result indicates that the target amount of backup data is less than or equal to the target partition capacity, restoring the backup data corresponding to the target disk partition to the target disk partition.
10. A disk partition management device, characterized in that comprising: a partition determination module, configured to determine at least one unmounted disk partition in the current operating system; a data backup module, configured to back up the data in each of the unmounted disk partitions if a data backup instruction is received; a partition deletion module, configured to delete each of the unmounted disk partitions, determine the disk capacity to be allocated based on the disk capacity corresponding to the deleted partition, and create at least one disk partition to be allocated; A capacity allocation module, configured to allocate disk capacity for each of the to-be-allocated disk partitions based on the to-be-allocated disk capacity.
11. An electronic device, characterized in that, it includes: a memory, configured to store a computer program; a processor, configured to execute the computer program to implement the disk partition management method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, it is configured to store a computer program, and when the computer program is executed by a processor, the disk partition management method according to any one of claims 1 to 9 is implemented.