CN109656885B - Storage space monitoring method and device, electronic terminal and storage medium - Google Patents

Storage space monitoring method and device, electronic terminal and storage medium Download PDF

Info

Publication number
CN109656885B
CN109656885B CN201811550567.0A CN201811550567A CN109656885B CN 109656885 B CN109656885 B CN 109656885B CN 201811550567 A CN201811550567 A CN 201811550567A CN 109656885 B CN109656885 B CN 109656885B
Authority
CN
China
Prior art keywords
occupancy rate
storage space
index node
data area
index
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
CN201811550567.0A
Other languages
Chinese (zh)
Other versions
CN109656885A (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201811550567.0A priority Critical patent/CN109656885B/en
Publication of CN109656885A publication Critical patent/CN109656885A/en
Application granted granted Critical
Publication of CN109656885B publication Critical patent/CN109656885B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a storage space monitoring method and device, an electronic terminal and a computer readable storage medium, and belongs to the technical field of computers. The method is applied to the electronic terminal and comprises the following steps: starting a monitoring process aiming at a storage space, wherein the storage space comprises a data area and an index node area, the data area is used for storing files, and the index node area is used for storing index information of the files; acquiring the index node occupancy rate through the monitoring process, wherein the index node occupancy rate is the proportion of occupied index nodes to all index nodes in an index node area; and if the index node occupancy rate exceeds a preset threshold value, cleaning the storage space. The method and the device can realize monitoring management of the index node area of the storage space, effectively monitor the condition that the storage space is abnormally occupied, and improve monitoring efficiency.

Description

Storage space monitoring method and device, electronic terminal and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a storage space monitoring method, a storage space monitoring apparatus, an electronic terminal, and a computer-readable storage medium.
Background
The storage space of electronic terminals such as mobile phones and computers is usually less and less along with the use time, and if malicious software creates files in large quantity, the consumption speed of the storage space is greatly increased, and the normal use of users is affected. Therefore, the storage space needs to be monitored.
The existing storage space monitoring method mainly aims at monitoring a data area of a storage space, and when the capacity of the available data area is too small or abnormal writing occurs in the data area within a short time, a prompt message is sent to a user, or instructions such as space cleaning and file deletion are executed. However, the storage space also includes a large number of index nodes, and when the storage space is abnormally occupied, the available capacity of the index nodes may be too small, and even if the data area has enough capacity, normal file or data storage cannot be performed. Thus, there is room for improvement in the art.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a storage space monitoring method, a storage space monitoring device, an electronic terminal, and a computer-readable storage medium, so as to overcome, at least to a certain extent, the problem that the existing storage space monitoring method cannot perform comprehensive monitoring on the condition that the storage space is abnormally occupied.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to one aspect of the present disclosure, a storage space monitoring method is provided, which is applied to an electronic terminal, and includes: starting a monitoring process aiming at a storage space, wherein the storage space comprises a data area and an index node area, the data area is used for storing files, and the index node area is used for storing index information of the files; acquiring the index node occupancy rate through the monitoring process, wherein the index node occupancy rate is the proportion of occupied index nodes to all index nodes in an index node area; and if the index node occupancy rate exceeds a preset threshold value, cleaning the storage space.
In an exemplary embodiment of the present disclosure, the method further comprises: acquiring the data area occupancy rate of the storage space through the monitoring process, wherein the data area occupancy rate is the proportion of the occupied capacity in the data area to the total capacity of the data area; and if the degree that the index node occupancy rate exceeds the data area occupancy rate meets a preset condition, generating abnormal prompt information about the storage space.
In an exemplary embodiment of the present disclosure, the generating of the exception notification information about the storage space if the degree of the index node occupancy exceeding the data area occupancy satisfies a preset condition includes: calculating the difference value of the index node occupancy rate minus the data area occupancy rate, and calculating the percentage of the difference value to the data area occupancy rate; generating exception prompting information about the storage space if the percentage exceeds a first threshold.
In an exemplary embodiment of the present disclosure, the preset threshold includes a third threshold; the method further comprises the following steps: if the index node occupancy rate exceeds a second threshold value and does not exceed a third threshold value, generating cleaning prompt information about the storage space; wherein the second threshold is less than the third threshold.
In an exemplary embodiment of the present disclosure, the cleaning the storage space includes: and clearing files smaller than the size of the data block in the storage space.
In an exemplary embodiment of the present disclosure, the acquiring, by the monitoring process, an index node occupancy includes: the monitoring process periodically calls an index node query interface and obtains the index node occupancy rate through the index node query interface.
In an exemplary embodiment of the present disclosure, the index node query interface includes an index node available capacity query interface and an index node total capacity query interface.
According to an aspect of the present disclosure, there is provided a storage space monitoring apparatus applied to an electronic terminal, including: the monitoring starting module is used for starting a monitoring process aiming at a storage space, wherein the storage space comprises a data area and an index node area, the data area is used for storing files, and the index node area is used for storing index information of the files; the occupancy rate acquisition module is used for acquiring the occupancy rate of the index nodes through the monitoring process, wherein the occupancy rate of the index nodes is the proportion of the occupied index nodes in the index node area to all the index nodes; and the exception handling module is used for cleaning the storage space if the occupancy rate of the index nodes exceeds a preset threshold value.
According to an aspect of the present disclosure, there is provided an electronic terminal including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any one of the above via execution of the executable instructions.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any one of the above.
Exemplary embodiments of the present disclosure have the following advantageous effects:
and starting a monitoring process aiming at the storage space, acquiring the index node occupancy rate through the monitoring process, and performing corresponding processing if the index node occupancy rate exceeds a preset threshold value. On one hand, a new storage space monitoring method is provided, which can effectively monitor the use condition of the index node area in the storage space, and ensure that the index node area always has enough available space without influencing the normal use of the storage space. On the other hand, by monitoring the occupancy rate of the index nodes, the condition that the storage space is abnormally used can be found, for example, the data area has a large amount of residual space and the index nodes are full, so that the abnormal condition of the storage space can be comprehensively monitored, and the normal use of the storage space is further ensured.
In an embodiment of the disclosure, an index node query interface is defined in the system, so that a monitoring process can obtain query data by calling the interface, thereby improving the efficiency of monitoring the storage space.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
FIG. 1 is a flow chart illustrating a method of memory space monitoring in the exemplary embodiment;
FIG. 2 is a schematic diagram of a storage space in the exemplary embodiment;
fig. 3 is a schematic diagram showing memory space monitoring performed on the mobile phone in the present exemplary embodiment;
FIG. 4 is a flow chart illustrating another method of memory space monitoring in the exemplary embodiment;
fig. 5 is a block diagram showing a configuration of a storage space monitoring apparatus in the present exemplary embodiment;
fig. 6 illustrates an electronic terminal for implementing the above method in the present exemplary embodiment;
fig. 7 shows another electronic terminal for implementing the above method in the present exemplary embodiment;
fig. 8 illustrates a computer-readable storage medium for implementing the above-described method in the present exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In practical applications, the operating system or the application programs (including malware) of the electronic terminal may generate a large amount of small files, which results in the index node being full, and the data area has remaining space. For example, in a practical case, it is found that a mobile phone with an Android system cannot normally access a file, a vold process (an external storage management process) is manually opened, an fs _ mgr process for analyzing a partition file is called, a storage space is scanned, and it is found that an index node of the storage space occupies 622592/622592 and is already written full, while an data area occupies 2137859/2485499 and has a remaining space, but the storage space cannot normally work.
In view of the foregoing, exemplary embodiments of the present disclosure provide a storage space monitoring method, which may be applied to an electronic terminal such as a computer, a mobile phone, a tablet computer, and the like, to monitor a storage space of the electronic terminal. The storage space may be a hard disk of the electronic terminal, a memory, or other media for storing files.
Referring to fig. 1, the storage space monitoring method may include the following steps S110 to S130:
in step S110, a monitoring process for a storage space is started, where the storage space includes a data area and an index node area, the data area is used for storing files, and the index node area is used for storing index information of the files.
Fig. 2 shows a schematic diagram of a storage space in the present exemplary embodiment. Referring to fig. 2, the storage space 200 includes an inode area 210 and a data area 220, the inode area is composed of inodes (2101, 2102, 2103, etc. in the figure), and the data area 220 is composed of data blocks (2201-2207, etc. in the figure). The data area 220 is used for storing a file or an entity of data, and specifically, when a file is written to the storage space 200, the file is written to a data block of the data area 220. The data block is a basic unit of the data area, and the size of the data block depends on the type of the storage space or the operating system, for example, in the operating system of Linux kernel (such as Fedora, Ubuntu, Android, etc.), the size of the data block is usually 4KB, and each file occupies at least 1 data block; for example, in FIG. 2, file 221 occupies data block 2201, file 222 occupies data blocks 2202, 2203, 2204, 2205, and file 223 occupies data blocks 2206, 2207. The inode area 210 is used for storing index information of the file, and the index information may include a creator of the file, a creation date of the file, a size of the file, a storage path of the file in the data area, and the like, so that the inode area 210 may be regarded as a directory of the storage space. For example, in fig. 2, the index information of the file 221 is stored in the index node 2101, the index information of the file 222 is stored in the index node 2102, and the index information of the file 223 is stored in the index node 2103. The size of the inode is also dependent on the type of storage space or operating system, and is typically 128 or 256 bytes. It should be noted that the storage space shown in fig. 2 is only an example, and in some systems, the storage space may include other components such as a boot area in addition to the index node area and the data area, and this example embodiment is not particularly limited thereto.
In an operating system of a Linux kernel, a storage space is based on a Linux file system and comprises an inode area and a data area (block), wherein the inode area, namely an index node area, is composed of inodes and is used for storing meta-information of files, and the meta-information comprises index information of the files; in a FAT File system (File Allocation Table, which generally includes FAT16 and FAT32) of a Windows system, a storage space includes a File Allocation Table area (FAT area) and a Data area (Data area), and the File Allocation Table area, i.e., an index node area, is used for recording the location of a Data area where a File is located.
The monitoring process may be a manually written script or a system process, is usually run in a system background of the electronic terminal, and may be set to be automatically started after being started, or may be started in response to a certain trigger event, such as manual start by a user, automatic start when a file is written in or deleted in a storage space, and the like.
In step S120, the index node occupancy rate is obtained through the monitoring process, and the index node occupancy rate is the ratio of occupied index nodes to all index nodes in the index node area.
The monitoring process is used for monitoring and managing the state of the storage space. In this exemplary embodiment, the monitoring process may obtain the usage information of the index node, which mainly includes the occupancy rate of the index node. Typically, when the storage space is formatted, the total capacity of the inode area and the capacity of each inode are determined, and thus the total number of inodes is determined. In practical applications, an inode may be in two states: writing index information, and then keeping in an occupied state; if the index information is not written, the state is empty. The index node occupancy rate may be a ratio of the occupied index nodes to the total number of the index nodes, or may be a capacity ratio, and since the capacity of each index node is consistent, and each index node can only write index information of one file, the written index information indicates that the capacity of the index node is completely occupied, the number ratio and the capacity ratio are the same value. For example, the total number of index nodes in the index node region is 622592, and the capacity of each index node is 128B, so the total capacity of the index node region is 622592 × 128B — 79692KB, if the number of occupied index nodes is 161874, the index node occupancy rate calculated according to the quantity proportion is 161874/622592 — 26%, and the index node occupancy rate calculated according to the capacity proportion is 161874 × 128B/79692KB — 26%, which indicates that the results obtained by the two calculation methods are the same.
In addition, the monitoring node may also obtain other usage information about the storage space, such as an occupancy rate of the data area, an occupancy rate of each partition, and the like, which is not particularly limited in this exemplary embodiment.
The monitoring process may scan the storage space to obtain the information, or may extract the information from other modules. In an exemplary embodiment, step S120 may also be implemented by:
the monitoring process periodically calls the index node query interface and obtains the index node occupancy rate through the index node query interface.
The index node query interface may include a query method, queried data attributes, an index mode and a query event, and serves as a member to establish data docking for the monitoring process. By defining the index node query interface, the index node occupancy rate or other related data can be more conveniently acquired, and the monitoring efficiency is improved.
Further, in an exemplary embodiment, the index node query interface may include an index node available capacity query interface and an index node total capacity query interface, which are respectively configured to obtain occupied index node capacity and index node total capacity, so that the index node occupancy rate may be calculated.
Taking an Android system as an example for explanation, query interfaces of a file system are body structure member variables mstat.f _ favail and mstat.f _ files generally, but no corresponding inode query interface exists, the query interfaces getavailableinodes long and gettotalininodes long can be customized, and the service condition of the inode is known by monitoring changes of the query interfaces getavailableinodes long and gettotalininodes long. The specific process can be shown as the following code:
/***The number of inodes that are free on the file system and available to*applications.This corresponds to the Unix{@code statvfs.f_favail}field.*/
public Long getAvailableInodesLong ()// Inode area size occupied by query
{ return mstat.f _ favail; return query results to Member variables
/***The number of inodes on the file system.This corresponds to the Unix{@code statvfs.f_files}field.*/
public long getTotalInodesLong ()// query inode area total capacity
{ return mstat.f _ files; return query results to Member variables
It should be understood that the naming of the available capacity query interface of the index node and the total capacity query interface of the index node is not limited to the above case, and any interface name may be set, and other query information may be added to the interface. In addition, the index node available capacity query interface may be replaced with an index node used capacity query interface, and the query results achieved by the index node available capacity query interface are substantially the same, which is not particularly limited in this exemplary embodiment.
In an exemplary embodiment, the inode may be queried through the inode query interface by: sudo dump 2fs-h/dev/hda | grep "Inode size" and df-i.
In an exemplary embodiment, step S120 may be performed periodically, for example, acquiring the index node occupancy every 30 seconds, to periodically monitor the storage space.
In step S130, if the index node occupancy rate exceeds a preset threshold, the storage space is cleared.
The normal use of the storage space is affected by too high occupancy rate of the index nodes, and a preset threshold may be set as a measure for whether the occupancy rate is too high, for example, the preset threshold may be set to 80% or 90% according to the actual situation of the system. If the index node occupancy rate exceeds the preset threshold value, certain measures can be taken, a system can perform cleaning processing on the storage space generally, and can also generate cleaning prompt information about the storage space to prompt a user to clean the storage space.
In an exemplary embodiment, referring to fig. 3, the steps S110 to S130 are executed on the mobile phone, the storage space of the mobile phone may be scanned, the scanning result is presented in a graphical user interface of the mobile phone, and if it is found that the index node occupancy rate is too high, which results in insufficient memory, the cleaning prompt message shown in fig. 3 may be generated and displayed in the interface to guide the user to clean.
Based on the above description, in the present exemplary embodiment, a monitoring process for a storage space is started, and the index node occupancy rate is obtained by the monitoring process, and if the index node occupancy rate exceeds a preset threshold, corresponding processing is performed. On one hand, a new storage space monitoring method is provided, which can effectively monitor the use condition of the index node area in the storage space, and ensure that the index node area always has enough available space without influencing the normal use of the storage space. On the other hand, by monitoring the occupancy rate of the index nodes, the condition that the storage space is abnormally used can be found, for example, the data area has a large amount of residual space and the index nodes are full, so that the abnormal condition of the storage space can be comprehensively monitored, and the normal use of the storage space is further ensured.
Furthermore, in an embodiment of the present disclosure, an index node query interface is defined in the system, so that a monitoring process can obtain query data by calling the interface, thereby improving the efficiency of monitoring the storage space.
In an exemplary embodiment, the storage space monitoring method may further include the steps of:
acquiring the data area occupancy rate of the storage space through a monitoring process, wherein the data area occupancy rate is the proportion of the occupied capacity in the data area to the total capacity of the data area;
and if the degree that the index node occupancy rate exceeds the data area occupancy rate meets a preset condition, generating exception prompt information about the storage space.
As mentioned above, the storage space generally includes the index node area and the data area, and the data area is used for storing the file entity, so that the monitoring process can simultaneously monitor the usage of the data area and obtain the occupancy of the data area.
Generally, there is a certain balance relationship between the index node occupancy rate and the data area occupancy rate, for example, in the ext4 file system of Linux, the storage space includes an inode area and a block area, the ratio of the two areas is 1:4, that is, 4 blocks are allocated to one inode, and the size of one block is 4 KB. Typically, the size of a file is above 4KB or 16KB (i.e., 4 blocks), and a file occupies more than four blocks and only one inode. Therefore, in practical use, the consumption speed of the inode is generally lower than that of the block, i.e., the inode occupancy is lower than the block occupancy. If an abnormal condition occurs, a large number of small files smaller than 16KB or even smaller than 4KB are stored in the storage space, the inode occupancy rate can be rapidly increased, and the balance between the inode and the block is damaged; if the processing is not timely carried out, the subsequent inode is exhausted earlier than the block, so that the storage space cannot be normally used; in an extreme case, if all files stored in the block are files smaller than 4KB, the block uses only 25% of the space when the inode is full, but the files cannot be stored in the block.
Therefore, if the index node occupancy rate exceeds the data area occupancy rate, it indicates that a situation that a large number of small files occupy the index nodes may exist, and the actual availability of the storage space is reduced, and the situation needs to be monitored and prevented. Therefore, whether the index node occupancy rate and the data area occupancy rate are unbalanced or not can be judged through the preset conditions, if the unbalance is judged, abnormal prompt information about the storage space is generated, the abnormal prompt information can be used for prompting a user to clean the data area, and can also prompt the user to detect abnormal reasons, such as whether malicious applications are written into a large number of small files or whether folders occupying a large number of index nodes in the near future exist or not.
In an exemplary embodiment, the monitoring of the difference between the index node occupancy rate and the data area occupancy rate may be started under a certain condition, for example, when the index node occupancy rate reaches a preset warning value or the data area occupancy rate reaches a preset warning value, the index node occupancy rate and the data area occupancy rate are respectively obtained, and whether the degree that the index node occupancy rate exceeds the data area occupancy rate meets a preset condition is determined, so as to determine whether a storage abnormal condition exists.
In an exemplary embodiment, the preset condition may be a threshold value regarding a difference between the index node occupancy and the data area occupancy, for example, set to 40%, and the index node occupancy must not exceed 70% in a normal case when the data area occupancy is 30%.
In an exemplary embodiment, if the degree that the index node occupancy rate exceeds the data area occupancy rate satisfies the preset condition, the step of generating the exception prompting information about the storage space may be implemented by the following steps:
calculating the difference value of the index node occupancy rate minus the data area occupancy rate, and calculating the percentage of the difference value and the data area occupancy rate;
if the percentage exceeds a first threshold, exception prompting information regarding the storage space is generated.
In other words, the preset condition may be a threshold value regarding a percentage of a difference between the index node occupancy and the data area occupancy, that is, the first threshold value. Percent is (index node occupancy-data area occupancy)/data area occupancy. For example, the first threshold may be set to 100%, then the index node occupancy must not exceed twice the data area occupancy; the first threshold may be set at 50%, then the index node occupancy must not exceed 1.5 times the data area occupancy. If the percentage exceeds a first threshold value, the occurrence of abnormity can be judged, and abnormity prompt information about the storage space is generated.
By the method, the preset condition between the index node occupancy rate and the data area occupancy rate is set, so that the abnormal condition can be found at the initial stage of abnormal use of the index node, the early warning of the abnormal condition of the storage space is realized, and the normal use of the storage space is better ensured.
Based on the abnormal prompt information generated by the system background, the user can be notified in various forms, for example, the abnormal prompt information is sent to a mobile phone number bound by the user in the form of a short message, and the abnormal prompt information is sent to a mailbox specified by the user in the form of a mail. In an exemplary embodiment, after generating the exception prompting information about the storage space, the storage space monitoring method may further include the steps of:
and displaying the abnormal prompt information in a graphical user interface of the electronic terminal.
When the abnormal prompt information is displayed, forms such as pop-up windows in the program, page jump and the like can be specifically adopted, so that a user can perceive the abnormal prompt information. The exception prompt message may include specific exception content, exception cause, suggested solution, and the like, and may also include a one-click solution option, and when the user clicks, measures for solving the exception are automatically started, for example, starting a cleaning process about the storage space, or scanning a file in the storage space, and the like.
The abnormality prompt information and the cleaning prompt information regarding the storage space are usually different information. The cleaning prompt information is information which is generated by a system and prompts a user to clean the storage space under the condition that the occupancy rate of the index node is too high (exceeds a preset threshold value), and the cleaning prompt information is only required to be cleaned under the condition that the normal occupancy rate of the index node area is considered to be too high; and the abnormal prompt information is generated when the occupancy rate of the index node exceeds the occupancy rate of the data area too much (meets the preset condition), the system considers that the occupancy rate between the index node and the data area is unbalanced, and the abnormal occupancy of the storage space belongs to the abnormal occupancy of the storage space.
Of course, in some cases, for example, when the occupancy rate of the index node exceeds the occupancy rate of the data area too much, the system scans the storage space for no abnormality, and may also generate abnormality prompt information containing only the content related to the cleaning prompt, that is, the abnormality prompt information and the cleaning prompt information may be the same information in some cases.
In addition, if the cleaning prompt message is generated in step S130, it may be notified to the user by the above-mentioned short message, mail, or display in a graphical user interface.
In an exemplary embodiment, the preset threshold in step S130 may be a third threshold, and the storage space monitoring method may further include the steps of:
if the index node occupancy rate exceeds the second threshold value and does not exceed a third threshold value, generating cleaning prompt information about the storage space; wherein the second threshold is less than the third threshold.
That is, two or more levels of thresholds may be set for the index node occupancy, and different processing measures may be taken with respect to the preset threshold for each level. In the exemplary embodiment, the second threshold is smaller, the severity level thereof is lower, the third threshold is larger, and the severity level thereof is higher, so that when the occupancy rate of the index node only exceeds the second threshold but not the third threshold, a light processing measure is taken, only the cleaning prompt message is generated, that is, only the user is notified to clean, and the user decides whether to clean; and taking a heavy processing measure when the index node occupancy rate exceeds the third threshold, wherein in order to ensure the normal use of the storage space, an emergency cleaning process can be automatically implemented immediately, and related notifications can be sent to the user before the cleaning process is performed. As can be seen from the above, the second threshold should be smaller than the third threshold, for example, the second threshold may be set to 70%, and the third threshold may be set to 90%, so that hierarchical monitoring management is implemented on the index node. In an exemplary embodiment, an option function may also be added, so that the user can set the second threshold and the third threshold in a customized manner.
The "first", "second", and "third" of the first, second, and third thresholds described above are only used as labels for the respective thresholds, and do not limit the number or order of the respective thresholds. For example, when the index node occupancy rate is subjected to hierarchical monitoring management, in addition to the second threshold and the third threshold, a fourth threshold, a fifth threshold, and the like may be added, so that the index node occupancy rate is in different threshold intervals, and different processing measures are taken; for example, when the percentage of the data area occupancy and the difference between the index node occupancy and the data area occupancy are monitored, in addition to the first threshold, more thresholds may be added to correspondingly take different processing measures.
In an exemplary embodiment, the clearing process of the storage space in step S130 can be implemented by the following steps:
and clearing files with the storage space smaller than the size of the data block.
When the storage space is cleaned, in order to effectively reduce the occupancy rate of the index nodes, small files, namely files with the file size smaller than the data block size, can be deleted. In the ext4 file system, the data block size is 4 KB. As previously mentioned, if there are a large number of files in the storage space that are smaller than the size of the data block, then an abnormally high index node occupancy may result. Usually, the small files come from malicious applications or belong to temporary files and the like, and the small files are cleaned, so that the index node occupancy rate can be effectively reduced, and the storage space is recovered to be normal.
In practical application, the small files can be selectively cleaned, for example, the size of the file to be cleaned is determined according to the degree that the occupancy rate of the index node exceeds a preset threshold, and a corresponding amount of the small files is cleaned from the scanned small files, so that the occupancy rate of the index node is restored to a level below the preset threshold; or scanning each folder, determining one or more folders in which the small files are concentrated, taking the folders as abnormal folders, cleaning the small files in the folders, and the like.
Fig. 4 is a flowchart illustrating a storage space monitoring method according to the exemplary embodiment. Referring to fig. 4, a monitoring process is started on the electronic terminal, an index node query interface is called, and the index node occupancy rate and other related data are acquired; firstly, whether the occupancy rate of the index nodes exceeds a third threshold value or not can be judged, if so, a step of cleaning small files is executed, the occupancy rate of the index nodes is recovered to a normal level, and if not, whether the occupancy rate of the index nodes exceeds the second threshold value or not can be continuously judged; if the occupancy rate of the index nodes exceeds the second threshold, generating cleaning prompt information, and if the occupancy rate of the index nodes does not exceed the second threshold, continuously judging whether the percentage of the difference value between the occupancy rate of the index nodes and the occupancy rate of the data area exceeds the first threshold; if the first threshold value is exceeded, generating abnormal prompt information, and if the first threshold value is not exceeded, repeating the procedures of calling the interface data and judging again after a period of time. The cleaning prompt message and the abnormal prompt message can both contain user options of whether to clean the storage space, if the user does not determine to clean, the process can be repeated again after a period of time, and if the user determines to clean, the step of cleaning the small file is executed. In the step of cleaning the small files, the electronic terminal can selectively clean the small files in the storage space through a cleaning process, can also scan the storage space, presents the deletable files in a list form, enables a user to selectively delete the deletable files, and can periodically repeat the process after cleaning.
In addition, fig. 4 shows a mechanism for performing three-tier management on the index nodes, and the determination conditions of the three tiers in the present exemplary embodiment are not sequentially limited, and according to actual needs, it may also be determined first whether the difference percentage exceeds a first threshold or the occupancy rate of the index nodes exceeds a second threshold, and so on. Therefore, the method flow shown in fig. 4 can implement comprehensive monitoring management on the index node area, thereby more efficiently ensuring normal use of the storage space.
Exemplary embodiments of the present disclosure also provide a storage space monitoring apparatus, which may be applied to an electronic terminal. Referring to fig. 5, the apparatus 500 may include: a monitoring starting module 510, configured to start a monitoring process for a storage space, where the storage space includes a data area and an index node area, the data area is used to store a file, and the index node area is used to store index information of the file; an occupancy rate obtaining module 520, configured to obtain an occupancy rate of index nodes through a monitoring process, where the occupancy rate of index nodes is a ratio of occupied index nodes to all index nodes in an index node area; and the exception handling module 530 is configured to perform a cleaning process on the storage space if the index node occupancy rate exceeds a preset threshold.
In an exemplary embodiment, the occupancy acquisition module 520 may be further configured to acquire, through the monitoring process, a data area occupancy of the storage space, where the data area occupancy is a ratio of an occupied capacity in the data area to a total capacity of the data area; the exception handling module 530 may be further configured to generate an exception notification message regarding the storage space if the degree of the index node occupancy exceeding the data area occupancy satisfies a preset condition.
In an exemplary embodiment, the exception handling module 530 may include: the difference percentage calculating unit is used for calculating the difference between the index node occupancy rate and the data area occupancy rate and calculating the percentage of the difference and the data area occupancy rate; and the abnormal prompt information generating unit is used for generating the abnormal prompt information about the storage space if the percentage exceeds a first threshold value.
In an exemplary embodiment, the exception handling module 530 may include: the first processing unit is used for cleaning the storage space if the index node occupancy rate exceeds a third threshold value; the second processing unit is used for generating cleaning prompt information about the storage space if the index node occupancy rate exceeds a second threshold value and does not exceed a third threshold value; wherein the second threshold is less than the third threshold.
In an exemplary embodiment, the exception handling module 530 may be used to clean up files in the storage space that are smaller than the size of the data block.
In an exemplary embodiment, the occupancy obtaining module 520 may be configured to periodically invoke an index node query interface by the scheduling monitoring process, and obtain the occupancy of the index node through the index node query interface.
In an exemplary embodiment, the inode query interface may include an inode available capacity query interface and an inode total capacity query interface.
The specific details of each module/unit in the above-mentioned apparatus have been described in detail in the corresponding method embodiment, and therefore are not described again.
Exemplary embodiments of the present disclosure also provide an electronic terminal capable of implementing the above method.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic terminal 600 according to such an exemplary embodiment of the present disclosure is described below with reference to fig. 6. The electronic terminal 600 shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, the electronic terminal 600 may include a processor 610 and a memory 620, the memory 620 being configured to store executable instructions of the processor 610, the processor 610 being configured to perform the methods of the various exemplary embodiments of the present disclosure via execution of the executable instructions. The executable instructions are typically program code that may be executed by the processor 610, for example, by the processor 610 executing the program code to perform the method steps shown in fig. 1 or 4.
In an exemplary embodiment, as shown in FIG. 7, the electronic terminal 700 may be embodied in the form of a general purpose computing device. Wherein the processor is represented by at least one processing unit 710 and the memory is represented by at least one memory unit 720, and the components of the electronic terminal 700 may further include, but are not limited to: a bus 730 connecting the various system components including the memory unit 720 and the processing unit 710, a display unit 740, and the like.
The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM)721 and/or a cache storage unit 722, and may further include a read only memory unit (ROM)723, among others.
The memory unit 720 may also include programs/utilities 724 having a set (at least one) of program modules 725, such program modules 725 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 730 may be any representation of one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic terminal 700 may also communicate with one or more external devices 900 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic terminal 700, and/or with any devices (e.g., router, modem, etc.) that enable the electronic terminal 700 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 750. Also, the electronic terminal 700 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via the network adapter 760. As shown, the network adapter 760 communicates with the other modules of the electronic terminal 700 via the bus 730. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic terminal 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the exemplary embodiments of the present disclosure.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device.
Referring to fig. 8, a program product 800 for implementing the above method according to an exemplary embodiment of the present disclosure is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit according to an exemplary embodiment of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (8)

1. A storage space monitoring method is applied to an electronic terminal and is characterized by comprising the following steps:
starting a monitoring process aiming at a storage space, wherein the storage space comprises a data area and an index node area, the data area is used for storing files, and the index node area is used for storing index information of the files;
acquiring index node occupancy rate through the monitoring process, wherein the index node occupancy rate is the proportion of occupied index nodes to all index nodes in the index node area;
if the index node occupancy rate exceeds a third threshold value, cleaning the storage space;
if the index node occupancy rate exceeds a second threshold value and does not exceed a third threshold value, generating cleaning prompt information about the storage space; the second threshold is less than the third threshold;
if the index node occupancy rate reaches the corresponding preset warning value, acquiring data area occupancy rate through the monitoring process, and judging whether the degree of the index node occupancy rate exceeding the data area occupancy rate meets a preset condition or not, wherein the data area occupancy rate is the proportion of the occupied capacity in the data area to the total capacity of the data area;
and if the degree that the index node occupancy rate exceeds the data area occupancy rate meets a preset condition, generating abnormal prompt information about the storage space.
2. The method of claim 1, wherein if the degree of the index node occupancy exceeding the data area occupancy satisfies a preset condition, generating exception notification information about the storage space comprises:
calculating the difference value of the index node occupancy rate minus the data area occupancy rate, and calculating the percentage of the difference value to the data area occupancy rate;
generating exception prompting information about the storage space if the percentage exceeds a first threshold.
3. The method of claim 1, wherein the cleaning the storage space comprises:
and clearing files smaller than the size of the data block in the storage space.
4. The method of claim 1, wherein the obtaining, by the monitoring process, the index node occupancy comprises:
the monitoring process periodically calls an index node query interface and obtains the index node occupancy rate through the index node query interface.
5. The method of claim 4, wherein the inode query interface comprises an inode available capacity query interface and an inode total capacity query interface.
6. A storage space monitoring device is applied to an electronic terminal and is characterized by comprising:
the monitoring starting module is used for starting a monitoring process aiming at a storage space, wherein the storage space comprises a data area and an index node area, the data area is used for storing files, and the index node area is used for storing index information of the files;
an occupancy rate obtaining module, configured to obtain an occupancy rate of index nodes through the monitoring process, where the occupancy rate of index nodes is a ratio of occupied index nodes to all index nodes in the index node area, and obtain an occupancy rate of a data area through the monitoring process if the occupancy rate of index nodes reaches a corresponding preset warning value, where the occupancy rate of data area is a ratio of occupied capacity in the data area to total capacity of the data area;
an exception handling module comprising: the first processing unit is used for cleaning the storage space if the index node occupancy rate exceeds a third threshold value; the second processing unit is used for generating cleaning prompt information about the storage space if the index node occupancy rate exceeds a second threshold value and does not exceed a third threshold value; the second threshold is less than the third threshold;
the exception handling module is further configured to, if the index node occupancy rate reaches a corresponding preset warning value, acquire the data area occupancy rate, and determine whether a degree that the index node occupancy rate exceeds the data area occupancy rate meets a preset condition; and if the degree that the index node occupancy rate exceeds the data area occupancy rate meets a preset condition, generating abnormal prompt information about the storage space.
7. An electronic terminal, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-5 via execution of the executable instructions.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1-5.
CN201811550567.0A 2018-12-18 2018-12-18 Storage space monitoring method and device, electronic terminal and storage medium Active CN109656885B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811550567.0A CN109656885B (en) 2018-12-18 2018-12-18 Storage space monitoring method and device, electronic terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811550567.0A CN109656885B (en) 2018-12-18 2018-12-18 Storage space monitoring method and device, electronic terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109656885A CN109656885A (en) 2019-04-19
CN109656885B true CN109656885B (en) 2022-04-29

Family

ID=66114804

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811550567.0A Active CN109656885B (en) 2018-12-18 2018-12-18 Storage space monitoring method and device, electronic terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109656885B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110275870A (en) * 2019-05-22 2019-09-24 深圳壹账通智能科技有限公司 Management method, device, computer equipment and the storage medium of cache file
CN110750411B (en) * 2019-08-26 2023-05-05 上海商米科技集团股份有限公司 Method and device for monitoring, early warning and repairing file index node
CN111444116B (en) * 2020-03-23 2022-11-25 海信电子科技(深圳)有限公司 Storage space fragment processing method and device
CN112711567B (en) * 2021-01-06 2023-04-25 湖南同有飞骥科技有限公司 Session file use space cleaning method and system
CN114328526A (en) * 2021-12-27 2022-04-12 中国电信股份有限公司 Data processing method and device, electronic equipment and computer readable storage medium
CN116049113B (en) * 2022-08-29 2023-10-20 荣耀终端有限公司 File system arrangement method, electronic device and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294206A (en) * 2015-05-21 2017-01-04 广州华多网络科技有限公司 A kind of caching data processing method and device
CN108287869A (en) * 2017-12-20 2018-07-17 江苏省公用信息有限公司 A kind of mass small documents solution based on speedy storage equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8972345B1 (en) * 2006-09-27 2015-03-03 Hewlett-Packard Development Company, L.P. Modifying data structures in distributed file systems
CN102982182B (en) * 2012-12-21 2017-02-08 浙江宇视科技有限公司 Data storage planning method and device
US11093532B2 (en) * 2017-05-25 2021-08-17 International Business Machines Corporation Pre-allocating filesystem metadata within an object storage system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294206A (en) * 2015-05-21 2017-01-04 广州华多网络科技有限公司 A kind of caching data processing method and device
CN108287869A (en) * 2017-12-20 2018-07-17 江苏省公用信息有限公司 A kind of mass small documents solution based on speedy storage equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
linux inode入门简介;asyoulikewhatever;《CSDN》;20150213;第1-4页 *

Also Published As

Publication number Publication date
CN109656885A (en) 2019-04-19

Similar Documents

Publication Publication Date Title
CN109656885B (en) Storage space monitoring method and device, electronic terminal and storage medium
US9274714B2 (en) Method and system for managing storage capacity in a storage network
US11132356B2 (en) Optimizing data entries in a log
US7836344B2 (en) Method for automatic dump assurance
JP2011175357A5 (en) Management device and management program
CN109726076B (en) Applet life cycle management method and system
CN103369003A (en) A method and a system for scanning redundancy files in a mobile device by using cloud computing
WO2015009405A1 (en) Systems and methods for filtering low utility value messages from system logs
CN108334415A (en) A kind of fault-tolerance processing method, device, terminal and storage medium
CN109828859B (en) Mobile terminal memory analysis method and device, storage medium and electronic equipment
CN105893471B (en) Data processing method and electronic equipment
CN105574163A (en) File processing method and device and electronic equipment
CN110427258A (en) Scheduling of resource control method and device based on cloud platform
CN110502345A (en) A kind of overload protection method, device, computer equipment and storage medium
CN115407943A (en) Memory dump file generation method, device and equipment and readable storage medium
CN110502581B (en) Distributed database system monitoring method and device
CN116450287A (en) Method, device, equipment and readable medium for managing storage capacity of service container
CN104216819A (en) Method for managing terminal application
US9870400B2 (en) Managed runtime cache analysis
CN114503109B (en) Method and system for maintaining security of data processing system
CN112486966A (en) Expired data cleaning method and device and electronic equipment
CN110347546B (en) Dynamic adjustment method, device, medium and electronic equipment for monitoring task
CN115718732A (en) Disk file management method, device, equipment and storage medium
CN112905541B (en) Mirror image warehouse garbage cleaning method and device
CN111488117A (en) Method, electronic device, and computer-readable medium for managing metadata

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