[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN106708960B - Repair method of NAS device file system and NAS device - Google Patents

Repair method of NAS device file system and NAS device Download PDF

Info

Publication number
CN106708960B
CN106708960B CN201611085516.6A CN201611085516A CN106708960B CN 106708960 B CN106708960 B CN 106708960B CN 201611085516 A CN201611085516 A CN 201611085516A CN 106708960 B CN106708960 B CN 106708960B
Authority
CN
China
Prior art keywords
file
file system
mark
nas device
nas
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611085516.6A
Other languages
Chinese (zh)
Other versions
CN106708960A (en
Inventor
章子奇
许勇
石岩
郭永强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201611085516.6A priority Critical patent/CN106708960B/en
Publication of CN106708960A publication Critical patent/CN106708960A/en
Application granted granted Critical
Publication of CN106708960B publication Critical patent/CN106708960B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method for repairing a file system of NAS equipment, which is characterized in that when the NAS equipment is closed, a special mark is added on a mark file in the equipment according to the loss condition of cache data so as to indicate whether the equipment is normally closed and whether the file system needs to be repaired; before the device is started and a file system needs to be loaded, the mark file is read to judge whether a special mark exists in the mark file, and if not, the file system is detected and repaired. Therefore, whether the file system needs to be repaired can be automatically judged when the NAS device is started, and the file system can be automatically repaired when the file system needs to be repaired. Therefore, the file system is prevented from being detected and repaired when the NAS device is started every time, and resources and time cost for maintaining the NAS device are greatly saved. Meanwhile, the application also provides NAS equipment.

Description

Repair method of NAS device file system and NAS device
Technical Field
The invention relates to the technical field of communication, in particular to a method for repairing an NAS file system, and also relates to NAS equipment.
Background
With the rapid increase of data volume, people have more and more requirements on data storage, and the application of the NAS storage equipment can well solve the storage problem for enterprises.
NAS (network Attached storage), which is translated into network Attached storage or network storage equipment, is special data storage equipment and can be directly connected to the network without being hung at the back end of the server, thereby avoiding increasing I/O load to the server. The NAS uses embedded system software, provides cross-platform file sharing and can realize centralized data management.
The NAS has the advantages of storage sharing data and centralized management of the SAN, and has the characteristics of convenient and quick access, low cost, good compatibility, convenient management and the like due to an access mode based on the LAN, so that the user cost can be greatly saved. Nowadays, NAS has gradually become one of the main options for enterprise network storage solutions.
The function of the NAS mainly includes the following two aspects, one is file sharing, which is the most basic application of NAS network storage. The NAS device may be found in multiple ways, such as "network neighbors," and store the common files in its shared directory. In addition, a part of NAS network storage is also internally provided with a file server function, files in the NAS can be accessed and managed through a browser, and the files can be uploaded and downloaded in an HTTP mode, so that the method is convenient as a software downloading website is accessed.
Secondly, data backup/disaster recovery, most NAS network storage has multiple backup functions, including local backup (data on a computer is backed up into NAS through a local area network), remote backup (data on a remote computer is backed up into NAS through a wide area network), and inter-NAS backup (data is copied between NAS and NAS).
Currently, the NAS file system is mainly applied as an XFS system, which is a high-performance journaling file system. XFS provides journaling support for file system metadata. When a file system is updated, metadata is written to the journal sequentially before the actual disk blocks are updated. The log of the XFS is saved on the circular buffer of the disk block and is not affected by normal file system operations. The XFS log may also be stored on a data area of the file system (referred to as a built-in log) or on an additional device (to reduce disk operations). The following problems arise because most of the journal and NAS file system maintenance processes remain in the operating system cache:
1. the loss of the NAS log file or data caused by abnormal power failure or equipment hang-up further causes the damage of the NAS file system.
2. The medium failure of the hard disk generally causes data loss of the NAS file system, and possibly causes the loss of NAS file system logs so as to cause damage of the NAS file system.
In order to solve the above problems, the prior art consists of the following two solutions:
1. and after the NAS file is damaged, a manual repair method is adopted.
2. After the equipment is powered on and started, the NAS file system is detected and repaired no matter whether the NAS file system is really damaged or not.
The applicant finds that the prior art has at least the following problems in the process of implementing the present application:
for scheme 1: the manual repair brings the consumption of manpower and material resources, and meanwhile, the service is influenced for a long time when the manual repair is waited.
For scheme 2: the method for detecting and repairing whether the NAS file is damaged or not has the following problems: with the continuous expansion of the capacity of the hard disk, the capacity of the NAS resource is increased to be higher than the TB level, so that the equipment detects whether the NAS file system is normal after being powered on, and the time required for repairing the NAS file system usually needs several hours. The NAS file system can be automatically detected and repaired as long as the equipment is powered on and operated, the NAS file system is not damaged in most cases when the equipment is normally restarted or powered on after being started, and the NAS file system repair is performed on all equipment powered-on conditions in order to avoid damage of the file system under the condition of abnormal power failure, which is too much waste.
Therefore, how to reduce the resource and time cost of NAS file system repair is a technical problem that NAS managers are in urgent need to solve.
Disclosure of Invention
The invention provides a method for repairing a file system of NAS equipment, which is characterized in that when the NAS equipment is closed, a special mark is added on a mark file in the equipment according to the loss condition of cache data so as to indicate whether the equipment is normally closed and whether the file system needs to be repaired; before the equipment is started and a file system is loaded, the marked file is read, whether the file system is damaged or not is judged according to the special mark, and the file system is detected and repaired when the file system is damaged. In the NAS device of the present application, there is a markup file, and the method includes:
reading the mark file before the file system is required to be loaded;
judging whether a special mark exists in the mark file, wherein the special mark is written when the NAS device is closed;
and if no special mark exists in the mark file, detecting and repairing the file system.
Preferably, the method further comprises the following steps:
and if the special mark exists in the mark file, loading the file system and deleting the special mark.
Preferably, the special mark is added by the following method:
when the NAS device is closed, judging whether cache data of the NAS device is lost or not;
and if the cache data of the NAS device is not lost, adding a special mark on the mark file.
Preferably, the method for adding the special mark further comprises:
if the cache data of the NAS device is lost, judging whether the NAS device has power supply input;
if no power supply input exists, keeping the markup file unchanged;
if the power supply is input, judging whether the cache data is normally processed;
if the cache data is processed normally, adding a special mark on the mark file;
and if the cache data is not processed normally, keeping the marking file unchanged.
Accordingly, the present application provides a NAS device, where a markup file is present in the NAS device, including:
the reading module is used for reading the mark file before the file system is required to be loaded;
the judging module is used for judging whether a special mark exists in the mark file, and the special mark is written when the NAS device is closed;
and the repairing module is used for detecting and repairing the file system when no special mark exists in the mark file.
Preferably, the method further comprises the following steps,
and the operation module loads the file system and deletes the special mark when the special mark exists in the mark file.
Preferably, the special mark is added by the following method:
when the NAS device is closed, judging whether cache data of the NAS device is lost or not;
and if the cache data of the NAS device is not lost, adding a special mark on the mark file.
Preferably, the method for adding the special mark further comprises:
if the cache data of the NAS device is lost, judging whether the NAS device has power supply input;
if no power supply input exists, keeping the markup file unchanged;
if the power supply is input, judging whether the cache data is normally processed;
if the cache data is processed normally, adding a special mark on the mark file;
and if the cache data is not processed normally, keeping the marking file unchanged.
Therefore, by applying the technical scheme of the application, when the NAS device is closed, a special mark is added to the mark file in the device according to the loss condition of the cache data so as to indicate whether the device is normally closed and whether a file system needs to be repaired; before the device is started to load the file system, the mark file is read to judge whether a special mark exists in the mark file, and if not, the file system is detected and repaired. Therefore, whether the file system needs to be repaired can be automatically judged when the NAS device is started, and the file system can be automatically repaired when the file system needs to be repaired. Therefore, the file system is prevented from being detected and repaired when the NAS device is started every time, and resources and time cost for maintaining the NAS device are greatly saved.
Drawings
Fig. 1 is a schematic flow chart of a repair method for a NAS device file system according to the present invention;
fig. 2 is a flowchart of a specific repair method for a NAS device file system according to an embodiment of the present application;
fig. 3 is a flowchart of an overall method for repairing a file system of an NAS device according to an embodiment of the present application;
fig. 4 is a flowchart illustrating a boot process of a device according to an embodiment of the present application when executing a file system repair method according to the present application;
fig. 5 is a flowchart illustrating a command restart of a device executing a file system repair method according to the present application according to an embodiment of the present application;
fig. 6 is a flowchart illustrating a command shutdown process of a device executing the file system repair method according to the present application according to an embodiment of the present application;
FIG. 7 is a flow chart of a device with a battery powered off (or device tamper) that is presented in an embodiment of the present application in performing a method for file system repair of the present application;
fig. 8 is a schematic flow chart illustrating a method for adding a missing flag bit in each level of cache according to an embodiment of the present application;
fig. 9 is a schematic flow chart of an adding method for adding no missing flag bit in each level of cache according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a NAS device according to the present application.
Detailed Description
As mentioned in the background, during the use of the NAS device, the abnormal shutdown process may cause the loss of the system cache data, further cause the damage of the file system of the NAS device, and seriously affect the normal use of the NAS device. In order to solve the above technical problems, the prior art has two solutions, one of which is to adopt a manual repair method after finding that the file system of the NAS device is damaged; and secondly, after the device is started, the file system is detected and repaired no matter whether the file system of the NAS device is damaged or not. For the method 1, a large amount of manpower and material resources are consumed for manual repair, and a large amount of time is wasted when the repair is waited, so that normal business is influenced. As for the method 2, the file system is detected and repaired every time the device is started, which not only wastes time and labor, but also generally speaking, the file system of the device can normally operate, and if the file system is detected and repaired every time the device is started for a few cases, the waste of resources and time is actually too large.
In order to solve the problems existing in the repair process of the existing NAS device file system, the application provides a repair method of the NAS device file system, when the device is closed, a special mark is added on a mark file in the device according to the loss condition of cache data so as to indicate whether the device is normally closed and whether the file system needs to be repaired; before the device is started and the file system is loaded, the marked file is read, whether the file system is damaged or not is judged according to the special mark, and the file system is detected and repaired when the file system is damaged, so that the file system can be repaired intelligently, and the resource and time consumption in the file system repairing process is reduced.
As shown in fig. 1, a schematic flow chart of a repair method for a NAS device file system proposed in the present application is shown, where the method includes:
s101, reading the mark file before the file system needs to be loaded.
In the embodiment of the application, in order to better judge whether the cache data of the system is correctly stored when the device is turned off (including restart, normal shutdown, power removal with a battery, and power removal without a battery), a tag file is added in the NAS device, and a special tag is added to the tag file according to the storage condition of the cache data when the device is turned off each time. The special mark is used for indicating whether the cache data of the system is correctly stored.
In a preferred embodiment of the present application, the method of adding the special mark is as follows:
step 1) judging whether cache data of the NAS device is lost or not when the NAS device is closed; and if the cache data of the NAS device is not lost, turning to the step 2, and if the cache data of the NAS device is lost, turning to the step 3.
The cache data of the NAS device is generally divided into a system cache, a storage level cache and a disk cache. The system cache is a cache divided by the operation of the device, the storage level cache is a cache used by a storage function of a system division part, and the disk cache is a cache provided by the disk for reading and writing the disk.
The NAS device automatically brushes the cache data into a nonvolatile storage medium under the conditions of restart, shutdown, abnormal tamper or power-off of a battery. In these cases, the cached data is generally not lost. However, in the case of no battery abnormal tamper or no battery power supply, the NAS device cannot complete the process of caching data by the brush system, and thus all three types of cached data mentioned above are basically lost.
For the above situation, in order to accurately know whether the cache data is correctly stored when the device is turned off, after the system finishes brushing the cache data to the nonvolatile storage medium, whether the cache data is correctly transferred to the nonvolatile storage medium is judged, if not, the cache data is considered to be lost, otherwise, the cache data is considered not to be lost.
And 2) if the cache data of the NAS device is not lost, adding a special mark on the mark file.
If the cache data of the NAS device is not lost, that is, all levels of cache data of the NAS device are flushed in the nonvolatile storage medium correctly, in this case, the NAS device can recover the cache data when the NAS device is booted next time, and can be used normally, and the file system of the NAS device is not affected. Therefore, in this case, there is no need to perform detection and repair on the file system.
Therefore, in order to mark the above situation, when the NAS device determines that the cache data is not lost, the NAS device reads the mark file, and adds a special mark to the mark file to indicate that the cache data is correctly stored when the NAS device is turned off, and the file system of the NAS device is not affected, and therefore, the NAS device does not need to detect and repair the cache data.
And 3) if the cache data of the NAS device is lost, judging whether the NAS device has power supply input, if so, turning to the step 4), and if not, turning to the step 5).
If the cache data of the NAS device is lost, that is, the cache data of each level of the NAS device is not flushed in the nonvolatile storage medium correctly, in this case, the device may further process the cache data and may recover the cache data when the device is powered on. The further processing must be performed in the presence of power input to the NAS device.
Therefore, in order to better judge whether the NAS device can finish the processing of the cache data under the condition that the cache data is lost, when the cache data is determined to be lost, whether the device has power input is judged first.
And 4) if the NAS device has power supply input, judging whether the cache data are normally processed, if so, turning to the step 6, and if not, turning to the step 7.
If the NAS device has power input, the NAS device is indicated to have the capability of completing further processing of the cached data, but this also does not necessarily guarantee that the NAS device can successfully process the cached data.
Therefore, when determining that the NAS device has power input, it is necessary to further determine whether the NSA device has successfully processed the cached data. Therefore, whether the cached data can be recovered or not during starting can be accurately known, and whether the file system needs to be detected and repaired or not can be further determined.
And 5) if the NAS device has no power supply input, keeping the markup file unchanged.
If the NAS device has no power input, the NAS device indicates that the NAS device cannot complete further processing of the cache data, and the cache data is lost. At this time, the file system will be damaged, and the file system must be detected and repaired at startup, so that the NAS device can be restored to normal use.
Therefore, in order to distinguish the case where the cache data cannot be processed from the case where the cache data can be normally processed, when the NAS device determines that no power is input, the tag file is kept unchanged, that is, the tag file is not processed.
And 6) if the cache data is normally processed, adding a special mark on the mark file.
As described in step 4), even if the NAS device has a power input, the NAS device may not necessarily complete further processing of the cached data, and therefore it is necessary to further determine whether the NAS device correctly completes the processing of the cached data, and this processing can enable the cached data to be recovered when the NAS device is booted next time.
If the cache data is processed normally, in this case, it indicates that the NAS device can recover the cache data and can use the cache data normally when the NAS device is started next time, and the file system of the NAS device is not affected. Therefore, in this case, there is no need to perform detection and repair on the file system.
Similarly, since the NAS device is not affected and can be normally used, in order to indicate this, when the NAS device determines that the cached data is normally processed, a special tag is added to the tag file.
And 7) if the cache data is not normally processed, keeping the markup file unchanged.
If the cache data is not processed normally, in this case, it indicates that the NAS device has lost the cache data at the time of shutdown and is difficult to recover at the time of startup. Therefore, when the NAS device is started next time, the NAS device cannot recover the cached data and cannot be normally used, and the file system of the NAS device is damaged. In which case a detection and repair of the file system has to be performed.
Therefore, in order to distinguish the case where the cache data cannot be restored from the case where the cache data can be normally restored, when the NAS device determines that the cache data is not normally processed, the tag file is kept unchanged, that is, the tag file is not processed.
Therefore, whether the cache data is correctly processed or not when the NAS device is closed can be quickly and accurately judged by the special mark adding method. Further, the two situations that the NAS device needs to be detected and repaired are distinguished from the two situations that the NAS device does not need to be detected and repaired. By adding the special mark, an important reference is provided for detecting and repairing the equipment.
In the embodiment of the application, before the NAS device is booted and loads the file system, in order to accurately determine whether the file system is damaged, the markup file in the NAS device is read first. And judging whether the file system needs to be detected and repaired according to the condition of the marked file.
S102, judging whether a special mark exists in the mark file.
As can be seen from the above, in the embodiment of the present application, when the NAS device is turned off, the NAS device determines whether to add a special tag in the tag file according to the processing condition of the cached data. And when the cache data is correctly stored and/or the cache data of the device can be recovered, a special mark is added in the mark file, and at the moment, the file system of the NAS device is not influenced, so that the cache data does not need to be detected or repaired when being started next time. When the cache data is lost and cannot be recovered, the marked file is kept unchanged, that is, no special mark is added, and at this time, the file system of the NAS device is damaged, so that the file system of the NAS device needs to be detected and repaired when the NAS device is started next time.
Therefore, whether the file system of the NAS device needs to be detected and repaired can be judged by judging whether the special mark exists in the mark file. Therefore, whether the file system needs to be detected and repaired can be judged quickly and accurately when the NAS device is started, the situation that the file system needs to be detected and repaired when the NAS device is started every time is avoided, and resources and time cost for maintaining the NAS device are greatly saved.
S103, if no special mark exists in the marked file, detecting and repairing the file system.
If the special mark is not found in the mark file, the fact that the cache data of the device is lost and the device does not finish correct processing of the cache data when the device is closed last time is indicated, and the fact that damage to the file system of the device is caused when the device is closed last time is indicated. Therefore, in this case, the file system of the device needs to be detected and repaired.
In a preferred embodiment of the present application, the process of detecting and repairing the device file system comprises the steps of:
step 1), inquiring the path of a file system, and sequentially adding the file system into a repair queue;
step 2), umount (suspending) NAS file system;
step 3), detecting the file system in the repair queue;
step 4), judging whether the detection is passed or not, if the detection is passed, turning to the step 5), and if the detection is not passed, turning to the step 6);
step 5), detecting the next file system in the repair queue, and turning to the step 4) to judge whether the detection is passed;
step 6), listing the operations needing to be repaired;
step 7), executing the file system repairing;
and 8) determining whether to execute the repair of the damaged data according to the system configuration.
Through the detection and repair flow, the device can be automatically repaired when the file system is damaged, and the normal operation of the device is ensured, so that the file system is prevented from being detected and repaired when the NAS device is opened at every time, and the resource and time cost for maintaining the NAS device are greatly saved.
In the preferred embodiment of the present application, if there is a special mark in the markup file, the file system is directly loaded, and the special mark in the markup file is deleted.
If the special mark exists in the mark file, the fact that the cache data of the device is correctly stored when the device is closed last time and/or the cache data is correctly processed by the device under the condition that the cache data is lost is shown. Under the condition, when the computer is started next time, the cache data can be recovered, and the file system is not damaged, so that the file system does not need to be detected and repaired.
Therefore, through the addition of the special mark, the equipment can automatically judge whether the file system needs to be detected and repaired when the equipment is started, so that the situation that the file system needs to be detected and repaired when the NAS equipment is started every time is avoided, and the resource and time cost for maintaining the NAS equipment are greatly saved.
And then, the equipment deletes the special mark in the mark file, so that the mark file has no special mark again, and the equipment can conveniently process the mark file when the equipment is closed next time.
Therefore, by applying the technical scheme of the application, when the NAS device is closed, a special mark is added to the mark file in the device according to the loss condition of the cache data so as to indicate whether the device is normally closed and whether a file system needs to be repaired; before the device is started to load the file system, the mark file is read to judge whether a special mark exists in the mark file, and if not, the file system is detected and repaired. Therefore, whether the file system needs to be repaired can be automatically judged when the NAS device is started, and the file system can be automatically repaired when the file system needs to be repaired. Therefore, the file system is prevented from being detected and repaired when the NAS device is started every time, and resources and time cost for maintaining the NAS device are greatly saved.
In order to further illustrate the technical idea of the present invention, the technical solution of the present invention will now be described with reference to specific application scenarios.
Fig. 2 is a flowchart of a specific repair method for a NAS device file system according to an embodiment of the present application, and it can be known that:
after the device is started, the codes of the patent can be loaded after the array and the logic resources are scanned out by reporting the data on the hard disk. The code will first read the flag bit file, and if the flag bit a or B exists in the flag bit file, it indicates that NAS file system detection and repair are not required. If not, the detection and repair of the NAS file system are required.
Specifically, the method comprises the following steps:
s201, reading a zone bit file;
s202, judging whether the flag bit A or B exists, if so, turning to S203, otherwise, turning to S204;
s203, clearing the zone bit without detecting and repairing the NAS file system;
s204, detecting and repairing the NAS file system.
Fig. 3 is a flowchart illustrating an overall method for repairing a file system of a NAS device according to an embodiment of the present application, the method includes the following steps,
s301, setting a default zone bit file to be null;
s302, modifying the zone bit file into a zone bit A under the condition 1;
s303, modifying the zone bit file into a zone bit B under the condition 2;
s304, keeping the flag bit file unchanged under the condition 3;
s305, starting the equipment and judging whether the flag bit file is changed or not; if the change goes to S306, otherwise go to S307;
s306, directly loading a file system;
s307, detecting and repairing the file system;
s308, clearing the mark bit.
It should be noted that:
the condition 1 is: and the device command is restarted, the device command is shut down, and the cache data is not lost.
The condition 2 is: the equipment has a battery to pull out a power supply, the equipment is abnormally tamped, and the cache data is not lost.
The condition 3 is: the device has no battery to pull out the power supply, and the device has no battery abnormal tamper, so that the cache data is lost.
As shown in fig. 4, which is a starting-up flowchart of the device for executing the file system repair method of the present application according to the embodiment of the present application, it can be seen that the BIOS self-test is started first after the device is powered on, the kernel is loaded to the memory, and the driver of the root directory is loaded after the virtual file system is loaded; the virtual file system is unloaded later, and the real file system is mounted; subsequent loading of the driver, loading of the device service; and then the hard disk is on line, and the mount NAS file system can be obtained after the array and the logic resources are scanned on line.
The method comprises the following specific steps:
s401, carrying out BIOS self-checking on the equipment;
s402, loading the kernel
S403, loading necessary drivers of the root directory
S404, loading the file system
S405, loading the driver
S406, brushing the nonvolatile storage medium data to the cache
S407, starting the device service
S408, reporting the Disk;
s409, scanning array and logic resources;
s410, loading a repair method of the NAS device file system;
s411, mount NAS file system.
Fig. 5 is a flowchart illustrating a command restart of a device in executing a file system repair method according to an embodiment of the present application, where the method includes:
s501, the equipment executes a restart command;
s502, closing the network port;
s503, stopping each service;
s504, refreshing all levels of caches of the system;
s505, setting flag bit according to cache condition
S506, executing the reboot command to enter a boot process.
Fig. 6 is a flowchart illustrating a command shutdown process of a device executing a file system repair method according to the present application according to an embodiment of the present application, where the method includes:
s601, the equipment executes a shutdown command;
s602, closing the network port;
s603, stopping various services;
s604, refreshing all levels of caches of the system;
s605, setting a flag bit according to the cache condition
S606, executing a hash shutdown process;
s607, the kernel shutdown process is entered.
Fig. 7 is a flowchart illustrating a method for implementing a file system repair method according to an embodiment of the present invention with a battery (or a device tamper), where the method includes:
s701, when a battery exists in the equipment, the equipment is powered off and is forced to shut down;
s701, closing the network port;
s701, cutting kdump and entering a small system;
s701, refreshing all levels of caches of the system;
s701, setting a flag bit according to a cache condition;
s701, entering a kernel shutdown process.
Fig. 8 is a schematic flow chart of a method for adding a missing flag bit in each level of cache according to an embodiment of the present application, where the method includes:
s801, all levels of caches are lost;
s802, judging whether the equipment has a battery, if so, turning to S803, otherwise, turning to S804;
s803, judging whether the cache data are normally processed, if so, turning to S805, otherwise, turning to S806;
s804, keeping the flag bit file unchanged;
s805, writing B in the flag bit file
And S806, ensuring the flag bit file to be unchanged.
Fig. 9 is a schematic flow chart of a method for adding no missing flag bit in each level of cache according to an embodiment of the present application, where the method includes:
s901, all levels of caches are not lost;
s902, judging whether the shutdown state of the equipment is normal shutdown and restart or abnormal tamper of the equipment, if the shutdown state of the equipment is normal shutdown and restart, turning to S903, otherwise, turning to S904;
s903, writing the flag bit file into A;
and S904, writing the flag bit file into B.
Therefore, by applying the technical scheme of the application, when the NAS device is closed, a special mark is added to the mark file in the device according to the loss condition of the cache data so as to indicate whether the device is normally closed and whether a file system needs to be repaired; before the device is started to load the file system, the mark file is read to judge whether a special mark exists in the mark file, and if not, the file system is detected and repaired. Therefore, whether the file system needs to be repaired can be automatically judged when the NAS device is started, and the file system can be automatically repaired when the file system needs to be repaired. Therefore, the file system is prevented from being detected and repaired when the NAS device is started every time, and resources and time cost for maintaining the NAS device are greatly saved.
In order to achieve the above technical objective, the present application further discloses an NAS device, where a markup file is provided in the NAS device, and the NAS device includes:
the reading module 101 reads the markup file before a file system needs to be loaded;
a judging module 102, configured to judge whether a special mark exists in the mark file, where the special mark is written when the NAS device is closed;
and the repair module 103 detects and repairs the file system when no special mark exists in the mark file.
In a specific application scenario, it further includes,
and the operation module loads the file system and deletes the special mark when the special mark exists in the mark file.
In a specific application scenario, the adding method of the special mark is as follows:
when the NAS device is closed, judging whether cache data of the NAS device is lost or not;
and if the cache data of the NAS device is not lost, adding a special mark on the mark file.
In a specific application scenario, the method for adding the special mark further includes:
if the cache data of the NAS device is lost, judging whether the NAS device has power supply input;
if no power supply input exists, keeping the markup file unchanged;
if the power supply is input, judging whether the cache data is normally processed;
if the cache data is processed normally, adding a special mark on the mark file;
and if the cache data is not processed normally, keeping the marking file unchanged.
Therefore, by applying the technical scheme of the application, when the NAS device is closed, a special mark is added to the mark file in the device according to the loss condition of the cache data so as to indicate whether the device is normally closed and whether a file system needs to be repaired; before the device is started to load the file system, the mark file is read to judge whether a special mark exists in the mark file, and if not, the file system is detected and repaired. Therefore, whether the file system needs to be repaired can be automatically judged when the NAS device is started, and the file system can be automatically repaired when the file system needs to be repaired. Therefore, the file system is prevented from being detected and repaired when the NAS device is started every time, and resources and time cost for maintaining the NAS device are greatly saved.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by hardware, or by software plus a necessary general hardware platform. Based on such understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present invention.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present invention.
Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above-mentioned invention numbers are merely for description and do not represent the merits of the implementation scenarios.
The above disclosure is only a few specific implementation scenarios of the present invention, however, the present invention is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present invention.

Claims (2)

1. A method for repairing a file system of a NAS device, wherein a label file is in the NAS device, the method comprising:
reading the mark file before the file system is required to be loaded;
judging whether a special mark exists in the mark file, wherein the special mark is added to the mark file according to the loss condition of the cache data when the NAS device is closed, and the method comprises the following steps:
when the NAS device is closed, judging whether cache data of the NAS device is lost or not;
if the cache data of the NAS device is not lost, adding a special mark on the mark file;
if the cache data of the NAS device is lost, judging whether the NAS device has power supply input;
if no power supply input exists, keeping the markup file unchanged;
if the power supply is input, judging whether the cache data is normally processed;
if the cache data is processed normally, adding a special mark on the mark file;
if the cache data is not processed normally, keeping the markup file unchanged;
if no special mark exists in the marked file, detecting and repairing the file system;
and if the special mark exists in the mark file, loading the file system and deleting the special mark.
2. A NAS device having a markup file therein, the device comprising:
the reading module is used for reading the mark file before the file system is required to be loaded;
a determining module, configured to determine whether a special token exists in the token file, where the special token is added to the token file according to a loss condition of the cached data when the NAS device is closed, and the determining module includes:
when the NAS device is closed, judging whether cache data of the NAS device is lost or not;
if the cache data of the NAS device is not lost, adding a special mark on the mark file;
if the cache data of the NAS device is lost, judging whether the NAS device has power supply input;
if no power supply input exists, keeping the markup file unchanged;
if the power supply is input, judging whether the cache data is normally processed;
if the cache data is processed normally, adding a special mark on the mark file;
if the cache data is not processed normally, keeping the markup file unchanged;
the repairing module is used for detecting and repairing the file system when no special mark exists in the mark file;
and the operation module loads the file system and deletes the special mark when the special mark exists in the mark file.
CN201611085516.6A 2016-11-30 2016-11-30 Repair method of NAS device file system and NAS device Active CN106708960B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611085516.6A CN106708960B (en) 2016-11-30 2016-11-30 Repair method of NAS device file system and NAS device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611085516.6A CN106708960B (en) 2016-11-30 2016-11-30 Repair method of NAS device file system and NAS device

Publications (2)

Publication Number Publication Date
CN106708960A CN106708960A (en) 2017-05-24
CN106708960B true CN106708960B (en) 2021-05-28

Family

ID=58935207

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611085516.6A Active CN106708960B (en) 2016-11-30 2016-11-30 Repair method of NAS device file system and NAS device

Country Status (1)

Country Link
CN (1) CN106708960B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109388436A (en) * 2017-08-04 2019-02-26 中兴通讯股份有限公司 Control method, device and the storage medium of starting procedure
CN107562577A (en) * 2017-09-21 2018-01-09 郑州云海信息技术有限公司 A kind of file system restorative procedure and device
CN109597715A (en) * 2018-12-04 2019-04-09 深圳创维数字技术有限公司 A kind of disk restorative procedure, device and equipment
CN112579179A (en) * 2019-09-30 2021-03-30 合肥杰发科技有限公司 Partition mounting method of embedded system
CN110908760B (en) * 2019-11-25 2022-10-14 安徽兮克电子科技有限公司 Method for realizing window opening switching on WEB browser
CN118519834B (en) * 2024-07-24 2024-10-22 浙江大华技术股份有限公司 File system repair method, device, storage medium and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102113058A (en) * 2008-04-09 2011-06-29 拉姆伯斯公司 Programmable memory repair scheme
CN103064752A (en) * 2011-09-27 2013-04-24 奇智软件(北京)有限公司 Method and device of repairing document
CN104090729A (en) * 2014-07-04 2014-10-08 浙江宇视科技有限公司 Method and device for repairing mirror image synchronization through service write operation
US9490034B1 (en) * 2015-08-18 2016-11-08 Oracle International Corporation Centralized memory repair block

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100389206B1 (en) * 2001-04-25 2003-06-27 주식회사 성진씨앤씨 Apparatus and method for protecting failure of computer operating system
CN1936853B (en) * 2005-09-22 2010-05-05 康佳集团股份有限公司 Data cut-off protection and repairing method of inlaid apparatus
CN101807212B (en) * 2010-04-30 2013-05-08 迈普通信技术股份有限公司 Caching method for embedded file system and embedded file system
CN103020415A (en) * 2011-09-28 2013-04-03 盛趣信息技术(上海)有限公司 Method, device and system for preventing game cheating

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102113058A (en) * 2008-04-09 2011-06-29 拉姆伯斯公司 Programmable memory repair scheme
CN103064752A (en) * 2011-09-27 2013-04-24 奇智软件(北京)有限公司 Method and device of repairing document
CN104090729A (en) * 2014-07-04 2014-10-08 浙江宇视科技有限公司 Method and device for repairing mirror image synchronization through service write operation
US9490034B1 (en) * 2015-08-18 2016-11-08 Oracle International Corporation Centralized memory repair block

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
硬盘数据恢复原理与方法;冷静等;《江苏科技信息》;20101225;53-54页 *

Also Published As

Publication number Publication date
CN106708960A (en) 2017-05-24

Similar Documents

Publication Publication Date Title
CN106708960B (en) Repair method of NAS device file system and NAS device
US20170075618A1 (en) Memory management method
US9176853B2 (en) Managing copy-on-writes to snapshots
US11809253B2 (en) Managing ephemeral storage on a computing node
US11698808B2 (en) System and method of selectively restoring a computer system to an operational state
CN105653345A (en) Method and device supporting data nonvolatile random access
CN105468544B (en) Method and device for realizing power-down prevention file system and power-down prevention file system
JP5713138B1 (en) Virtual computer system, printer control system, virtual computer program, and printer control program
US8521950B2 (en) Booting an operating system from a virtual hard disk
US20130124842A1 (en) Image forming apparatus and method of booting image forming apparatus having hibernation function
CN104216802A (en) Memory database recovery method and device
JP2015114750A (en) Examination program, information processing device, and information processing method
US9459676B2 (en) Data storage device control with power hazard mode
US20150249708A1 (en) System and method for asynchronous replication of a storage in a computing environment
CN101546281A (en) Method and device for improving reliability of embedded system
US20070271311A1 (en) Disk array device and data management method for managing master data and replication data replicated from master data
KR20150058092A (en) Network boot system
CN111813748B (en) File system mounting method and device, electronic equipment and storage medium
US9606929B2 (en) Simulated NVRAM
CN102456047B (en) Method and device for repairing system file based on X86 architecture
KR101064834B1 (en) Instant Bootable Computing System and Method Using Nonvolatile RAM
US20190188102A1 (en) Method and system for data recovery in a cloud based computing environment utilizing object storage
CN1655138A (en) Computer restore system and method with multiple restore points
JP4648097B2 (en) Registry information repair method and information processing apparatus
CN114780356B (en) Method, device, medium and equipment for storing log data of SSD (solid State disk) system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant