Operating system control method, electronic device and storage medium
By detecting and selecting reliable storage devices in the operating system kernel, and creating and synchronizing data partitions, the problem of operating system suspension and data loss caused by storage device failures is solved, improving the reliability and user experience of the operating system.
Patent Information
- Application Number
- PCT/CN2023/143714
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-27
- Filing Date
- 2023-12-30
- Publication Date
- 2024-09-06
AI Technical Summary
During the use of the operating system, when the storage device fails or goes offline, the operating system cannot run normally, resulting in data loss and affecting the user experience.
Detect multiple storage devices through the operating system kernel, select a second storage device with better reliability and read and write performance than the failed device, create a second system partition, copy and synchronize data to ensure normal operation and protection when a failure occurs data.
It improves the operating reliability of the operating system and the storage reliability of data, reduces the risk of operating system suspension and data loss caused by storage device failure, and improves user experience.
Smart Images

Figure CN2023143714_06092024_PF_FP
Abstract
Description
Operating system control method, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This disclosure is based on Chinese patent application No. 202310217665.7, filed on February 27, 2023, entitled “Control method of operating system, electronic device and storage medium”, and claims the priority of the patent application, and all the contents disclosed therein are incorporated into this disclosure by reference. Technical Field
[0003] The present disclosure relates to the technical field of operating systems, and in particular to an operating system control method, electronic device, and storage medium. Background Art
[0004] Currently, during the use of an operating system, if the storage device storing the data corresponding to the operating system fails or goes offline, the operating system may not be able to operate normally due to the inability to perform read / write operations on the storage device. Moreover, since the operating system cannot operate normally, the business running on the operating system may be terminated, resulting in the loss of user data and affecting the user's experience of using the operating system.
[0005] Summary of the Invention
[0006] The main purpose of the present disclosure is to provide an operating system control method, electronic device and storage medium, aiming to improve the operating reliability of the operating system and the storage reliability of data, thereby improving the user experience of the operating system.
[0007] In a first aspect, an embodiment of the present disclosure provides a method for controlling an operating system, the method comprising:
[0008] When the kernel of the operating system detects a first system partition of the first storage device, determining a second storage device, the first system partition stores data corresponding to the operating system, and the second storage device is different from the first storage device;
[0009] Creating a second system partition on the second storage device;
[0010] Copying data corresponding to the operating system stored in the first system partition to the second system partition of the second storage device;
[0011] running the operating system based on the data corresponding to the operating system in the second system partition;
[0012] When the operating system is running, changes in the data corresponding to the operating system in the second system partition are synchronized to the data corresponding to the operating system in the first system partition.
[0013] In a second aspect, an embodiment of the present disclosure further provides an electronic device, comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of any operating system control method provided in the present disclosure specification are implemented.
[0014] In a third aspect, an embodiment of the present disclosure further provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any operating system control method provided in the present disclosure specification. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0016] FIG1 is a flow chart of a method for controlling an operating system according to an embodiment of the present disclosure;
[0017] FIG2 is a schematic block diagram of a method for controlling an operating system according to an embodiment of the present disclosure;
[0018] FIG3 is a schematic block diagram of the structure of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present disclosure in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0020] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined, or partially merged, so the actual execution order may vary depending on the actual situation.
[0021] It should be understood that the terms used in this disclosure are only for the purpose of describing particular embodiments and are not intended to limit the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0022] The embodiments of the present disclosure provide a method for controlling an operating system, an electronic device, and a storage medium. The method for controlling an operating system can be applied to electronic devices, such as mobile phones, tablet computers, laptop computers, desktop computers, personal digital assistants, and wearable devices. The method can also be applied to a server, which can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0023] The following embodiments of the present disclosure are described in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.
[0024] Please refer to FIG1 , which is a flow chart of a method for controlling an operating system provided by an embodiment of the present disclosure.
[0025] As shown in FIG1 , the control method of the operating system includes steps S101 to S105 .
[0026] Step S101: When the kernel of the operating system detects a first system partition of a first storage device, a second storage device is determined, the first system partition stores data corresponding to the operating system, and the second storage device is different from the first storage device.
[0027] Exemplary operating systems include, but are not limited to, batch operating systems, time-sharing operating systems, real-time operating systems, network operating systems, distributed operating systems, and personal computer operating systems. Exemplary devices hosting an operating system include virtual machines and physical machines, but are not limited to these.
[0028] For example, as shown in Figure 2, when the device hosting the operating system is powered on, it enters the operating system preparation phase. During the operating system preparation phase, preparations are made for subsequent operating system operation. Operating system operation relies on data associated with the operating system, which includes, but is not limited to, binary programs, configuration files, and logs.
[0029] In some implementations, during the operating system preparation phase, data corresponding to the operating system is pre-stored in, for example, a first system partition of a first storage device.
[0030] For example, the device where the operating system resides may include multiple preset storage devices. These multiple preset storage devices may be factory-configured storage devices or user-configured storage devices, without limitation. Examples of preset storage device types include, but are not limited to, at least one of the following: a disk, a disk array, a solid-state drive, and a memory drive. The performance of the multiple preset storage devices, such as reliability and read / write performance, may vary. For example, a memory drive may have greater reliability and read / write performance than a disk and a disk array.
[0031] During the operating system preparation phase, for example, when the operating system kernel detects the first system partition of the first storage device, a second storage device is determined. The second storage device is different from the first storage device, which facilitates determining a suitable storage device, namely the second storage device, from multiple preset storage devices included in the device where the operating system resides for subsequent operation of the operating system. In an exemplary embodiment, using the Linux operating system as an example, during the operating system preparation phase, for example, during the pre-pivot phase of initramfs, a set of dracut scripts can be inserted as hooks into the pre-pivot script. By running the hook scripts, the second storage device is determined when the operating system kernel detects the first system partition of the first storage device. This is of course not limited to this and is not intended to be limiting herein.
[0032] For example, if the second storage device is not determined during the operating system preparation stage, then during the subsequent operating system operation stage, if the performance of the first storage device is poor, and at least one of the reliability and read-write performance of the first storage device is poor, the operation of the operating system is prone to errors, and in the case of errors in the operation of the operating system, data loss is also likely to occur; and during the operating system operation stage, if the storage device running the operating system is switched, for example, the storage device running the operating system is switched from the first storage device to the second storage device, the root partition corresponding to the operating system needs to be switched. In the process of switching the root partition corresponding to the operating system, data loss is likely to occur because the operating system cannot run normally, which is not conducive to improving the operating reliability of the operating system, is not conducive to improving the storage reliability of data, and is not conducive to improving the user experience of the operating system.
[0033] Therefore, by determining the second storage device during the operating system preparation stage, it is helpful to prevent the operating system from failing to operate normally or data from being lost due to storage device failure or offline during the subsequent operating system operation stage. For example, it is helpful to reduce the risk of storage device failure or offline during the operating system operation stage, thereby improving the operating reliability of the operating system, improving the storage reliability of data, and improving the user experience of the operating system.
[0034] In some embodiments, a preset storage device that meets preset conditions is selected as the second storage device from preset storage devices other than the first storage device; wherein the preset conditions include at least one of the following: reliability is better than the first storage device, and read and write performance is better than the first storage device.
[0035] For example, during the operating system preparation phase, the performance of each preset storage device included in the device where the operating system resides is obtained, such as at least one of the reliability and read / write performance of the preset storage device. By comparing the performance of the first storage device with the performance of preset storage devices other than the first storage device, a preset storage device other than the first storage device that meets at least one of the requirements of having greater reliability and greater read / write performance than the first storage device is selected as the second storage device for subsequent operation of the operating system.
[0036] For example, if there are multiple preset storage devices that meet the preset conditions among the preset storage devices other than the first storage device, then the preset storage device that meets the second preset condition is determined as the second storage device from the preset storage devices that meet the preset conditions, and the second preset condition includes at least one of the following: best reliability and best read and write performance.
[0037] For example, the operating status of the operating system is related to the performance of the second storage device used to run the operating system. For example, the better the reliability of the second storage device, or the better the read and write performance of the second storage device, the lower the possibility of the second storage device failing or going offline, the better the operating system's operating reliability, the better the data storage reliability, and thus the better the user experience of the operating system.
[0038] By determining the second storage device based on the performance of the preset storage device, it is beneficial to select a preset storage device with good reliability or good read-write performance as the second storage device from multiple preset storage devices included in the device where the operating system is located, while improving the convenience of determining the second storage device. At the same time, the good reliability or good read-write performance of the second storage device reduces the possibility of the second storage device failing or going offline, which is beneficial to reducing the risk of the operating system being unable to operate during the subsequent operating system operation stage, and is beneficial to improving the operating reliability of the operating system during the subsequent operating system operation stage and the storage reliability of data, thereby helping to enhance the user experience of the operating system.
[0039] Step S102: Create a second system partition on the second storage device.
[0040] Illustratively, the second storage device has a certain storage capacity.
[0041] For example, during the operating system operation phase, when a user is running the operating system, the user can, for example, partition the storage capacity of the second storage device based on their usage needs to determine multiple system partitions on the second storage device. However, partitioning the second storage device during the operating system operation phase can easily lead to the loss of data corresponding to the operating system stored on the second storage device, thereby adversely affecting the reliability of the operating system.
[0042] During the operating system preparation phase, after determining the second storage device, a second system partition needs to be created on the second storage device. The second system partition is used to store data corresponding to the operating system. In an exemplary embodiment, using the Linux operating system as an example, the second system partition can be created on the second storage device using the brd tool via a hook script; this is not intended to be limiting and is not intended to be construed herein.
[0043] By creating a second system partition on the second storage device, if the user needs to divide the storage capacity of the second storage device during the subsequent operation of the operating system, based on the setting of the second system partition, the user can choose to divide the storage capacity of the second storage device other than the second system partition to determine the system partition other than the second system partition in the second storage device, which is conducive to improving the convenience of dividing the storage capacity of the second storage device while reducing the risk of losing data corresponding to the operating system stored in the second storage device, thereby helping to reduce the storage reliability, thereby improving the operation reliability of the operating system, improving the storage reliability of data, and enhancing the user experience of the operating system.
[0044] In some embodiments, a second system partition having the same storage capacity as the first system partition is created in the second storage device. In one exemplary embodiment, using the Linux operating system as an example, a hook script can be used to utilize the brd tool to create a second system partition having the same storage capacity as the first system partition in the second storage device; this is not limiting and is not intended to be limiting herein.
[0045] For example, when creating the second system partition, the storage capacity of the second system partition needs to be determined. The storage capacity of the second system partition needs to meet the storage requirements of the data corresponding to the operating system and the requirements of the subsequent operation of the operating system.
[0046] Exemplarily, based on the fact that data corresponding to the operating system is pre-stored in the first system partition of the first storage device, it is equivalent to determining that the storage capacity of the first system partition meets the storage requirements of the data corresponding to the operating system, as well as the requirements for subsequent operation of the operating system. For example, the storage capacity of the second system partition can be determined based on the storage capacity of the first system partition. For example, in the second storage device, a second system partition with the same storage capacity as the first system partition is created, so that the storage capacity of the second system partition meets the storage requirements of the data corresponding to the operating system, as well as the requirements for subsequent operation of the operating system. In addition, the storage capacity of the second system partition can be determined based on the storage capacity of the first system partition, which is conducive to improving the convenience of creating the second system partition in the second storage device.
[0047] Step S103: Copy the data corresponding to the operating system stored in the first system partition to the second system partition of the second storage device.
[0048] For example, the operation of an operating system depends on the data corresponding to the operating system, which includes, but is not limited to, binary programs, configuration files, and logs. As shown in Figure 2, during the operating system preparation phase, the data corresponding to the operating system stored in the first system partition must be copied to the second system partition of the second storage device to ensure that the second system partition of the second storage device meets the conditions for running the operating system. Only then can the operating system be run in the subsequent operating system operation phase based on the data corresponding to the operating system stored in the second system partition.
[0049] In some implementations, data corresponding to the operating system in the first system partition is divided into blocks to obtain data blocks corresponding to the operating system; and the data blocks corresponding to the operating system are copied to the second system partition of the second storage device.
[0050] For example, block copying technology can be used to process the data corresponding to the operating system in the first system partition in blocks to obtain data blocks corresponding to the operating system, and then copy the data blocks corresponding to the operating system to the second system partition of the second storage system. In an exemplary embodiment, taking the Linux operating system as an example, a hook script can be used to use the dd tool to copy the data corresponding to the operating system stored in the first system partition in the form of data blocks to the second system partition of the second storage system, thereby making the second system partition of the second storage device meet the conditions for running the operating system; of course, this is not limited to this and is not intended to be a limitation here.
[0051] For example, data corresponding to the operating system in the first system partition may be copied to the second system partition of the second storage device in the form of a file, which is not limited here.
[0052] Copying the data corresponding to the operating system to the second system partition of the second storage device through one or more data copying methods is conducive to improving the convenience of copying the data corresponding to the operating system to the second system partition of the second storage device and improving data copying efficiency.
[0053] In some implementations, after the second storage device creates the second system partition, the storage capacity of the second system partition may be dynamically reclaimed based on the usage of the storage capacity of the second system partition by data corresponding to the operating system.
[0054] For example, when the storage capacity occupied by the data corresponding to the operating system in the second system partition is smaller than the storage capacity of the second system partition, data other than the data corresponding to the operating system is stored based on the partial storage capacity in the second system partition not occupied by the data corresponding to the operating system.
[0055] For example, when the storage capacity occupied by the data corresponding to the operating system in the second system partition is smaller than the storage capacity of the second system partition, the thin provisioning technology can be used to enable part of the storage capacity in the second system partition not occupied by the data corresponding to the operating system to be used to store data other than the data corresponding to the operating system, so as to improve the utilization rate of the storage capacity in the second system partition while ensuring the normal operation of the operating system.
[0056] Step S104: running the operating system based on the data corresponding to the operating system in the second system partition.
[0057] In some implementations, data corresponding to the operating system in the second system partition may be read / written to run the operating system.
[0058] Exemplarily, the second system partition is mounted to the root directory corresponding to the operating system, so that when the operating system detects an operation on the operating system, it reads / writes the data corresponding to the operating system in the second system partition according to the root directory to obtain the data corresponding to the operating system after the read / write processing.
[0059] For example, based on the fact that both the first system partition and the second system partition store data corresponding to the operating system, the device where the operating system resides, during the operating system operation phase, will, for example, determine based on the root directory corresponding to the operating system, the path for reading / writing the data corresponding to the operating system when an operation on the operating system is detected. As shown in FIG2 , by mounting the second system partition to the root directory corresponding to the operating system, when an operation on the operating system is detected, it can be determined that the path required to access the operating system is the second system partition. The second system partition can then be accessed based on the root directory, for example, by performing read / write operations on the data corresponding to the operating system in the second system partition, obtaining the data corresponding to the operating system after the read / write operations, and then running the operating system.
[0060] Based on the fact that at least one of the reliability and read / write performance of the second storage device is better than that of the first storage device, the risk of the second storage device failing or going offline is lower than that of the first storage device, which is beneficial to reducing the risk of errors in the operation of the operating system and the risk of data loss due to the termination of services running on the operating system. Therefore, running the operating system based on the data corresponding to the operating system in the second system partition is beneficial to improving the operating reliability of the operating system and the storage reliability of data, thereby improving the user experience of the operating system.
[0061] Step S105: When the operating system is running, synchronize changes in the data corresponding to the operating system in the second system partition to the data corresponding to the operating system in the first system partition.
[0062] For example, taking the second storage device as a memory disk, when the device where the operating system is located loses power or restarts, the data stored in the second storage device will be lost, for example, due to a failure of the device where the operating system is located or the restart after power failure. Therefore, in order to avoid the user needing to repeatedly perform the same operation on the operating system after the device failure or restart after power failure of the operating system, for example, when the operating system is running, the changes in the data corresponding to the operating system in the second system partition can be synchronized to the data corresponding to the operating system in the first system partition, which is conducive to timely saving the changes in the data corresponding to the operating system. Moreover, after the device where the operating system is located is restarted or powered off, by timely saving the changes in the data corresponding to the operating system, it is conducive to retaining the user's settings for the operating system, thereby helping to improve the user's experience of using the operating system.
[0063] In some embodiments, when the operating system is running, changes in the data corresponding to the operating system in the second system partition are synchronized to the data corresponding to the operating system in the first system partition at every preset time threshold; of course, this is not limited to this. For example, changes in the data corresponding to the operating system in the second system partition can be synchronized to the data corresponding to the operating system in the first system partition in real time; changes in the data corresponding to the operating system that need to be retained can also be synchronized to the data corresponding to this operating system in the first system partition according to the changes in the data corresponding to the operating system that need to be retained set by the user. There is no limitation here.
[0064] By synchronizing the changes in the data corresponding to the operating system in the second system partition to the data corresponding to the operating system in the first system partition when the operating system is running, it is beneficial to timely save the changes in the data corresponding to the operating system, and to retain the user's settings for the operating system, thereby improving the user's experience of using the operating system.
[0065] Exemplarily, when the second storage device restarts after a failure or power outage, the data corresponding to the operating system in the first system partition and changes to the data corresponding to the operating system are copied to the second system partition.
[0066] For example, if the device where the operating system is located fails or restarts after a power outage, the second storage device will also restart accordingly. If the data stored in the second storage device will be lost due to the device failure or restart after a power outage, the data corresponding to the operating system stored in the first system partition and the changes in the data corresponding to the operating system previously backed up in the first system partition will be used to copy the data corresponding to the operating system in the first system partition and the changes in the data corresponding to the operating system to the second system partition to retain the user's settings for the operating system, thereby helping to improve the user's experience of using the operating system.
[0067] The operating system control method provided in the above embodiment includes: when the kernel of the operating system detects the first system partition of the first storage device, determining the second storage device, the first system partition stores data corresponding to the operating system, and the second storage device is different from the first storage device; creating a second system partition on the second storage device; copying the data corresponding to the operating system stored in the first system partition to the second system partition of the second storage device; running the operating system based on the data corresponding to the operating system in the second system partition; and synchronizing changes in the data corresponding to the operating system in the second system partition to the data corresponding to the operating system in the first system partition when the operating system kernel detects the first system partition of the first storage device. By determining the second storage device that is different from the first storage device when the kernel of the operating system detects the first system partition of the first storage device, and by copying the data corresponding to the operating system stored in the first storage device to the second system partition of the second storage device, the second storage device is enabled to have the ability to run the operating system, thereby improving the operating reliability of the operating system and the storage reliability of the data, thereby improving the user experience of the operating system.
[0068] Please refer to FIG3 , which is a schematic block diagram of the structure of an electronic device provided by an embodiment of the present disclosure.
[0069] As shown in FIG3 , the electronic device 300 includes a processor 301 and a memory 302 . The processor 301 and the memory 302 are connected via a bus 303 , such as an I 2 C (Inter-Integrated Circuit) bus.
[0070] Specifically, the processor 301 is used to provide computing and control capabilities to support the operation of the entire electronic device. The processor 301 can be a central processing unit (CPU), and the processor 301 can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0071] Specifically, the memory 302 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a mobile hard disk.
[0072] Those skilled in the art will understand that the structure shown in FIG5 is merely a block diagram of a partial structure related to the embodiment of the present disclosure, and does not constitute a limitation on the electronic device to which the embodiment of the present disclosure is applied. The specific server may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0073] The processor is configured to run a computer program stored in a memory, and implement any one of the operating system control methods provided in the embodiments of the present disclosure when executing the computer program.
[0074] In one embodiment, the processor is configured to run a computer program stored in the memory, and implement the following steps when executing the computer program:
[0075] When the kernel of the operating system detects a first system partition of a first storage device, determining a second storage device, the first system partition stores data corresponding to the operating system, and the second storage device is different from the first storage device;
[0076] creating a second system partition on the second storage device;
[0077] copying data corresponding to the operating system stored in the first system partition to the second system partition of the second storage device;
[0078] running the operating system based on the data corresponding to the operating system in the second system partition;
[0079] When the operating system is running, changes in the data corresponding to the operating system in the second system partition are synchronized to the data corresponding to the operating system in the first system partition.
[0080] In one embodiment, when the kernel of the operating system detects the first system partition of the first storage device and determines the second storage device, the processor is configured to implement:
[0081] Selecting a preset storage device that meets a preset condition from preset storage devices other than the first storage device as a second storage device;
[0082] The preset conditions include at least one of the following: reliability is better than the first storage device, and read / write performance is better than the first storage device.
[0083] In one embodiment, when implementing the creating of the second system partition on the second storage device, the processor is configured to implement:
[0084] In the second storage device, a second system partition having the same storage capacity as that of the first system partition is created.
[0085] In one embodiment, when implementing the copying of the data corresponding to the operating system stored in the first system partition to the second system partition of the second storage device, the processor is configured to implement:
[0086] performing block processing on the data corresponding to the operating system in the first system partition to obtain data blocks corresponding to the operating system;
[0087] Copy the data blocks corresponding to the operating system to the second system partition of the second storage device.
[0088] In one embodiment, when the processor runs the operating system based on the data corresponding to the operating system in the second system partition, it is configured to implement:
[0089] The second system partition is mounted to the root directory corresponding to the operating system, so that when the operating system detects an operation on the operating system, the operating system reads / writes the data corresponding to the operating system in the second system partition according to the root directory to obtain the data corresponding to the operating system after the read / write processing.
[0090] In one embodiment, after implementing the creation of the second system partition on the second storage device, the processor is configured to implement:
[0091] When the storage capacity occupied by the data corresponding to the operating system in the second system partition is smaller than the storage capacity of the second system partition, data other than the data corresponding to the operating system is stored based on the portion of the storage capacity in the second system partition not occupied by the data corresponding to the operating system.
[0092] In some embodiments, when implementing, while running the operating system, synchronizing changes in data corresponding to the operating system in the second system partition to data corresponding to the operating system in the first system partition, the processor is configured to implement:
[0093] When the operating system is running, changes in the data corresponding to the operating system in the second system partition are synchronized to the data corresponding to the operating system in the first system partition at every preset time threshold.
[0094] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the electronic device described above can refer to the corresponding process in the control method embodiment of the aforementioned operating system, and will not be repeated here.
[0095] The embodiments of the present disclosure also provide a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any operating system control method provided in the description of the embodiments of the present disclosure.
[0096] The storage medium may be an internal storage unit of the electronic device described in the aforementioned embodiment, such as a hard disk or memory of the electronic device. The storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, etc. equipped on the electronic device.
[0097] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware embodiment, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable, and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0098] It should be understood that the term "and / or" as used in this disclosure and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system that includes a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system that includes the element.
[0099] The serial numbers of the embodiments of the present disclosure are for description only and do not represent the advantages or disadvantages of the embodiments. The above description is only a specific embodiment of the present disclosure, but the scope of protection of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present disclosure, and these modifications or replacements should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.
Claims
1. A control method for an operating system, the control method comprising: When the kernel of the operating system detects a first system partition of a first storage device, determining a second storage device, the first system partition stores data corresponding to the operating system, and the second storage device is different from the first storage device; Creating a second system partition on the second storage device; Copying data corresponding to the operating system stored in the first system partition to the second system partition of the second storage device; running the operating system based on the data corresponding to the operating system in the second system partition; When the operating system is running, changes in the data corresponding to the operating system in the second system partition are synchronized to the data corresponding to the operating system in the first system partition.
2. The control method according to claim 1, wherein: The step of determining the second storage device when the kernel of the operating system detects the first system partition of the first storage device comprises: Selecting a preset storage device that meets a preset condition from preset storage devices other than the first storage device as a second storage device; The preset condition includes at least one of the following: reliability is better than the first storage device, and read / write performance is better than the first storage device.
3. The control method according to claim 1, wherein: The step of creating a second system partition on the second storage device includes: In the second storage device, a second system partition having a storage capacity equal to that of the first system partition is created.
4. The control method according to claim 1, wherein: The step of copying the data corresponding to the operating system stored in the first system partition to the second system partition of the second storage device includes: Processing the data corresponding to the operating system in the first system partition in blocks to obtain data blocks corresponding to the operating system; The data block corresponding to the operating system is copied to the second system partition of the second storage device.
5. The control method according to claim 1, wherein: The running the operating system based on the data corresponding to the operating system in the second system partition includes: The second system partition is mounted to the root directory corresponding to the operating system, so that when the operating system detects an operation on the operating system, the operating system reads / writes the data corresponding to the operating system in the second system partition according to the root directory to obtain the data corresponding to the operating system after the read / write processing.
6. The control method according to any one of claims 1 to 5, wherein: After the second storage device creates the second system partition, the method further includes: When the storage capacity occupied by the data corresponding to the operating system in the second system partition is smaller than the storage capacity of the second system partition, data other than the data corresponding to the operating system is stored based on a portion of the storage capacity in the second system partition not occupied by the data corresponding to the operating system.
7. The control method according to any one of claims 1 to 5, wherein: After synchronizing changes in the data corresponding to the operating system in the second system partition to the data corresponding to the operating system in the first system partition when the operating system is running, the method further includes: When the second storage device is restarted after a failure or power failure, the data corresponding to the operating system in the first system partition and changes to the data corresponding to the operating system are copied to the second system partition.
8. The control method according to any one of claims 1 to 5, wherein: The step of synchronizing changes in data corresponding to the operating system in the second system partition to data corresponding to the operating system in the first system partition when the operating system is running includes: When the operating system is running, changes in data corresponding to the operating system in the second system partition are synchronized to data corresponding to the operating system in the first system partition at every preset time threshold.
9. An electronic device comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of the control method of the operating system as described in any one of claims 1 to 8 are realized.
10. A storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the control method of the operating system according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for starting Linux system, equipment and storage medium
CN112612524A
System and method for dumping memory in computer systems
US20080294839A1
Data backup method and terminal
WO2020015259A1
