CN117270759A - Disk space cleaning method, device, equipment and storage medium - Google Patents

Disk space cleaning method, device, equipment and storage medium Download PDF

Info

Publication number
CN117270759A
CN117270759A CN202310931961.3A CN202310931961A CN117270759A CN 117270759 A CN117270759 A CN 117270759A CN 202310931961 A CN202310931961 A CN 202310931961A CN 117270759 A CN117270759 A CN 117270759A
Authority
CN
China
Prior art keywords
disk
space
days
cleaning
disk space
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310931961.3A
Other languages
Chinese (zh)
Inventor
郭�旗
张通
贾锦辉
龚海澎
蒋烈
谢东
付从海
石林
王庭宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Yingdesaike Technology Co ltd
Original Assignee
Sichuan Yingdesaike Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Yingdesaike Technology Co ltd filed Critical Sichuan Yingdesaike Technology Co ltd
Priority to CN202310931961.3A priority Critical patent/CN117270759A/en
Publication of CN117270759A publication Critical patent/CN117270759A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device

Abstract

The application discloses a disk space cleaning method, a device, equipment and a storage medium, which relate to the technical field of disk management and are used for deploying the disk residual space capacity of equipment in an acquisition working environment; capturing a network packet and selecting a data file in the current working day forward and backward pushing W days in the network packet to calculate the disk space occupation increase rate; calculating the available days of the disk residual space according to the disk residual space capacity and the disk space occupation increasing rate; judging whether the available days of the disk residual space reach a preset condition or not, and if the available days of the disk residual space reach a first preset threshold value, sending alarm information to a user or an administrator; and if the available days of the disk residual space reach a second preset threshold value, starting to clean the disk space. Therefore, the method and the device can stop in time when cleaning work is carried out by dynamically calculating the available days of the disk space, and prevent data files from being excessively cleaned; thereby maintaining equipment stability and reducing maintenance costs.

Description

Disk space cleaning method, device, equipment and storage medium
Technical Field
The present invention relates to the field of disk management technologies, and in particular, to a method, an apparatus, a device, and a storage medium for cleaning a disk space.
Background
The capacity of the disk is fixed from the factory, the total capacity of the disk is not affected by partitioning the disk, modern application programs or systems pay more and more attention to data, and a large number of data files are often stored on the disk. With the rising of the data storage quantity, the disk space is eventually occupied, and in order to alleviate the problem, one of common methods is to compress and store the files, so that the occupied space of the data files is as small as possible, and the usable time of the disk space is prolonged; it is also an option to expand the capacity of the disk, i.e. to add one or more disks, physically expanding the total capacity of the disk that can be used.
The conventional compression storage and disk expansion mode cannot essentially solve the problem of full disk space. Compressed storage simply reduces the space occupied by storing files on disk, and eventually disk space will still be filled over time. The same problem exists in the manner of disk expansion, and the disk is not infinitely increased from the perspective of hardware, so that the total capacity is also occupied.
Therefore, a need exists for a method, apparatus, device and storage medium for cleaning disk space, which solves the problem that the existing disk space is full and cannot be cleaned automatically.
Disclosure of Invention
The purpose of the application is to provide a method, a device, equipment and a storage medium for cleaning disk space, which solve the problem that the existing disk space is full and cannot be cleaned automatically.
In order to solve the above technical problems, the present application provides a method for cleaning a disk space, including:
a method of disk space cleaning comprising:
acquiring the disk residual space capacity Q of deployment equipment in a working environment;
capturing a network packet and selecting a data file in the current working day forward and backward pushing W days in the network packet to calculate the disk space occupation increase rate S;
the available days D of the disk residual space are calculated according to the disk residual space capacity and the disk space occupation increasing rate, and the specific calculation formula is as follows: d=q/S;
judging whether the available days D of the disk residual space reach a preset condition, if so, judging whether the available days D of the disk residual space reach a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned.
Preferably, the determining whether the number D of days available in the remaining space of the disk reaches a preset condition further includes:
if the available days D of the disk remaining space reaches a first preset threshold D 1 But when the second preset threshold value D2 is not reached, only alarm information is sent to the user or the administrator, and the next working process is waited for starting.
Preferably, the specific steps of starting to clean the disk space are as follows:
all data files in the file storage catalog are sorted according to the date, and then the data files are cleaned from the earliest sorting date by taking the day as a unit;
recalculating the remaining available days D 'of the magnetic disk after cleaning the data files of Di days until the recalculated remaining available days D' of the magnetic disk reaches a third preset threshold value, and stopping cleaning; otherwise, the data file is continuously cleaned.
Further preferably, after the cleaning is stopped, the method further comprises:
sending information to a user or management to inform the current working process of cleaning the data file of a specific time period; and meanwhile, the current working process does not exit and is in a continuous waiting state until the next working process is started.
Preferably, before the step of obtaining the remaining space capacity Q of the disk of the deployment device in the working environment, the method further includes:
the current working process monitors the data file storage directory, and when the residual space capacity ratio of the magnetic disk of the deployment device in the working environment reaches a fourth preset threshold value, the current working process is started.
Further preferably, the specific step of starting to start the current working process includes:
judging whether the current working process is formally started or not according to the off-peak use time of the equipment system, formally starting the current working process if the equipment system time is detected to be in the off-peak use time, and starting the current working process again when the equipment system time is waited until the equipment system time is in the off-peak use time if the equipment system time is detected to be not in the off-peak use time.
Preferably, the selecting the data file storage directory to forward the data file within W days on the current working day to calculate the disk space occupation increase rate S further includes:
if the number of days of actually storing the directory of the data file is less than W days, calculating the disk space occupation increase rate S according to the data file of the number of days of actually storing the directory.
For solving above-mentioned technical problem, this application still provides a disk space cleaning device, includes:
the disk information acquisition module is used for acquiring the disk residual space capacity Q of the deployment equipment in the working environment;
the grabbing analysis data module is used for grabbing a network packet and selecting a data file in a current working day forward and backward pushing W days in the network packet to calculate the disk space occupation increase rate S;
the predicted use state module is used for calculating the available days D of the disk residual space according to the disk residual space capacity and the disk space occupation increase rate, and the specific calculation formula is as follows: d=q/S;
the disk cleaning execution module is used for judging available days of the residual space of the diskWhether the number D reaches a preset condition, if the available number D of days of the disk remaining space reaches a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned.
For solving the above technical problem, the present application further provides a disk space cleaning device, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the disk space cleaning method when executing the computer program.
To solve the above technical problem, the present application further provides a computer readable storage medium, where a computer program is stored, where the computer program implements the steps of the disk space cleaning method described above when executed by a processor.
According to the disk space cleaning method, the disk residual space occupation increase rate of the space occupied by the date-average newly-added data file is calculated according to the data file in the last W days, so that the generation and storage conditions of the data file in the actual environment can be reflected more accurately. Then calculating the available days of the disk residual space according to the increase rate of the disk residual space occupation and the capacity of the disk residual space, and carrying out sectional work by setting a plurality of preset thresholds, namely alarming and cleaning firstly, so as to ensure that a user or an administrator is informed of the use condition of the disk space in time, and reserving sufficient time for the user or the administrator to make decisions; and then the available days of the disk space are dynamically calculated, so that the cleaning operation can be stopped in time, and excessive cleaning of data files is prevented. Through independently disk cleaning, can satisfy the continuous steady operation of magnetic disk, make full use of limited magnetic disk space maintains equipment stability, reduces maintenance cost.
The disk space cleaning device, the device and the computer readable storage medium provided by the application correspond to the method and have the same effects.
Drawings
For a clearer description of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described, it being apparent that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for cleaning a magnetic disk according to the present invention;
FIG. 2 is a flowchart of another method for cleaning a magnetic disk according to the present invention;
FIG. 3 is a flowchart of a method for cleaning a magnetic disk according to the present invention;
FIG. 4 is a block diagram of a disk cleaning apparatus according to the present invention;
FIG. 5 is a block diagram of another disc cleaning apparatus according to the present invention.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments herein without making any inventive effort are intended to fall within the scope of the present application.
The core of the application is to provide a disk space cleaning method, a device, equipment and a storage medium.
In order to provide a better understanding of the present application, those skilled in the art will now make further details of the present application with reference to the drawings and detailed description.
Modern applications or systems are increasingly focusing on data, often storing large amounts of data files on disk. Since the capacity of a typical disk is fixed from the time of shipment, partitioning the disk does not affect the total capacity of the disk. Instead, as the amount of data stored on the disk increases, the disk space eventually becomes full. To alleviate this problem, the current common practice is as follows:
firstly, compressing and storing files, so that the occupied space of the data files is as small as possible, and the usable time of the disk space is prolonged;
and secondly, expanding the capacity of the magnetic disk, namely adding one or more magnetic disks, and physically expanding the total capacity of the usable magnetic disk.
These conventional compression storage and disk expansion methods cannot essentially solve the problem of disk space occupation. Such as: the compressed storage only reduces the space occupied by storing the files on the disk, and the disk space is still occupied eventually as time goes on; the same problem exists in the manner of disk expansion, and the disk is not infinitely increased from the perspective of hardware, so that the total capacity is also occupied.
Especially for certain working environments, such as: the equipment deployed in the industrial control environment or the actual running environment of the power system is operated for uninterrupted 7 x 24 hours, and a large number of data files are generated at any moment, so that higher requirements are placed on how the limited disk space is cleaned.
Accordingly, to solve the above-mentioned problems, as shown in fig. 1, the present application provides a disk space cleaning method, including:
s11: and acquiring the disk residual space capacity Q of the deployment device in the working environment.
As can be seen from the above, the total capacity of the disk space for deploying the device in the working environment is fixed when shipped, for example, the total capacity of the disk space is 500GB, 1TB or 2TB. When the deployed equipment runs, the system command can be directly input to search the residual space capacity of the disk through real-time monitoring of the data file storage catalogue, and the residual space capacity Q of the disk can also be directly obtained from equipment system attributes, disk monitoring tools or software.
And for the working environment, the working environment can be an industrial control environment, a power monitoring system, a centralized control system and the like, and the deployment equipment in the working environment can be an industrial control computer, a switch, a flow monitoring device and the like.
S12: and grabbing a network packet and selecting a data file in the current working day of the network packet to push forward for W days to calculate the disk space occupation increase rate S.
Specifically, a packet grabbing tool is used for grabbing a network packet, and selecting a data file in the latest W days in a folder directory of the network packet, and calculating the disk space occupation increase rate S (namely, the capacity of the disk space occupied by the data file newly added in the day). For example: the statistical time length W required for calculating the disk space occupation increase rate is 7 days, and if the time length for actually storing the data file is 10 days and the disk space capacity occupied by the data file is 28GB in 7 days from the current working day forward, the disk space occupation increase rate S=28 GB/7 days=4 GB/day.
The steps also include: if the number of days of actually storing the directory of the data file is less than W days, calculating the disk space occupation increase rate S according to the data file of the number of days of actually storing the directory.
For example: if the period of actually storing the data file is 4 days and the capacity of the disk space occupied by the data file is 28GB in 4 days of forward pushing from the current working day, the increase rate of the disk space occupied is s=28 GB/4 days=7 GB/day.
As can be seen from the foregoing, in this embodiment, the calculation of the data file within W days is set by those skilled in the art according to actual situations or experiences, and the duration of the data file within W days may be greater than or equal to the duration of the data file actually stored or less than the duration of the data file actually stored. Meanwhile, it is easy to understand that the situation of generating and storing the data files in the actual environment can be reflected more accurately by calculating the increase rate of the occupied disk space by the data files in the W days; how the ladle grabbing tool grabs is well known to those skilled in the art, and the embodiments of the present invention are not described herein.
S13: the available days D of the disk residual space are calculated according to the disk residual space capacity and the disk space occupation increasing rate, and the specific calculation formula is as follows: d=q/S.
The available days D of the disk residual space are used as important judgment indexes in the embodiment of the invention, and the usable time length of the disk residual space is predicted by the indexes, so that decision time is reserved for a user, and whether to backup the data file in advance can be automatically determined. For example: the system commands are used for finding that the residual space capacity of the disk is 48GB, the disk space occupation increase rate is substituted into 4 GB/day, and the available days of the residual space of the disk are calculated to be 12, namely the disk space is expected to be occupied after 12 days.
S14: judging whether the available days D of the disk residual space reach a preset condition, if so, judging whether the available days D of the disk residual space reach a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned.
Specifically, after calculating the increase rate of the disk space occupation, calculating the number of days D of the disk space remaining in use according to the value, if the number of days D of the disk space remaining in use reaches a first preset threshold D 1 (namely, a preset alarm threshold value threshold 1), alarm information is sent to a user or an administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 (i.e., the preset purge threshold 2), then the data files of the disk space are initially purged.
It is thus readily understood that the number of days D available for disk space remaining is calculated and determined by setting a first preset threshold D 1 And a second preset threshold D 2 The sectional type work, namely alarming and cleaning before the sectional type work is performed more clearly, so that the user or the manager is ensured to be informed of the use condition of the disk space in time, and the user or the manager is convenient to make decisions in sufficient time.
In addition, it should be noted that the determining whether the number of days D of the remaining space of the disk reaches the preset condition further includes: if the available days D of the disk remaining space reaches a first preset threshold D 1 But does not reach the second preset threshold D 2 And when the working process is started, only sending alarm information to the user or the administrator, and waiting for the next working process to be started.
As can be seen from the above, when the number of days D of disk remaining space reaches the second preset threshold D 2 When the data file is stored in the disk space, the data file in the disk space is cleaned; then the cleaning work of the disk space cannot not have selective blind cleaning, and expired and useless data files are automatically cleaned during automatic cleaning, thereby preventing excessive cleaningAnd (5) cleaning. In order to solve the above-mentioned technical problem, in the step S14, the specific steps for starting to clean the disk space are as follows:
step S141, sorting all data files in the file storage catalog according to the date, and cleaning from the earliest sorting date by taking the day as a unit;
it should be noted that, the data files are sorted according to the last modified date of the data files, and the data files may be sorted according to the date, which is sequentially sorted from the earliest date, or may be sorted according to the current date, but the sorting is finally performed by sorting from the earliest date in a unit of day.
Step S142, every cleaning D i Recalculating the available days D 'of the disk residual space after the data file of the days until the available days D' of the recalculated disk residual space reach a third preset threshold value, and stopping cleaning; otherwise, the data file is continuously cleaned.
It should be noted that each cleaning D i The day's data file may be 1 day, 2 days or 3 days from the earliest date, etc., and theoretically how many days the data file is cleaned at a time may be determined according to the daily stored data file size and the third preset threshold, because the daily stored data file size is not fixed. However, in actual operation, the available days D 'of the disk remaining space are generally calculated once after the data file is cleaned for 1 day, and the cleaning is stopped until the recalculated available days D' of the disk remaining space after the data file is cleaned reaches a third preset threshold. The third preset threshold is a threshold set by a person skilled in the art according to actual situations or experience, and will not be described in detail herein. For example: firstly deleting the data file of the earliest day, then calculating the available days of the disk residual space, then comparing the available days of the disk residual space with a third preset threshold (i.e. stopping cleaning threshold), finding that the available days of the disk residual space is smaller than the third preset threshold (i.e. stopping cleaning threshold), indicating that the data file needs to be cleaned continuously, and then executing step S142 circularly until it is determined that the available days of the disk residual space reach the third preset thresholdA value (i.e., stop clearing threshold), at which point step S142 is not continued. From this, it can be seen that the above parameter D i And D' is a dynamic variable during disk cleaning operations.
In order to make the user or administrator aware of the specific situation of disk cleaning in time, the embodiment further includes, after stopping cleaning in step S14, the following steps:
sending information to a user or management to inform the current working process of cleaning the data file of a specific time period; and meanwhile, the current working process does not exit and is in a continuous waiting state until the next working process is started.
In the above embodiment, it is mentioned that, for the disk space of the device deployed in the working environment, the disk space cleaning still affects the effective operation of the device deployed in the working environment in the actual operation process, and in consideration of the usage habit of the user, as shown in fig. 2, another embodiment is proposed, before the step of obtaining the remaining disk space capacity Q of the device deployed in the working environment on the premise of including all the steps of the above embodiment, further including:
s15, monitoring the data file storage catalog by the current working process, and starting to start the current working process when the disk residual space capacity ratio of the deployment device in the working environment reaches a fourth preset threshold value.
As can be seen from the above description, the data file storage directory in the disk space is monitored by the working process, and those skilled in the art are well familiar with, when the remaining space capacity of the disk of the deployment device in the working environment is monitored to reach 90% or more, the remaining available space of the disk is prompted to be insufficient, and the current working process needs to be started to start to clean the data files in the directory. However, the fourth preset threshold is a threshold set by a person skilled in the art according to the actual environment requirement, and since the setting of the threshold is not a main innovation point of the embodiment of the present invention, the description thereof will not be repeated here.
Specifically, the specific steps for starting the current working process include:
judging whether the current working process is formally started or not according to the off-peak use time of the equipment system, formally starting the current working process if the equipment system time is detected to be in the off-peak use time, and starting the current working process again when the equipment system time is waited until the equipment system time is in the off-peak use time if the equipment system time is detected to be not in the off-peak use time.
It should be noted that, when the current work process is started, the work is not started immediately, and each work process will execute the disk cleaning work in the off-peak daily use period in consideration of the usage habit of the user. For example: the off-peak use time of the preset equipment operation system is 2 am, after the current working process is started, whether the equipment system time is 2 am is detected, if the equipment system time is detected to be not 2 am, the current working process is not required to be formally started, and if the equipment system time is 2 am, the current working process is formally started.
As shown in fig. 3, another method for cleaning a disk space according to an embodiment of the present application is described below, and a method for cleaning a disk space described below may be referred to herein with reference to other embodiments.
In the example, the off-peak use time of the preset system is 2 a.m., the statistical time length W required for calculating the disk space occupation increase rate is 7, and the number of days D of cleaning the data file each time i 1, the first preset threshold is 10, the second preset threshold is 7, the third preset threshold is 14, the data file is a network packet grabbed by using a packet grabbing tool, and the total capacity of the magnetic disk is 2TB.
After the program is started, the process proceeds to step S101, and at this time, it is detected that the system time is not 2 a.m., so that the process does not need to be formally started, but proceeds to step S111, and when the system time is 2 a.m., the process is formally started, the process proceeds to step S102.
In step S102, after the time sequence is finally modified according to the data files, the data files are pushed forward for 7 days from the current working day in a unit of day, the total size of the disk space occupied by the data files in 7 days is calculated to be 28GB, so that the disk space occupation increase rate is 4 GB/day, and the step S103 is entered.
In step S103, the system commands to find that the remaining space capacity of the disk is 48GB, the occupancy rate of the disk space is 4 GB/day, and the number of days of the disk remaining space is calculated to be 12, that is, the disk space is expected to be full after 12 days, and the process goes to step S104.
In step S104, the value 12 of the number of days available in the disk remaining space is compared with a first preset threshold (alarm threshold), and the number of days available in the disk remaining space is found to be greater than the first preset threshold (alarm threshold), and the process proceeds to step S111 without alarm, and waits for the next workflow to be entered.
After the program formally works for two rounds, the available days of the disk residual space are calculated to be 10, in step S104, the available days of the disk residual space are found to reach a first preset threshold (alarm threshold), step S105 is performed, an alarm log is generated, alarm information is sent to an upper management platform, a user or an administrator is informed that the disk residual space of the current device is insufficient, the data file is expected to be automatically cleaned after 3 days, and step S106 is performed.
In step S106, the number of days available for the disk remaining space is compared with a second preset threshold (cleaning threshold), and the number of days available for the disk remaining space is found to be greater than the second preset threshold (cleaning threshold), and the process proceeds to step S111, where the next workflow is waited for.
After the alarm information is sent, three rounds of work are performed, at this time, the number of days of the disc remaining space is calculated to be 7, in step S106, it is found that the number of days of the disc remaining space reaches a second preset threshold (cleaning threshold), and the process goes to step S107.
In step S107, the data files are sorted by the date of last modification of the data files, and then step S108 is entered.
In step S108, the data file of the earliest day is deleted, then the available number of days of the disk remaining space is calculated, at this time, the value is calculated to be 8, step S109 is entered, the available number of days of the disk remaining space is compared with a third preset threshold (stop clearing threshold), it is found that the available number of days of the disk remaining space is smaller than the third preset threshold (stop clearing threshold), it is indicated that the data file needs to be cleared continuously, and steps S108 to S109 are executed in a loop.
Since the size of the data file stored daily is not fixed, after the data file is actually deleted for 10 days, the number of days available for the disk remaining space is calculated to be 14, and it is determined at step S109 that the number of days available for the disk remaining space reaches the third preset threshold (stop clearing threshold), at this time, step S108 is not continued, but step S110 is entered.
In step S110, a log of the cleaned data files is generated and a message is sent to the upper management platform informing the user or administrator which date data files were cleaned. Step S111 is then entered, awaiting entry into the next workflow.
In summary, in the disk space cleaning method provided by the present application, the disk residual space capacity Q of the deployment device in the working environment is obtained; capturing a network packet and selecting a data file in the current working day forward and backward pushing W days in the network packet to calculate the disk space occupation increase rate S; calculating the available days D of the disk residual space according to the disk residual space capacity and the disk space occupation increasing rate; judging whether the available days D of the disk residual space reach a preset condition, if so, judging whether the available days D of the disk residual space reach a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned. Therefore, the number of days of the disk residual space is calculated according to the increase rate of the disk residual space occupation and the volume of the disk residual space, and the sectional work is carried out by setting a plurality of preset thresholds, namely, alarming and cleaning are carried out firstly, so that the situation of the disk space use is timely informed to a user or an administrator, and sufficient time is reserved for the user or the administrator to make a decision; the available days of the disk space are dynamically calculated, so that the cleaning operation can be stopped in time, and excessive cleaning of data files is prevented; finally, through autonomous disk cleaning, not only can the continuous and stable work of the disk be satisfied and the limited disk space be fully utilized, but also the stability of the equipment can be maintained and the maintenance cost can be reduced.
In the foregoing embodiments, a method for cleaning a disk space is described in detail, and the present application further provides a corresponding embodiment of a disk space cleaning device. It should be noted that the present application describes an embodiment of the device portion from two angles, one based on the angle of the functional module and the other based on the angle of the hardware.
Based on the angle of the functional module, as shown in fig. 4, this embodiment provides a disk space cleaning device, including:
the disk information acquisition module 21 is used for acquiring the disk residual space capacity Q of the deployment equipment in the working environment;
the grabbing analysis data module 22 is used for grabbing a network packet and selecting a data file in the current workday of the network packet to push forward for W days to calculate the disk space occupation increase rate S;
the predicted usage status module 23 is configured to calculate a number D of days available for the disk space according to the disk space remaining capacity and the disk space occupation increase rate, where the specific calculation formula is: d=q/S;
the disk cleaning execution module 24 is configured to determine whether the number of days D of disk remaining space reaches a preset condition, if the number of days D of disk remaining space reaches a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned.
Preferably, the clean disk execution module 24 further comprises:
for if the number of days D of disk remaining space reaches a first preset threshold D 1 But does not reach the second preset threshold D 2 And when the working process is started, only sending alarm information to the user or the administrator, and waiting for the next working process to be started.
Preferably, the clean disk execution module 24 further comprises:
the sorting and sorting sub-module is used for sorting all data files in the file storage catalog according to the date, and cleaning from the earliest sorting date by taking the day as a unit;
dynamic cleaning submodule for each cleaning D i Post-day data file re-establishmentCalculating the remaining available days D 'of the magnetic disk, and stopping cleaning until the recalculated remaining available days D' of the magnetic disk reaches a third preset threshold value; otherwise, the data file is continuously cleaned.
Further preferably, the method further comprises:
the notification information sub-module is used for sending information to a user or management and notifying the current working process of cleaning the data file of a specific time period; and meanwhile, the current working process does not exit and is in a continuous waiting state until the next working process is started.
Preferably, before the step of obtaining the remaining space capacity Q of the disk of the deployment device in the working environment, the method further includes:
the starting process module is used for monitoring the data file storage catalog by the current working process, and when the disk residual space capacity ratio of the deployment equipment in the working environment reaches a fourth preset threshold value, starting the current working process.
Further preferably, the process starting module further includes:
the starting process determining sub-module is used for judging whether the current working process is formally started according to the off-peak use time of the equipment system, formally starting the current working process if the equipment system time is detected to be in the off-peak use time, and waiting until the equipment system time is detected to be in the off-peak use time if the equipment system time is detected to be not in the off-peak use time, and starting the current working process.
Preferably, the grabbing and analyzing data module is configured to select the data file in the current workday of the data file storage directory to push forward for W days to calculate the disk space occupation increase rate S, and further includes:
if the number of days of actually storing the directory of the data file is less than W days, calculating the disk space occupation increase rate S according to the data file of the number of days of actually storing the directory.
Since the embodiments of the apparatus portion and the embodiments of the method portion correspond to each other, the embodiments of the apparatus portion are referred to the description of the embodiments of the method portion, and are not repeated herein.
The embodiment providesThe disk space cleaning device provided by the application obtains the disk residual space capacity Q of the deployment equipment in the working environment; capturing a network packet and selecting a data file in the current working day forward and backward pushing W days in the network packet to calculate the disk space occupation increase rate S; calculating the available days D of the disk residual space according to the disk residual space capacity and the disk space occupation increasing rate; judging whether the available days D of the disk residual space reach a preset condition, if so, judging whether the available days D of the disk residual space reach a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned. Therefore, the number of days of the disk residual space is calculated according to the increase rate of the disk residual space occupation and the volume of the disk residual space, and the sectional work is carried out by setting a plurality of preset thresholds, namely, alarming and cleaning are carried out firstly, so that the situation of the disk space use is timely informed to a user or an administrator, and sufficient time is reserved for the user or the administrator to make a decision; the available days of the disk space are dynamically calculated, so that the cleaning operation can be stopped in time, and excessive cleaning of data files is prevented; finally, through autonomous disk cleaning, not only can the continuous and stable work of the disk be satisfied and the limited disk space be fully utilized, but also the stability of the equipment can be maintained and the maintenance cost can be reduced.
Fig. 5 is a block diagram of a disk space cleaning apparatus according to another embodiment of the present application, and as shown in fig. 5, a disk space cleaning apparatus includes: a memory 30 for storing a computer program;
a processor 31 for implementing the steps of a disk space cleaning method according to the above embodiment when executing a computer program.
The disk space cleaning device provided in this embodiment may include, but is not limited to, an intelligent substation, a management platform, a notebook computer, a desktop computer, or the like.
Processor 31 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 31 may be implemented in hardware in at least one of a digital signal processor (Digital Signal Processor, DSP), a Field programmable gate array (Field-Programmable Gate Array, FPGA), a programmable logic array (Programmable Logic Array, PLA). The processor 31 may also comprise a main processor, which is a processor for processing data in an awake state, also called central processor (Central Processing Unit, CPU), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 31 may be integrated with an image processor (Graphics Processing Unit, GPU) for taking care of rendering and rendering of the content that the display screen is required to display. In some embodiments, the processor 31 may also include an artificial intelligence (Artificial Intelligence, AI) processor for processing computing operations related to machine learning.
Memory 30 may include one or more computer-readable storage media, which may be non-transitory. Memory 30 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 30 is at least used for storing a computer program 301, where the computer program, when loaded and executed by the processor 31, is capable of implementing the relevant steps of a disk space cleaning method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 30 may further include an operating system 302, data 303, and the like, where the storage manner may be transient storage or permanent storage. The operating system 302 may include Windows, unix, linux, among other things. The data 303 may include, but is not limited to, a disk space cleaning method, and the like.
In some embodiments, a disk space cleaning apparatus may further include a display screen 32, an input/output interface 33, a communication interface 34, a power supply 35, and a communication bus 36.
Those skilled in the art will appreciate that the configuration shown in FIG. 5 is not limiting of a disk space cleaning apparatus and may include more or fewer components than shown.
The disk space cleaning device provided by the embodiment of the application comprises a memory and a processor, wherein when the processor executes a program stored in the memory, the processor can realize the following method: a disk space cleaning method.
According to the disk space cleaning equipment provided by the embodiment, the processor executes the computer program stored in the memory, so that the situation that the user or the administrator is informed of the use condition of the disk space in time is ensured, and the user or the administrator is conveniently left with enough time to make decisions; and then the available days of the disk space are dynamically calculated, so that the cleaning operation can be stopped in time, and excessive cleaning of data files is prevented. Therefore, the disk space cleaning device provided by the embodiment can not only meet the continuous and stable operation of the disk and fully utilize the limited disk space, but also maintain the stability of the device and reduce the maintenance cost by independently cleaning the disk.
Finally, the present application also provides a corresponding embodiment of the computer readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps as described in the method embodiments above.
It will be appreciated that the methods of the above embodiments, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored on a computer readable storage medium. With such understanding, the technical solution of the present application, or a part contributing to the prior art or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium, performing all or part of the steps of the method described in the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
When the computer program stored in the computer readable storage medium is executed, the number of days of the disk residual space can be calculated according to the increase rate of the disk residual space occupation and the capacity of the disk residual space, and the sectional work is performed by setting a plurality of preset thresholds, so that the situation of the disk space use is timely informed to a user or an administrator, and the user or the administrator is convenient to make a decision with enough time; and then the available days of the disk space are dynamically calculated, so that the cleaning operation can be stopped in time, and excessive cleaning of data files is prevented. Therefore, when the computer program in the computer readable storage medium provided by the embodiment is executed, the computer program can be cleaned by independently using the magnetic disk, so that the continuous and stable operation of the magnetic disk can be met, the limited magnetic disk space can be fully utilized, the stability of the equipment can be maintained, and the maintenance cost can be reduced.
The method, the device and the medium for cleaning the disk space provided by the application are described in detail. In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section. It should be noted that it would be obvious to those skilled in the art that various improvements and modifications can be made to the present application without departing from the principles of the present application, and such improvements and modifications fall within the scope of the claims of the present application.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A method of disk space cleaning comprising:
acquiring the disk residual space capacity Q of deployment equipment in a working environment;
capturing a network packet and selecting a data file in the current working day forward and backward pushing W days in the network packet to calculate the disk space occupation increase rate S;
the available days D of the disk residual space are calculated according to the disk residual space capacity and the disk space occupation increasing rate, and the specific calculation formula is as follows: d=q/S;
judging whether the available days D of the disk residual space reach a preset condition, if so, judging whether the available days D of the disk residual space reach a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned.
2. The method for cleaning disk space according to claim 1, wherein said determining whether the number of days D of disk space remaining reaches a preset condition further comprises:
if the available days D of the disk remaining space reaches a first preset threshold D 1 But does not reach the second preset threshold D 2 And when the working process is started, only sending alarm information to the user or the administrator, and waiting for the next working process to be started.
3. The method for cleaning disk space according to claim 1, wherein the specific steps of starting cleaning disk space are:
all data files in the file storage catalog are sorted according to the date, and then the data files are cleaned from the earliest sorting date by taking the day as a unit;
every time clearance D i Recalculating the remaining available days D 'of the magnetic disk after the data file of the day until the recalculated remaining available days D' of the magnetic disk reaches a third preset threshold value, and stopping cleaning; otherwise, the data file is continuously cleaned.
4. The disk space cleaning method as set forth in claim 3, further comprising, after said stopping cleaning:
sending information to a user or management to inform the current working process of cleaning the data file of a specific time period; and meanwhile, the current working process does not exit and is in a continuous waiting state until the next working process is started.
5. The disk space cleaning method according to claim 1, wherein before the step of obtaining the remaining disk space capacity Q of the deployment device in the working environment, further comprises:
the current working process monitors the data file storage directory, and when the residual space capacity ratio of the magnetic disk of the deployment device in the working environment reaches a fourth preset threshold value, the current working process is started.
6. The disk space cleaning method as set forth in claim 5, wherein the specific step of starting the current work process comprises:
judging whether the current working process is formally started or not according to the off-peak use time of the equipment system, formally starting the current working process if the equipment system time is detected to be in the off-peak use time, and starting the current working process again when the equipment system time is waited until the equipment system time is in the off-peak use time if the equipment system time is detected to be not in the off-peak use time.
7. The method of claim 1, wherein selecting the data file storage directory to forward the data file within W days of the current workday to calculate the disk space occupancy growth rate S further comprises:
if the number of days of actually storing the directory of the data file is less than W days, calculating the disk space occupation increase rate S according to the data file of the number of days of actually storing the directory.
8. A disk space cleaning apparatus, comprising:
the disk information acquisition module is used for acquiring the disk residual space capacity Q of the deployment equipment in the working environment;
the grabbing analysis data module is used for grabbing a network packet and selecting a data file in a current working day forward and backward pushing W days in the network packet to calculate the disk space occupation increase rate S;
the predicted use state module is used for calculating the available days D of the disk residual space according to the disk residual space capacity and the disk space occupation increase rate, and the specific calculation formula is as follows: d=q/S;
the disk cleaning execution module is used for judging whether the available days D of the disk residual space reach a preset condition, if so, the available days D of the disk residual space reach a first preset threshold D 1 When the alarm information is sent to the user or the administrator; if the available days D of the disk remaining space reaches a second preset threshold D 2 When this is the case, the disk space starts to be cleaned.
9. A disk space cleaning apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the disk space cleaning method according to any one of claims 1 to 7 when executing said computer program.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the disk space cleaning method according to any of claims 1 to 7.
CN202310931961.3A 2023-07-27 2023-07-27 Disk space cleaning method, device, equipment and storage medium Pending CN117270759A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310931961.3A CN117270759A (en) 2023-07-27 2023-07-27 Disk space cleaning method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310931961.3A CN117270759A (en) 2023-07-27 2023-07-27 Disk space cleaning method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117270759A true CN117270759A (en) 2023-12-22

Family

ID=89213198

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310931961.3A Pending CN117270759A (en) 2023-07-27 2023-07-27 Disk space cleaning method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117270759A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117519810A (en) * 2024-01-04 2024-02-06 中科方德软件有限公司 Processing method and device for disk partition, electronic equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117519810A (en) * 2024-01-04 2024-02-06 中科方德软件有限公司 Processing method and device for disk partition, electronic equipment and medium
CN117519810B (en) * 2024-01-04 2024-03-12 中科方德软件有限公司 Processing method and device for disk partition, electronic equipment and medium

Similar Documents

Publication Publication Date Title
US7543296B2 (en) Time based multi-tiered management of resource systems
US7716177B2 (en) Proactive space allocation in a database system
US20090183162A1 (en) Priority Based Scheduling System for Server
CN117270759A (en) Disk space cleaning method, device, equipment and storage medium
JP2005535008A (en) Intelligent storage device management method and system
EP2503733A1 (en) Data collecting method, data collecting apparatus and network management device
WO2004099985A1 (en) Execution environment danger prediction/evading method, system, program, and recording medium thereof
CN105991458B (en) Load balancing method and load balancing device
JP3951835B2 (en) Business management method and business processing system
US11102289B2 (en) Method for managing resource state information and system for downloading resource
CN102456048A (en) Method and system for processing mass data
WO2023138058A1 (en) Alarm event processing method and apparatus, and computer-readable storage medium
EP1386245B1 (en) System and method for filtering messages based on context
EP2776941B1 (en) Managing capacity in a data center by suspending tenants
CN111352746B (en) Message flow limiting method and storage medium
CN109471989A (en) A kind of page request processing method and relevant apparatus
CN115718732A (en) Disk file management method, device, equipment and storage medium
CN115562840A (en) Task processing method, device and medium
JP2023530996A (en) Cluster capacity reduction/expansion method and system, capacity reduction/expansion control terminal, and medium
CN110750217A (en) Information management method and related device
JP2011065469A (en) Distributed file system and node start-up method in distributed file system
JPH06243011A (en) Automatic maintenance system for data base
CN111158899A (en) Data acquisition method, data acquisition device, task management center and task management system
CN111143037B (en) Virtual machine resource allocation method, device, system and storage medium
CN116069737A (en) Automatic log space recovery method, system, device and medium

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