Method for accurately formatting disk
Through the cooperation of the web interface and front-end server, the precise formatting of second-hand disks is achieved, solving the problems of inaccurate disk formatting and data loss in the existing technology, improving disk management efficiency and system stability, saving time and cost.
Patent Information
- Application Number
- CN202411026140.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-15
AI Technical Summary
The existing technology cannot accurately format the disk, resulting in the failure of creating a new storage pool during the reuse of second-hand disks, and there is a risk of data loss and system instability during the formatting process.
Through the web front-end server and web interface, users can choose disks for accurate formatting. The system will automatically read and parse partition tables, file systems and RAID information to perform accurate formatting operations to avoid full disk formatting and without restarting the server. Automatically detect and uninstall file systems and RAID arrays.
It realizes fast and secure disk formatting and recovery, improves management efficiency, reduces operational risks, simplifies operational processes, and saves time and costs.
Smart Images

Figure CN118963660A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of disk formatting, and in particular to a method for accurately formatting a disk. Background Art
[0002] With the rapid development of information technology and the exponential expansion of data, enterprises and institutions are facing unprecedented data storage challenges. Data is not only the new oil of modern society, but also an indispensable cornerstone for corporate decision-making and business operations. In this context, disks, as the core medium for data storage, have become increasingly important, and the demand has also surged. However, the purchase of new high-performance disks is expensive, which is undoubtedly a heavy financial burden for small and medium-sized enterprises and non-profit organizations with tight capital chains or limited budgets, and may hinder their pace of technology upgrades and business expansion.
[0003] In this context, it is particularly important to explore cost-effective storage solutions, and the reuse of second-hand disks is one of the attractive options. Compared with new disks, second-hand disks are affordable, which can alleviate financial pressure to a certain extent, while promoting resource recycling and complying with the concept of green and low-carbon development. However, in order to put second-hand disks back into service safely and reliably, a series of rigorous preprocessing steps are indispensable, among which formatting is a key link. Formatting is used to clear old data and file systems on the disk and establish a new file system for it. Existing technologies cannot accurately format disks and solve the problem of disk occupancy, resulting in failure to create a new storage pool. Summary of the invention
[0004] The present invention provides a method for accurately formatting a disk, so as to solve the technical problems existing in the above-mentioned prior art.
[0005] To achieve the above object, the present invention provides a method for accurately formatting a disk, the method is used to enable an operating system to reuse a disk to create a storage pool, the operating system is provided with a Web front-end server and a Web interface, the method comprising:
[0006] S1: The operating system displays the disks that are allowed to be formatted on the web interface;
[0007] S2: The user selects the disk that he wants to format on the web interface;
[0008] S3: The Web front-end server transfers the disk selected by the user to the disk formatting program through the http protocol;
[0009] S4: read the disk information and analyze the remaining partition table, file system and RAID information on the disk;
[0010] S5: Determine whether there is a file system and RAID information on the disk. If not, execute step S10. If yes, execute step S6.
[0011] S6: Display the file system type and RAID type on the disk on the Web interface. For each file system type and each RAID type, a human-computer interaction dialog box is presented on the Web interface to ask whether to format accurately. If the user selects no, execute step S12. If the user selects yes, execute step S7.
[0012] S7: Performing a precise formatting operation on the file system type and RAID type selected by the user;
[0013] S8: Check whether the disk has a file system mounted and occupied by a RAID array, if not, execute step S12, if yes, execute step S9;
[0014] S9: Unmount the file system and RAID;
[0015] S10: Create a zfs storage pool;
[0016] S11: Display the zfs storage pool creation result on the web interface;
[0017] S12: End.
[0018] In one embodiment of the present invention, in step S8, the mdadm tool is used to perform a deep scan and determine whether the disk is occupied by a RAID array, and the mount command is used to check the current mounting status of the disk.
[0019] The method for accurately formatting a disk provided by the present invention can quickly format and restore a second-hand disk, and during the formatting process, there is no need to format the entire disk or restart the server. The method can automatically check for unloading and occupation, thereby avoiding the impact of restarting the machine on other businesses. Accurate formatting not only saves time, but also saves manpower and electricity costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 The figure is a flow chart of a method for precisely formatting a disk according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] The method for accurately formatting a disk provided by the present invention is an efficient and user-friendly disk information management and initialization method, which aims to optimize the efficiency and security issues in the traditional disk processing process. This method can not only accurately identify and extract key information of the disk, such as the file system type, RAID configuration details, and partition table structure, but also achieve data overwriting of specific areas through highly targeted write operations, thereby replacing full disk formatting, greatly shortening the disk preparation time and reducing the risk of data misoperation. In summary, the method for accurately formatting a disk provided by the present invention achieves the following purposes:
[0024] (1) Improve management efficiency: Through the automated processing of the back-end system, the residual file system and RAID information on the disk can be accurately formatted, thus avoiding the time consumption caused by traditional full disk formatting and greatly improving the efficiency of disk management.
[0025] (2) Reduce operational risks: The system can automatically detect the disk occupancy status. If a file system is mounted or RAID is loaded, it will automatically unmount and delete the disk, effectively avoiding the risk of data loss or service interruption due to misoperation.
[0026] (3) Simplified operation process: The remote interface designed with B / S architecture not only simplifies the interaction process between users and the system, but also makes the operation more intuitive and easy to understand. Both technical experts and ordinary users can easily get started and realize remote management of disks.
[0027] like Figure 1 The flowchart of a method for accurately formatting a disk according to an embodiment of the present invention is shown. The present invention provides a method for accurately formatting a disk, the method is used to enable an operating system to reuse a disk to create a storage pool, the operating system is provided with a Web front-end server and a Web interface, the method comprising:
[0028] S1: The operating system displays the disks that are allowed to be formatted on the web interface;
[0029] S2: The user selects the disk that he wants to format on the web interface;
[0030] S3: The Web front-end server transfers the disk selected by the user to the disk formatting program through the http protocol;
[0031] S4: read the disk information and analyze the remaining partition table, file system and RAID information on the disk;
[0032] S5: Determine whether there is a file system and RAID information on the disk. If not, execute step S10. If yes, execute step S6.
[0033] S6: Display the file system type and RAID type on the disk on the Web interface. For each file system type and each RAID type, a human-computer interaction dialog box is presented on the Web interface to ask whether to format accurately. If the user selects no, execute step S12. If the user selects yes, execute step S7.
[0034] S7: Performing a precise formatting operation on the file system type and RAID type selected by the user;
[0035] S8: Check whether the disk has a file system mounted and occupied by a RAID array, if not, execute step S12, if yes, execute step S9;
[0036] S9: Unmount the file system and RAID;
[0037] S10: Create a zfs storage pool;
[0038] S11: Display the zfs storage pool creation result on the web interface;
[0039] S12: End.
[0040] In one embodiment of the present invention, in step S8, the mdadm tool is used to perform a deep scan and determine whether the disk is occupied by the RAID array, and the mount command is used to check the current mount status of the disk. Then, step S9 is executed to uninstall the file system and RAID operations, effectively avoiding scenarios that may cause system instability or require restart. This series of automated detection and processing steps significantly improves the continuity of operation and the stability of the system.
[0041] In the process of building a storage pool for the zfs file system, the present invention also emphasizes flexibility and selectivity. Users can intuitively view detailed information of the disk to be processed through the front-end Web interface, including historical data traces that may remain on the disk. This transparent information display enables users to selectively decide which disks to clean and format and which to retain according to actual needs, giving users higher autonomy and control.
[0042] The method for accurately formatting a disk provided by the present invention can quickly format and restore a second-hand disk, and during the formatting process, there is no need to format the entire disk or restart the server. The method can automatically check for unloading and occupation, thereby avoiding the impact of restarting the machine on other businesses. Accurate formatting not only saves time, but also saves manpower and electricity costs.
[0043] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.
[0044] Those skilled in the art can understand that the modules in the device in the embodiment can be distributed in the device in the embodiment according to the description of the embodiment, or can be changed accordingly and located in one or more devices different from the embodiment. The modules in the above embodiment can be combined into one module, or can be further divided into multiple sub-modules.
[0045] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for accurately formatting a disk, characterized in that: The method is used to enable an operating system to reuse a disk to create a storage pool. The operating system is provided with a Web front-end server and a Web interface. The method includes: S1: The operating system displays the disks that are allowed to be formatted on the web interface; S2: The user selects the disk that he wants to format on the web interface; S3: The Web front-end server transfers the disk selected by the user to the disk formatting program through the http protocol; S4: read the disk information and analyze the remaining partition table, file system and RAID information on the disk; S5: Determine whether there is a file system and RAID information on the disk. If not, execute step S10. If yes, execute step S6. S6: Display the file system type and RAID type on the disk on the Web interface. For each file system type and each RAID type, a human-computer interaction dialog box is presented on the Web interface to ask whether to format accurately. If the user selects no, execute step S12. If the user selects yes, execute step S7. S7: Performing a precise formatting operation on the file system type and RAID type selected by the user; S8: Check whether the disk has a file system mounted and occupied by a RAID array, if not, execute step S12, if yes, execute step S9; S9: Unmount the file system and RAID; S10: Create a zfs storage pool; S11: Display the zfs storage pool creation result on the web interface; S12: End.
2. The method for accurately formatting a disk according to claim 1, characterized in that: In step S8, the mdadm tool is used to perform a deep scan and determine whether the disk is occupied by a RAID array, and the mount command is used to check the current mount status of the disk.
