CN111475107A - Method and device for formatting hard disk and storage medium - Google Patents

Method and device for formatting hard disk and storage medium Download PDF

Info

Publication number
CN111475107A
CN111475107A CN202010177744.6A CN202010177744A CN111475107A CN 111475107 A CN111475107 A CN 111475107A CN 202010177744 A CN202010177744 A CN 202010177744A CN 111475107 A CN111475107 A CN 111475107A
Authority
CN
China
Prior art keywords
hard disk
formatting
module
image file
mounting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010177744.6A
Other languages
Chinese (zh)
Inventor
张燕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010177744.6A priority Critical patent/CN111475107A/en
Publication of CN111475107A publication Critical patent/CN111475107A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0632Configuration or reconfiguration of storage systems by initialisation or re-initialisation of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device

Abstract

The invention relates to a method, a device and a storage medium for formatting a hard disk, wherein the method comprises the following steps: s1: mounting a system mirror image file; s2: starting a rescue mode; s3: detecting the number of hard disks; s4: a step of formatting the hard disk; s5: and querying hard disk information.

Description

Method and device for formatting hard disk and storage medium
Technical Field
The invention belongs to the technical field of hard disk formatting, and particularly relates to a method and a device for formatting a hard disk and a storage medium.
Background
With the continuous development of network applications, the data storage requirements of the server are higher and higher. As is well known, hard disks are the most prominent storage devices of computers. In the process of testing the server, due to the shortage of components, the same hard disk can be used by a plurality of project groups for alternate testing, and a large amount of data information can be stored in the used hard disk, so that the hard disk cannot be directly used. And the information remaining in the hard disk may affect the accuracy of the test data. Hard disk formatting is therefore an important step before new tests are performed.
The traditional method for formatting the hard disk is to format the hard disk under an operating system and delete information such as raid in the hard disk, but when there is no operating system environment, the operating system needs to be reinstalled and then the hard disk formatting operation is performed. The time spent for installing the operating system is relatively long, and when only one hard disk is available, the method for installing the operating system and reformatting the hard disk cannot be realized. This is a drawback in the prior art.
In view of the above, it is necessary to provide a method and an apparatus for formatting a hard disk, and a storage medium to solve the above-mentioned drawbacks in the prior art.
Disclosure of Invention
In view of the above-mentioned deficiencies of the prior art, the present invention provides a method, an apparatus and a storage medium for formatting a hard disk, so as to solve the above-mentioned technical problems.
In order to achieve the purpose, the invention provides the following technical scheme:
in a first aspect, the present invention provides a method for formatting a hard disk, comprising the steps of:
s1: the step of mounting the system image file specifically comprises the following steps:
mounting the L inux system image file to a server system through a BMC, a U disk or an optical disk, and decompressing and installing the image file;
s2: the method comprises the following steps of starting a rescue mode:
entering a rescue mode according to a linux starting process, and mounting a root directory into the root directory of the hard disk system by executing a command, namely, chroma/mnt/sysimage;
s3: the hard disk quantity detection method specifically comprises the following steps:
executing an lsblk command to check the number of the mounted hard disks in the rescue mode;
s4: the step of formatting the hard disk specifically includes:
formatting the hard disk to a corresponding file system, and storing the log information of the formatted hard disk; checking the log information and determining whether the formatting of the hard disk is successful;
s5: the hard disk information query step specifically includes:
and checking the hard disk information and confirming whether the hard disk is in a normal state.
In a second aspect, the present invention provides a hard disk formatting apparatus, comprising:
a system image file module is mounted, wherein,
mounting the L inux system image file to a server system through a BMC, a U disk or an optical disk, and decompressing and installing the image file;
a rescue mode module is started, in which,
entering a rescue mode according to a linux starting process, and mounting a root directory into the root directory of the hard disk system by executing a command, namely, chroma/mnt/sysimage;
a module for detecting the number of hard disks, wherein,
executing an lsblk command to check the number of the mounted hard disks in the rescue mode;
a formatting module is executed on the hard disk, in which module,
formatting the hard disk to a corresponding file system, and storing the log information of the formatted hard disk; checking the log information and determining whether the formatting of the hard disk is successful;
a query module of hard disk information, in which,
and checking the hard disk information and confirming whether the hard disk is in a normal state.
In a third aspect, there is provided a computer storage medium having stored therein instructions that, when run on a computer, cause the computer to perform the method of the first aspect described above.
The method has the advantages that the hard disk can be formatted by the script without installing an operating system, so that the time and unnecessary operation are saved, and the formatting of the hard disk is conveniently realized.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a flow chart of a method of the present invention for providing hard disk formatting.
Fig. 2 is a schematic block diagram of a hard disk formatting apparatus according to the present invention.
The system comprises a system image file mounting module, a system image file starting module, a hard disk number detecting module, a hard disk execution formatting module and a hard disk information inquiring module, wherein the system image file mounting module is mounted, the system image file starting module is 2, the hard disk number detecting module is 3, the hard disk execution formatting module is 4, and the hard disk information.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1:
as shown in fig. 1, the method for formatting a hard disk according to this embodiment includes the following steps:
s1: the step of mounting the system image file specifically comprises the following steps:
mounting the L inux system image file to a server system through a BMC, a U disk or an optical disk, and decompressing and installing the image file;
s2: the method comprises the following steps of starting a rescue mode:
entering a rescue mode according to a linux starting process, and mounting a root directory into the root directory of the hard disk system by executing a command, namely, chroma/mnt/sysimage;
s3: the hard disk quantity detection method specifically comprises the following steps:
executing an lsblk command to check the number of the mounted hard disks in the rescue mode;
s4: the step of formatting the hard disk specifically includes:
formatting the hard disk to a corresponding file system, and storing the log information of the formatted hard disk; checking the log information and determining whether the formatting of the hard disk is successful;
s5: the hard disk information query step specifically includes:
and checking the hard disk information and confirming whether the hard disk is in a normal state.
Example 2:
as shown in fig. 2, the present embodiment provides a hard disk formatting apparatus, including:
a system image file module 1 is mounted, wherein,
mounting the L inux system image file to a server system through a BMC, a U disk or an optical disk, and decompressing and installing the image file;
the rescue mode module 2 is activated, in which,
entering a rescue mode according to a linux starting process, and mounting a root directory into the root directory of the hard disk system by executing a command, namely, chroma/mnt/sysimage;
a module 3 for detecting the number of hard disks, in which module,
executing an lsblk command to check the number of the mounted hard disks in the rescue mode;
a formatting module 4 is executed for the hard disk, in which module,
formatting the hard disk to a corresponding file system, and storing the log information of the formatted hard disk; checking the log information and determining whether the formatting of the hard disk is successful;
a query module 5 for hard disk information, in which module,
and checking the hard disk information and confirming whether the hard disk is in a normal state.
Example 3:
the present embodiment provides a computer storage medium having stored therein instructions that, when run on a computer, cause the computer to perform the method of embodiment 1 described above.
Although the present invention has been described in detail by referring to the drawings in connection with the preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made on the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and these modifications or substitutions are within the scope of the present invention/any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A method of formatting a hard disk, comprising the steps of:
s1: mounting a system mirror image file;
s2: starting a rescue mode;
s3: detecting the number of hard disks;
s4: a step of formatting the hard disk;
s5: and querying hard disk information.
2. The method of claim 1, wherein the step S1 specifically includes:
and mounting the L inux system image file to a server system through a BMC (baseboard management controller), a U disk or an optical disk, and decompressing and installing the image file.
3. The method of claim 2, wherein the step S2 specifically includes:
entering a rescue mode according to a linux starting process, and mounting the root directory into the root directory of the hard disk system by executing a command, namely, chroma/mnt/sysimage.
4. The method of claim 3, wherein the step S3 specifically includes:
and executing the lsblk command to check the number of the mounted hard disks in the rescue mode.
5. The method of claim 4, wherein the step S4 specifically includes:
formatting the hard disk to a corresponding file system, and storing the log information of the formatted hard disk; and checking the log information to determine whether the hard disk formatting is successful.
6. The method of claim 5, wherein the step S5 specifically includes:
and checking the hard disk information and confirming whether the hard disk is in a normal state.
7. A hard disk formatting apparatus, comprising:
a system image file module is mounted, wherein,
mounting the L inux system image file to a server system through a BMC, a U disk or an optical disk, and decompressing and installing the image file;
a rescue mode module is started, in which,
entering a rescue mode according to a linux starting process, and mounting a root directory into the root directory of the hard disk system by executing a command, namely, chroma/mnt/sysimage;
a module for detecting the number of hard disks, wherein,
executing an lsblk command to check the number of the mounted hard disks in the rescue mode;
a formatting module is executed on the hard disk, in which module,
formatting the hard disk to a corresponding file system, and storing the log information of the formatted hard disk; checking the log information and determining whether the formatting of the hard disk is successful;
a query module of hard disk information, in which,
and checking the hard disk information and confirming whether the hard disk is in a normal state.
8. A computer storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1-6.
CN202010177744.6A 2020-03-13 2020-03-13 Method and device for formatting hard disk and storage medium Pending CN111475107A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010177744.6A CN111475107A (en) 2020-03-13 2020-03-13 Method and device for formatting hard disk and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010177744.6A CN111475107A (en) 2020-03-13 2020-03-13 Method and device for formatting hard disk and storage medium

Publications (1)

Publication Number Publication Date
CN111475107A true CN111475107A (en) 2020-07-31

Family

ID=71748276

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010177744.6A Pending CN111475107A (en) 2020-03-13 2020-03-13 Method and device for formatting hard disk and storage medium

Country Status (1)

Country Link
CN (1) CN111475107A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076064A (en) * 2021-04-01 2021-07-06 浪潮电子信息产业股份有限公司 Device for formatting server hard disk, server and server system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105843852A (en) * 2016-03-16 2016-08-10 汉柏科技有限公司 Log storage management method and system
CN106126223A (en) * 2016-06-22 2016-11-16 浪潮电子信息产业股份有限公司 Automatically the method setting up Raid card array based on K UX rescue mode
CN109271284A (en) * 2018-09-26 2019-01-25 郑州云海信息技术有限公司 A kind of fault recovery method, device and the equipment of server boot subregion

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105843852A (en) * 2016-03-16 2016-08-10 汉柏科技有限公司 Log storage management method and system
CN106126223A (en) * 2016-06-22 2016-11-16 浪潮电子信息产业股份有限公司 Automatically the method setting up Raid card array based on K UX rescue mode
CN109271284A (en) * 2018-09-26 2019-01-25 郑州云海信息技术有限公司 A kind of fault recovery method, device and the equipment of server boot subregion

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076064A (en) * 2021-04-01 2021-07-06 浪潮电子信息产业股份有限公司 Device for formatting server hard disk, server and server system
CN113076064B (en) * 2021-04-01 2023-08-25 浪潮电子信息产业股份有限公司 Device for formatting server hard disk, server and server system

Similar Documents

Publication Publication Date Title
CN107506451B (en) Abnormal information monitoring method and device for data interaction
CN110992992A (en) Hard disk test method, device and storage medium
CN110825569B (en) Hard disk stability test method and test system
CN111522703A (en) Method, apparatus and computer program product for monitoring access requests
CN110266544B (en) Device and method for positioning reason of cloud platform micro-service failure
CN108874441B (en) Board card configuration method, device, server and storage medium
CN113448938A (en) Data processing method and device, electronic equipment and storage medium
CN107590017B (en) Detection method and device for electronic equipment
CN111694684B (en) Abnormal construction method and device of storage device, electronic device and storage medium
CN113590405A (en) Hard disk error detection method and device, storage medium and electronic device
CN111475107A (en) Method and device for formatting hard disk and storage medium
CN111475351A (en) Method and device for testing IOPS (input/output protection system) consistency of solid state disk and storage medium
CN115712559A (en) Method and device for testing hardware management software and electronic equipment
CN115480970A (en) Performance test method, device, equipment and storage medium
CN115757099A (en) Automatic test method and device for platform firmware protection recovery function
CN115658404A (en) Test method and system
CN115237641A (en) Fault detection method and device, electronic equipment and readable medium
CN114637685A (en) Performance test method, device, equipment and medium of application program in bank system
CN114138600A (en) Storage method, device, equipment and storage medium for firmware key information
CN109358972B (en) Log management method and device of middleware client and computer system
CN113867810A (en) Method, device, terminal and storage medium for checking server hard disk topology
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN111209146A (en) RAID card aging test method and system
CN109165126A (en) The method that RAID card links rate with hard disk is tested automatically under a kind of linux system
CN111290920B (en) System, method and storage medium for testing CPU temperature based on PECI bus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200731