File system detection method and device, equipment and storage medium
By conducting a comprehensive inspection of the file system when the Hongmeng system is started, data loss and system crash caused by the existing system ignoring the root file system problems, achieving a more stable and secure system startup.
Patent Information
- Application Number
- CN202510258800.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-06-24
AI Technical Summary
The existing Hongmeng system only checks application data partitions when the system is started, ignoring potential problems with the root file system, resulting in increased risk of data loss and system crash.
Provide a file system detection method, by obtaining the startup signal of the Hongmeng system, mount the system to initialize the file system and execute the initialization program, obtain file system table information, and perform file system checks. If an irreparable problem is found, the system startup will be interrupted and an error will be displayed.
A comprehensive inspection of the file system is realized, data loss and system crash caused by file system failure is avoided, stability and security of system startup is improved, and system administrators are notified in a timely manner for processing.
Smart Images

Figure CN120196479A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of system detection, and in particular, to a file system detection method, device, equipment and storage medium. Background Art
[0002] The file system is a key module for the operating system to manage the data and software stored on the hard disk. For the HarmonyOS, its root file system is of utmost importance, storing the data and applications necessary for the system to run. With the frequent use of the system and the long-term operation of the hard disk, the file system may experience situations such as bad blocks and illegal allocation blocks. If the system continues to be used when there are problems with the file system, it is very likely to cause serious consequences such as data loss and system crashes. Therefore, detecting the file system before the system starts is crucial for ensuring system stability and data security.
[0003] However, the existing HarmonyOS only checks the application data partition (data partition) when the system starts, completely ignoring the possible problems of the root file system, and unable to predict and prevent in advance, which makes the system run when there are potential hazards in the root file system, increasing the risk of data loss and system crashes. Summary of the Invention
[0004] The present invention provides a file system detection method, device, equipment and storage medium, which interrupts the system startup and displays an error message when an irreparable error is found, preventing losses caused by possible subsequent data loss and system crashes.
[0005] According to an aspect of the present invention, a file system detection method is provided, which includes:
[0006] When a startup signal of the HarmonyOS is obtained, mount the system initialization file system and execute the initialization program;
[0007] Obtain file system table information based on the initialization program, and perform file system checks according to the file system table information to determine the existence of problems;
[0008] When the existence of problems is the existence of irreparable problems, interrupt the system startup and display an error message.
[0009] Optionally, mounting the system initialization file system and executing the initialization program includes: obtaining system compilation instructions, where the system compilation instructions include a check tool and an error message image; controlling a compiler to compile the check tool and the error message image into an image file based on the system compilation instructions; starting the Linux kernel according to the startup signal, and mounting the system initialization file system through the Linux kernel according to the image file; after the initialization file system is successfully mounted, execute the initialization program in the system initialization file system.
[0010] Optionally, obtain file system table information based on the initialization program, including: reading the file system table information at the preset configuration file address based on the initialization program, where the file system table information includes the mount point, device name, and mount parameters of the system partition.
[0011] Optionally, perform a file system check based on the file system table information to determine the existence of problems, including: generating a tool command according to the device name of the system partition; executing the tool command to perform a consistency check on the specified content of the system partition, where the specified content includes the superblock, file index table, data block, and bitmap; determining whether the check result of the consistency check passes. If so, determine that the existence of problems is no problem; otherwise, repair the problems according to the check result to determine the existence of problems.
[0012] Optionally, repair the problems according to the check result to determine the existence of problems, including: repairing the problems according to the check result and determining the repair result; determining whether the repair result is successful. If so, determine that the existence of problems is that the problems are automatically repaired successfully; otherwise, determine that the existence of problems is that there are irreparable problems.
[0013] Optionally, after performing a file system check based on the file system table information to determine the existence of problems, the method further includes: when the existence of problems is no problem or the problems are automatically repaired successfully, use the mount function to mount the system partition according to the file system table information.
[0014] Optionally, interrupt the system startup and perform error display, including: interrupting the system startup and reading the error image to obtain pixel color data; writing the pixel color data to the frame buffer device and sending the pixel color data to the display device through the frame buffer device for error display.
[0015] According to another aspect of the present invention, a file system detection device is provided, and the device includes:
[0016] An initialization program execution module, configured to mount the system initialization file system and execute the initialization program when receiving the startup signal of the HarmonyOS system;
[0017] A file system detection module, configured to obtain file system table information based on the initialization program and perform a file system check based on the file system table information to determine the existence of problems;
[0018] An error display module, configured to interrupt the system startup and perform error display when the existence of problems is that there are irreparable problems.
[0019] According to another aspect of the present invention, an electronic device is provided, and the electronic device includes:
[0020] At least one processor;
[0021] And a memory communicatively connected to the at least one processor;
[0022] Wherein, the memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute a file system detection method according to any embodiment of the present invention.
[0023] According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement a file system detection method according to any embodiment of the present invention when executed.
[0024] The technical solution of the embodiment of the present invention can comprehensively check the file system in a timely manner during the startup phase of the HarmonyOS, avoiding the system from continuing to start when there are serious problems in the file system, preventing serious consequences such as data loss and system crashes caused by file system failures, and improving the stability and security of system startup. When an irreparable problem is detected in the file system, an error message will be displayed, enabling the system administrator to promptly grasp the abnormal situation of the file system and facilitating the quick adoption of corresponding handling measures.
[0025] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.
[0027] Figure 1 is a flowchart of a file system detection method according to Embodiment 1 of the present invention;
[0028] Figure 2 is a flowchart of another file system detection method according to Embodiment 2 of the present invention;
[0029] Figure 3 is a structural schematic diagram of a file system detection device according to Embodiment 3 of the present invention;
[0030] Figure 4Schematic diagram of the structure of an electronic device for implementing a file system detection method according to an embodiment of the present invention. Detailed implementation manners
[0031] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying 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 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 shall fall within the protection scope of the present invention.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0033] Embodiment 1
[0034] Figure 1 A flowchart of a file system detection method is provided for Embodiment 1 of the present invention. This embodiment is applicable to the situation where the HarmonyOS is started. This method can be executed by a file system detection device, which can be implemented in the form of hardware and / or software, and the file system detection device can be configured in a computer controller. As Figure 1 shown, the method includes:
[0035] S110. When a startup signal of the HarmonyOS is obtained, mount the system initialization file system and execute the initialization program.
[0036] Among them, the system initialization file system refers to the Ramdisk system, which is a memory virtual file system and is mainly used as the root file system of Linux.
[0037] Optionally, the mounting system initializes the file system and executes the initialization program, including: obtaining system compilation instructions, where the system compilation instructions include a checking tool and an error message image; controlling a compiler to compile the checking tool and the error message image into an image file based on the system compilation instructions; starting the Linux kernel according to a startup signal, and mounting the system initialization file system by the Linux kernel according to the image file; after the initialization file system is successfully mounted, executing the initialization program in the system initialization file system.
[0038] Among them, the system compilation instructions are a set of detailed commands and parameter sets that can guide the compiler on how to compile and build the system code. The system compilation instructions include a checking tool and an error message image. The checking tool refers to the e2fsck tool, which is a detection tool specifically for file systems of types such as ext2, ext3, and ext4. e2fsck can perform consistency checks on the superblock, file index table, data blocks, bitmap, etc. of the file system, and can detect and attempt to repair problems such as bad blocks and illegally allocated blocks existing in the file system. The error message image is an image used to display prompt information to the user when the file system detects irreparable problems. Usually a bmp - format picture, its size needs to be consistent with the size of the frame buffer device fbdev. The information content of the error message image generally prompts "The file system detection found irreparable exceptions, and the system halts startup" so that users can intuitively understand the current status of the system.
[0039] Specifically, developers can set the system compilation instructions through configuration files, command - line parameters, or scripts, etc. For example, when using the build tool gn, the paths and related parameters of the checking tool and the error message image to be used can be clearly specified in the relevant build configuration file. For the checking tool e2fsck, "ramdisk" can be added to the install_images list in the build gn module of e2fsck. For the error message image, ohos_prebuilt_etc can be used and install_images = ["ramdisk"] can be added. The controller can control the compiler to compile the checking tool and the error message image into the image file according to the obtained system compilation instructions. The compiler will compile, link, and package the code of the checking tool according to the configuration in the system compilation instructions and make it part of the specified image file.
[0040] Further, when the startup signal of the HarmonyOS is received, the entire system startup process begins. First, the open-source bootloader Uboot boots the Linux kernel. The Linux kernel is the core part of the open-source HarmonyOS and is responsible for managing the system's hardware resources, process scheduling, file system, etc. After the Linux kernel starts, it mounts the system initialization file system according to the previously compiled image file. The mounting process associates the file system in the image file with the system's file directory structure, enabling the system to access and operate the files and data in the image file. For example, the Linux kernel identifies the file system type in the Ramdisk image file and mounts it to the specified mount point according to the corresponding rules, usually the root file system mount point.
[0041] Specifically, when the system initialization file system is successfully mounted, the initialization program therein is executed. The initialization program refers to the init program, which is the first user-mode program to run after the system kernel is loaded and is mainly used to initialize the entire system. The init program is responsible for completing system initialization tasks such as loading system drivers, setting system environment variables, and starting system services. At the same time, the init program is also the starting point of the subsequent file system detection process. It checks the file system according to the check tools compiled into the image file before to ensure the integrity and consistency of the file system.
[0042] S120. Obtain file system table information based on the initialization program, and perform a file system check according to the file system table information to determine the existence of problems.
[0043] Optionally, obtaining file system table information based on the initialization program includes: reading the file system table information at the preset configuration file address based on the initialization program, where the file system table information includes the mount point, device name, and mount parameters of the system partition.
[0044] Specifically, the init program reads the file system table information at a specific configuration file address based on the preset rules. In this system, the file corresponding to the preset configuration file address is " / etc / fstab.required". The file system table information includes the mount point, device name, and mount parameters of the system partition. The mount point is the mounting position of the file system in the entire system directory tree. The device name is used to uniquely identify the storage device or partition. The mount parameters are the setting options used when mounting the file system, and the mount parameters determine the mounting method and characteristics of the file system.
[0045] Optionally, perform a file system check based on the file system table information to determine the existence of problems, including: generating a tool command based on the device name of the system partition; executing the tool command to perform a consistency check on the specified content of the system partition, where the specified content includes the superblock, file index table, data blocks, and bitmap; determining whether the check result of the consistency check passes. If so, determine that the problem existence situation is no problem; otherwise, perform problem repair based on the check result to determine the problem existence situation.
[0046] Among them, after obtaining the file system table information through the initialization program, the controller can obtain the device name of the system partition and generate a tool command. The generated tool command format is " / bin / e2fsck -v -y system partition device name". Among them, the "-v" parameter indicates running in verbose mode, which will output detailed check information, facilitating developers and operation and maintenance personnel to understand the specific situation of the check; the "-y" parameter indicates automatically answering "yes" when encountering repair operations that require confirmation, that is, automatically performing repairs.
[0047] Specifically, the initialization program will execute the tool command to perform a consistency check on the specified content of the system partition. The specified content includes the superblock, file index table, data blocks, and bitmap. Among them, the superblock is the core control structure of the file system, recording the basic information of the file system, such as the block size of the file system, the number of inodes, the number of free blocks, and the number of free inodes, etc. By checking the superblock, it can be ensured that the overall structure information of the file system is correct. For example, if the block size information in the superblock is damaged, it may cause the file system to be unable to correctly identify and read data blocks. The file index table contains the metadata information of each file and directory, such as file permissions, owners, creation time, modification time, and pointers to data blocks, etc. Checking the file index table can find whether there are damaged inodes or incorrect file associations. For example, if the inode pointer of a certain file points to a non-existent data block, then the file cannot be accessed correctly. The data blocks are the places where the actual file content is stored. Checking the data blocks can ensure that the data of the files is not damaged or lost. For example, if a certain data block has a bad sector, then the file content stored in that data block may not be read normally. The bitmap is used to record which blocks in the file system are free and which blocks have been used. By checking the bitmap, it can be ensured that the file system's block allocation and release operations are correct. If the bitmap information is incorrect, it may cause the file system to incorrectly allocate blocks that have been used, or fail to correctly release free blocks.
[0048] It can be known that if the inspection results show that no problems are found in all the specified contents, that is, the superblock, file index table, data blocks, and bitmap are all consistent and not damaged, it can be determined that the problem situation is problem-free. At this time, the system can continue to start and run normally, and users can use various functions in the system and access files normally. If the inspection results show that there are problems, then problem repair needs to be carried out according to the specific inspection results.
[0049] Optionally, problem repair is carried out according to the inspection results to determine the problem situation, including: carrying out problem repair according to the inspection results and determining the repair result; judging whether the repair result is successful in repair. If so, it is determined that the problem situation is that the problem is automatically repaired successfully; otherwise, it is determined that the problem situation is that there are irreparable problems.
[0050] It should be noted that the e2fsck tool will try to automatically repair some repairable problems according to the detected problem types, such as repairing damaged inodes, cleaning up invalid file associations, etc. The following gives examples of some common problems and repair methods: Inode damage: Inodes record metadata information of files and directories, such as file permissions, owners, creation time, modification time, and pointers to data blocks. If it is found during the inspection that a certain inode is damaged, e2fsck may try to reallocate a new inode to the file or directory and update the relevant index table and link information. For example, if the inode pointer of a certain file points to an invalid data block, e2fsck will recalculate and set the correct pointer so that the file can be accessed normally. File association error: In the file system, there are specific association relationships between files and directories. If it is found during the inspection that there are file association errors, such as the file list in a certain directory contains non-existent files or duplicate file entries, e2fsck will clean up and repair the file associations to ensure the correct directory structure of the file system.
[0051] Specifically, after completing the problem repair operation, e2fsck will check the system partition again to determine whether the repair is successful. If all the specified contents meet the consistency requirements and no problems are found after the recheck, it can be determined that the repair result is successful in repair. If there are still unresolved problems, then the repair result is a failure in repair.
[0052] Further, if it is determined that the repair result is successful, it can be determined that the problem existence situation is that the problem is automatically repaired successfully. If it is determined that the repair result is a failure, that is, after the attempt to repair by e2fsck, there are still problems that cannot be solved, then it can be determined that the problem existence situation is that there are irreparable problems. At this time, the system may face relatively serious file system damage, and continuing to start the system may cause more serious consequences such as data loss and system crashes.
[0053] S130. When the problem existence situation is that there are irreparable problems, interrupt the system startup and perform an error display.
[0054] Optionally, after performing a file system check based on the file system table information to determine the problem existence situation, the method further includes: when the problem existence situation is no problem or the problem is automatically repaired successfully, use the mount function to mount the system partition according to the file system table information.
[0055] It can be known that if the check result shows no problem, it indicates that all key data structures of the system partition are complete and consistent, and the file system is in a healthy state. Similarly, when a problem is found during the check but it is confirmed that the repair is successful after automatic repair, it also indicates that the system partition has been restored to a state where it can be used normally. When the initialization program is executed, the file system table information has been read from the preset configuration file, including the mount point, device name, and mount parameters of the system partition. When the problem existence situation is no problem or the problem is automatically repaired successfully, the system will call the mount function to complete the mounting operation of the system partition. In the OpenHarmony system, a function call similar to mount() is usually used to implement the mounting function. The mount function operates according to the information in the file system table. For example, the specific system partition device can be located according to the device name, and then the partition can be mounted to the corresponding position in the system directory tree according to the mount point. At the same time, the mounting method and characteristics of the file system will be configured according to the settings of the mount parameters. After successful mounting, the system can access the files and data in the system partition just like accessing local files, and various system services and application programs can also rely on these files and data to run normally, thus ensuring the stable startup and normal use of the entire OpenHarmony system.
[0056] The technical solution of the embodiment of the present invention can comprehensively check the file system in a timely manner during the startup stage of the HarmonyOS system, avoid the system from continuing to start when there are serious problems in the file system, prevent serious consequences such as data loss and system crashes caused by file system failures, and improve the stability and security of system startup. When an irreparable problem is detected in the file system, an error display will be performed, which can enable the system administrator to timely master the abnormal situation of the file system and facilitate quickly taking corresponding handling measures.
[0057] Embodiment 2
[0058] Figure 2 The flowchart of a file system detection method provided by Embodiment 2 of the present invention. In this embodiment, on the basis of the above Embodiment 1, the specific process of interrupting the system startup and performing error display is added. Among them, the specific content of steps S250 - S260 is substantially the same as that of steps S120 - S130 in Embodiment 1, so it will not be elaborated in this embodiment. As Figure 2 shown, the method includes:
[0059] S210. When the startup signal of the HarmonyOS is obtained, mount the system initialization file system and execute the initialization program.
[0060] Optionally, mounting the system initialization file system and executing the initialization program includes: obtaining the system compilation instruction, where the system compilation instruction includes the check tool and the error image; controlling the compiler to compile the check tool and the error image into the image file based on the system compilation instruction; starting the Linux kernel according to the startup signal, and mounting the system initialization file system by the Linux kernel according to the image file; when the initialization file system is successfully mounted, execute the initialization program in the system initialization file system.
[0061] S220. Obtain the file system table information based on the initialization program, and perform a file system check according to the file system table information to determine the problem existence situation.
[0062] Optionally, obtaining the file system table information based on the initialization program includes: reading the file system table information at the preset configuration file address based on the initialization program, where the file system table information includes the mount point, device name, and mount parameters of the system partition.
[0063] Optionally, performing a file system check according to the file system table information to determine the problem existence situation includes: generating a tool command according to the device name of the system partition; executing the tool command to perform a consistency check on the specified content of the system partition, where the specified content includes the superblock, file index table, data block, and bitmap; determining whether the check result of the consistency check passes, if so, determining that the problem existence situation is no problem; otherwise, perform problem repair according to the check result to determine the problem existence situation.
[0064] Optionally, performing problem repair according to the check result to determine the problem existence situation includes: performing problem repair according to the check result and determining the repair result; determining whether the repair result is successful in repair, if so, determining that the problem existence situation is that the problem is automatically repaired successfully; otherwise, determining that the problem existence situation is that there are irreparable problems.
[0065] S230. When the problem existence situation is that there is an irreparable problem, interrupt the system startup and read the error image to obtain pixel color data.
[0066] It should be noted that in the OpenHarmony system, when the file system detects an irreparable problem, to avoid serious consequences such as data loss or system crash that may be caused by system startup, the system startup will be interrupted and an error display operation will be performed.
[0067] Specifically, when the system is running, if the e2fsck tool detects an irreparable problem in the system partition, an instruction to interrupt the system startup will be triggered. Before system compilation, a bmp-format error image has been prepared, with the same size as the frame buffer device fbdev, and the content prompts "The file system detection found an irreparable exception, and the system startup is aborted". This error image has been compiled into the Ramdisk image. After interrupting the system startup, the controller will read this error image from the Ramdisk image. The image is composed of numerous pixel points, and each pixel point has corresponding color data. The reading process is to obtain these pixel color data to prepare for subsequent display.
[0068] S240. Write the pixel color data into the frame buffer device, and send the pixel color data to the display device through the frame buffer device for error display.
[0069] Specifically, the frame buffer device fbdev is a device in the Linux kernel driver file system responsible for processing image display. The written data will be stored in the memory area of the frame buffer device according to a certain format and order. Then, the frame buffer device will send the pixel color data to the display device, such as a display screen. After receiving the data, the display device will display point by point on the screen according to the color information and pixel arrangement in the pixel color data, and finally present an image containing error information, enabling the user to intuitively understand the problems that occur in the system.
[0070] Optionally, after performing a file system check according to the file system table information to determine the problem existence situation, the method further includes: when the problem existence situation is no problem or the problem is automatically repaired successfully, use the mount function to mount the system partition according to the file system table information.
[0071] The technical solution of the embodiment of the present invention can comprehensively check the file system in a timely manner during the startup stage of the Harmony system, avoid the system from continuing to start when there are serious problems in the file system, prevent serious consequences such as data loss and system crash caused by file system failures, and improve the stability and security of system startup. When an irreparable problem in the file system is detected, an error display will be performed, which can enable the system administrator to timely master the abnormal situation of the file system and facilitate quickly taking corresponding handling measures.
[0072] Embodiment III
[0073] Figure 3 The following is a schematic structural diagram of a file system detection device provided in Embodiment III of the present invention. As Figure 3 shown, the device includes: an initialization program execution module 310, configured to mount the system initialization file system and execute the initialization program when a startup signal of the HarmonyOS is obtained;
[0074] a file system detection module 320, configured to obtain file system table information based on the initialization program, and perform a file system check according to the file system table information to determine the existence of problems;
[0075] an error reporting display module 330, configured to interrupt the system startup and perform error reporting display when the existence of problems is that there are irreparable problems.
[0076] Optionally, the initialization program execution module 310 is specifically configured to: obtain system compilation instructions, where the system compilation instructions include a check tool and an error reporting image; control a compiler to compile the check tool and the error reporting image into an image file based on the system compilation instructions; start the Linux kernel according to the startup signal, and mount the system initialization file system by the Linux kernel according to the image file; after the initialization file system is successfully mounted, execute the initialization program in the system initialization file system.
[0077] Optionally, for the file system detection module 320, a file system table information acquisition unit is configured to: read file system table information at a preset configuration file address based on the initialization program, where the file system table information includes mount points, device names, and mount parameters of system partitions.
[0078] Optionally, for the file system detection module 320, a problem existence situation determination unit is configured to: generate a tool command according to the device name of the system partition; execute the tool command to perform a consistency check on specified content of the system partition, where the specified content includes a superblock, a file index table, a data block, and a bitmap; determine whether the check result of the consistency check is passed, and if so, determine that the existence of problems is no problem; otherwise, perform problem repair according to the check result to determine the existence of problems.
[0079] Optionally, the problem existence situation determination unit is specifically configured to: perform problem repair according to the check result and determine the repair result; determine whether the repair result is successful, and if so, determine that the existence of problems is that the problem is automatically repaired successfully; otherwise, determine that the existence of problems is that there are irreparable problems.
[0080] Optionally, the device further includes: a problem-free startup module, configured to, after performing a file system check according to the file system table information to determine the presence of problems, when the problem presence situation is problem-free or the problem is automatically repaired successfully, use the mounting function to mount the system partition according to the file system table information.
[0081] Optionally, the error reporting and display module 330 is specifically configured to: interrupt the system startup and read the error image to obtain pixel color data; write the pixel color data into the frame buffer device, and send the pixel color data to the display device through the frame buffer device for error reporting and display.
[0082] The technical solution of the embodiment of the present invention can comprehensively check the file system in a timely manner during the startup phase of the HarmonyOS system, avoiding the system from continuing to start when there are serious problems in the file system, preventing serious consequences such as data loss and system crashes caused by file system failures, and improving the stability and security of system startup. When an irreparable problem is detected in the file system, error reporting and display will be performed, enabling the system administrator to promptly grasp the abnormal situation of the file system and facilitating the rapid adoption of corresponding handling measures.
[0083] A file system detection device provided by an embodiment of the present invention can execute a file system detection method provided by any embodiment of the present invention, and has function modules and beneficial effects corresponding to the execution of the method.
[0084] Embodiment 4
[0085] Figure 4 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0086] As Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. Among them, the memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0087] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disc, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0088] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a file system detection method.
[0089] In some embodiments, a file system detection method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the file system detection method described above can be executed. Alternatively, in other embodiments, the processor 11 can be configured to execute a file system detection method by any other appropriate means (e.g., by means of firmware).
[0090] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0091] The computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, a special purpose computer, or other programmable data processing device, such that the computer programs, when executed by the processor, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer programs can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.
[0092] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0093] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0094] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
[0095] The computing system can include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0096] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is imposed herein.
[0097] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A file system detection method, characterized in that: include: When the startup signal of the Hongmeng system is obtained, the system initializes the file system and executes the initialization program; Acquiring file system table information based on the initialization program, and performing a file system check according to the file system table information to determine whether a problem exists; When the problem is an unrepairable problem, the system startup is interrupted and an error message is displayed.
2. The method according to claim 1, characterized in that The mounting system initializes the file system and executes the initialization program, including: Obtaining a system compilation instruction, wherein the system compilation instruction includes a checking tool and an error reporting image; Controlling the compiler to compile the inspection tool and the error image into an image file based on the system compilation instruction; Start the Linux kernel according to the startup signal, and mount the system initialization file system according to the image file through the Linux kernel; When the initialization file system is mounted successfully, the initialization program in the system initialization file system is executed.
3. The method according to claim 1, characterized in that The obtaining of file system table information based on the initialization program includes: The file system table information of the preset configuration file address is read based on the initialization program, wherein the file system table information includes the mount point, device name and mount parameters of the system partition.
4. The method according to claim 3, characterized in that The performing a file system check according to the file system table information to determine whether a problem exists includes: Generate a tool command according to the device name of the system partition; Executing the tool command to perform consistency check on the specified content of the system partition, wherein the specified content includes a super block, a file index table, a data block, and a bitmap; Determine whether the consistency check result is passed, and if so, determine that there is no problem; Otherwise, the problem is repaired according to the inspection result to determine whether the problem exists.
5. The method according to claim 4, characterized in that The problem repairing according to the inspection result to determine the existence of the problem includes: Repair the problem according to the inspection result and determine the repair result; Determine whether the repair result is successful, and if so, determine whether the problem exists and the problem is automatically repaired successfully; Otherwise, the problem is determined to be an unrepairable problem.
6. The method according to claim 5, characterized in that After performing a file system check according to the file system table information to determine whether a problem exists, the method further includes: When the problem exists and there is no problem or the problem is automatically repaired successfully, a mount function is used to mount the system partition according to the file system table information.
7. The method according to claim 2, characterized in that The interrupt system starts and displays an error message, including: The interrupt system starts and reads the error image to obtain pixel color data; The pixel color data is written into a frame buffer device, and the pixel color data is sent to a display device through the frame buffer device for error display.
8. A file system detection device, characterized in that: include: The initialization program execution module is used to mount the system initialization file system and execute the initialization program when the startup signal of the Hongmeng system is obtained; A file system detection module, used to obtain file system table information based on the initialization program, and perform a file system check according to the file system table information to determine whether a problem exists; The error display module is used to interrupt the system startup and display an error when the problem exists and cannot be repaired.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method according to any one of claims 1 to 7 when executed.