CN117591486A - File processing method, device, equipment and readable storage medium - Google Patents

File processing method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN117591486A
CN117591486A CN202311620042.0A CN202311620042A CN117591486A CN 117591486 A CN117591486 A CN 117591486A CN 202311620042 A CN202311620042 A CN 202311620042A CN 117591486 A CN117591486 A CN 117591486A
Authority
CN
China
Prior art keywords
file
large file
space
local
migration
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
CN202311620042.0A
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.)
Inspur Computer Technology Co Ltd
Original Assignee
Inspur Computer 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 Inspur Computer Technology Co Ltd filed Critical Inspur Computer Technology Co Ltd
Priority to CN202311620042.0A priority Critical patent/CN117591486A/en
Publication of CN117591486A publication Critical patent/CN117591486A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a file processing method, a device, equipment and a readable storage medium in the technical field of computer application, wherein the method comprises the following steps: inquiring a catalog in an open system to obtain a large file occupying disk space; under the condition that the occupancy rate of the local space reaches a migration threshold value, building shared service equipment in a local area network to which the local space belongs; mounting the local machine on the sharing service equipment; after uploading the large file to the sharing service equipment, deleting the large file in the local machine; the large file is accessed through the shared service device. The technical effects of this application: the occupation of the large file in the local machine to the space can be reduced by migrating the large file to the shared service equipment, and meanwhile, the large file can be ensured to be still in an accessible state.

Description

File processing method, device, equipment and readable storage medium
Technical Field
The present disclosure relates to the field of computer applications, and in particular, to a method, an apparatus, a device, and a readable storage medium for processing a file.
Background
With an Open System (OS), a root partition cannot face multiple concurrent operations, and the root partition is exploded, so that subsequent operations cannot continue, and thus, a plurality of continuous popup window alarms indicating that the partition is full are generated, and even the System cannot be accessed.
Currently, for the problem that the space is full and cannot continue to operate, a common processing method is to kill/shutdown (kill) related processes or delete related files to release the space. However, often after these operations, space is still occupied and viewing resources are not freed.
In summary, how to effectively solve the problems of disk space management and the like is a technical problem that needs to be solved by those skilled in the art at present.
Disclosure of Invention
The purpose of the application is to provide a file processing method, a device, equipment and a readable storage medium, which can effectively reduce the occupation of disk space by migrating large files, thereby ensuring the normal operation of a system.
In order to solve the technical problems, the application provides the following technical scheme:
a document processing method, comprising:
inquiring a catalog in an open system to obtain a large file occupying disk space; the open system is an operating system developed based on a Linux open source kernel;
under the condition that the occupancy rate of the local space reaches a migration threshold value, building shared service equipment in a local area network to which the local space belongs;
mounting a local machine on the shared service equipment;
after uploading the large file to the sharing service equipment, deleting the large file in the local machine;
And accessing the large file through the sharing service equipment.
Preferably, the querying the directory in the open system to obtain a large file occupying the disk space includes:
acquiring the size of the space occupied by the catalogue, and determining the depth of the catalogue based on the size of the occupied space;
inquiring the catalogue by using a text searching tool based on the catalogue depth to obtain the large file;
wherein the large file occupies disk space in gigabytes or terabytes.
Preferably, the method further comprises:
and (5) migrating the files in the boot/root directory to the home directory or the opt directory at regular time.
Preferably, the method further comprises:
obtaining an abnormal log file from a var/log/directory and a kernel log record file with vmcore and/or dump as suffixes;
determining a process corresponding to the abnormal log file as a first abnormal process;
determining a second abnormal process based on the kernel log file;
and under the condition that the local storage space gives an alarm, terminating the first abnormal process and/or the second abnormal process.
Preferably, the method further comprises:
the ratio of reserved space of the root directory is modified to expand the available space of the root directory.
Preferably, after uploading the large file to the shared service device, deleting the large file in the local machine includes:
uploading the large file to the sharing service equipment, and acquiring a storage address of the large file in the sharing service equipment;
after the storage address of the large file in the local machine is obtained, deleting the large file in the local machine;
determining the storage address of the large file in the local as a source address;
determining a storage address of the large file in the shared service equipment as a destination address;
recording the source address, the destination address and the migration time in a file record;
accordingly, accessing the large file through the shared service device includes:
receiving an access request of the large file, and inquiring the destination address from the file record based on the source address;
accessing the large file stored in the shared service device based on the destination address;
further comprises:
receiving a file migration viewing request;
reading the source address, the destination address and the migration time from the file record;
determining a migration path of the large file based on the source address, the destination address and the migration time;
Outputting the migration path; and the migration path is used for sorting all the storage addresses based on the migration time.
Preferably, the method further comprises:
monitoring the occupancy rate of the catalogue;
and after the occupancy rate of the target directory reaches the alarm threshold, sending a space alarm popup window related to the target directory to equipment in the local area network.
A document processing apparatus comprising:
the file inquiry module is used for inquiring the catalogue in the open system to obtain a large file occupying the disk space; the open system is an operating system developed based on a Linux open source kernel;
the sharing construction module is used for constructing sharing service equipment in a local area network to which the local machine belongs under the condition that the occupancy rate of the local space reaches a migration threshold value;
the device mounting module is used for mounting the local machine on the shared service device;
the file migration module is used for deleting the large file in the local machine after uploading the large file to the sharing service equipment;
and the file access module is used for accessing the large file through the sharing service equipment.
An electronic device, comprising:
a memory for storing a computer program;
And the processor is used for realizing the steps of the file processing method when executing the computer program.
A readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above-described file processing method.
By applying the method provided by the embodiment of the application, the catalogue in the open system is inquired to obtain a large file occupying the disk space; the open system is an operating system developed based on a Linux open source kernel; under the condition that the occupancy rate of the local space reaches a migration threshold value, building shared service equipment in a local area network to which the local space belongs; mounting the local machine on the sharing service equipment; after uploading the large file to the sharing service equipment, deleting the large file in the local machine; the large file is accessed through the shared service device.
By inquiring the catalogue of the domestic operating system, the large file occupying the disk space can be definitely obtained. Under the condition that the occupancy rate of the local space reaches the migration threshold value, shared service equipment can be built in a local area network to which the local space belongs. The native machine is then mounted on the shared service device. And deleting the large file in the local machine after uploading the large file to the sharing server, so that occupation of the large file to the local space is relieved. In addition, since the shared service device is in a local area network with the local machine and the local machine is mounted on the shared service device, the large file can be accessed through the shared service device. That is, the technical effect of the present application is: the occupation of the large file in the local machine to the space can be reduced by migrating the large file to the shared service equipment, and meanwhile, the large file can be ensured to be still in an accessible state.
Accordingly, the embodiments of the present application further provide a file processing apparatus, a device, and a readable storage medium corresponding to the above file processing method, which have the above technical effects, and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for a person having ordinary skill in the art.
FIG. 1 is a flowchart illustrating an implementation of a method for processing a file according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a document processing apparatus according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
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. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
Referring to fig. 1, fig. 1 is a flowchart of a file processing method in an embodiment of the present application, where the method may be applied to a computer of an OS system, and the method includes the following steps:
s101, inquiring the catalogue in the open system to obtain a large file occupying the disk space.
The open system is an operating system developed based on a Linux open source kernel.
In practical applications, the open system may be embodied as a domestic operating system. For example, the home-made system is specifically any one of home-made operation systems such as openEuler (euler), deep (deep), UOS (unified trust), kylin (kylin), eukylin (UbuntuKylin), red flag Linux, winning kylin (NeoKylin), galaxy kylin (KylinOS), praline operation system, midget, kylin letter an, emerging new fulcrum, long Xi (Anolis OS), jingas, loonggnix (longgnix), tencent cloud (Tencetoserver), congeal rock safe operation system, and the like.
It should be noted that, taking the non-native operating system as the windows operating system as an example, the differences between the native operating system and the non-native operating system include, but are not limited to, the following differences:
1. use of partition more detail: the division with windows system is C, D disc, various installation and use are centralized, when linux is used, division and use of various partitions of the system disc are subdivided, different purposes are divided into different divisions, and the phenomenon of insufficient disk space in the text is more convenient to locate and process in daily use.
2. Space of open source environment: because the linux system is open-source, the domestic system developed by using the linux system as the kernel is rapidly developed, and the compatibility is very high by combining the current domestic hardware and the high-speed development of corresponding configuration, while the windows system is closed-source, and different configurations can be used by the user with independent licenses.
3. And (3) a kernel: the domestic kernel is a micro operating system and consists of a plurality of modules, and each module is relatively independent. This allows the user the freedom to choose to install core modules and other modules to meet their particular needs. The Windows kernel is a huge monomer that contains many different modules, which makes the Windows operating system more resource-intensive.
4. Efficiency is that: domestic linux can be selectively installed and because its operating system kernel is relatively small, typically the contained components will be more efficient than Windows. Because many of the components contained in Windows are interactive with one another that may not be required by the user.
5. Safety: the domestic system has better safety than Windows, and the Linux kernel has a hierarchical access control, so the access rights of the related files and data are more strict, and the safety is higher.
In the embodiment of the application, the catalogue in the open system can be queried, so that a large file occupying the disk space is obtained.
The directory to be queried may be any one or more directories in the open system.
For directories in an open system, include, but are not limited to, the following:
root directory;
boot is used for starting the partition, guiding static files required by the system and storing kernel source codes of Linux;
the home, i.e. the home directory of the user;
tmp, storing temporary files;
usr, application catalog;
var, storing log files;
after starting up service, storing catalog of data needed to be taken by these services;
opt for storing an optional installation file;
swap, switching partitions;
the/var/log, the system log records the partition;
and/bin, storing programs, wherein the programs can be directly called by commands without entering a folder in which the programs are located.
Dev, storing all device files;
etc. store configuration files;
Efi/boot/Efi, this partition must exist when the firmware mode is uefi.
In the embodiment of the application, the judging threshold value of the large file can be set, so that when the directory is inquired, the file with the occupied space reaching the judging threshold value can be found out to serve as the large file.
For example, a file that occupies space in gigabytes or terabytes may be considered a large file. In the embodiment of the present application, no limitation is made on what type of large file itself is, and what purpose.
It should be noted that after determining the large file, in order to facilitate subsequent operations such as searching and migration, the searched large file may be recorded, for example, the directory where the large file is located, the name of the large file, and information such as the type of the large file may be recorded.
In one specific embodiment of the present application, querying a directory in an open system to obtain a large file occupying disk space includes:
acquiring the size of the space occupied by the catalogue, and determining the depth of the catalogue based on the size of the space occupied by the catalogue;
inquiring the catalogue by using a text searching tool based on the catalogue depth to obtain a large file;
wherein, the large file occupies disk space in gigabytes or terabytes.
That is, firstly, the size of the space occupied by the directory can be obtained, the depth of the directory is determined based on the size of the space occupied, the text search tool is utilized to search the directory based on the depth of the directory, and large files occupying disk space in units of G (precursor bytes) or T (terabytes) can be screened out. After the large files are found, the large files can be ordered so as to preferentially process files with larger occupied space when the large files are migrated. The large file occupying the space can be queried through find, and collection records can be made.
S102, under the condition that the occupancy rate of the local space reaches a migration threshold value, building sharing service equipment in a local area network to which the local space belongs.
In practical application, a migration threshold can be set for the whole machine, and different migration thresholds can be set for different catalogs respectively. For example, the overall migration threshold may be 50%, that is, when the local space occupancy reaches 50%, the migration of the large file in the local to the shared service device may begin.
When the occupancy rate of the local space reaches the migration threshold, a sharing service device, such as a sharing server, can be built in the local area network to which the local space belongs.
It should be noted that, when the occupancy rate of the local space reaches the migration threshold again and the local space is already mounted on one shared service device, the step S104 may be directly skipped without setting up the shared service device again.
The shared service equipment is built in the local area network to which the local machine belongs, so that the local machine can be ensured to continuously access the large file migrated to the shared service equipment.
For example, a machine configuration https (Hyper Text Transfer Protocol over Secure Socket Layer, hypertext transfer security protocol)/nfts/ftp (File Transfer Protocol ) can be set up to share the service device and perform necessary configuration on the service.
S103, mounting the local machine on the sharing service equipment.
In which a mount (mount) is a process by which an operating system makes computer files and directories on a storage device, such as a hard disk, CD-ROM, or shared resource, accessible to users through the computer's file system.
In this embodiment, the local machine is mounted on the shared service device, so that the storage resource of the shared service device can be borrowed.
S104, after uploading the large file to the sharing service equipment, deleting the large file in the local machine.
After the local machine is mounted on the shared service equipment, the large file can be uploaded to the shared service equipment. After the uploading is determined to be finished, the large file in the local machine can be deleted, so that the space occupied by the large file in the local machine is released.
For example, if a certain directory reaches a migration threshold specifically set for the directory, the large file under the directory may be uploaded to the shared service device, and after the uploading is determined to be successful, the uploaded large file under the directory is deleted in the local device.
Considering that in some specific scenarios, some files can only function under a specific directory, a migration-prohibited file list may also be set, where a large file that cannot be migrated is recorded in a file name. Before uploading a large file to the sharing service device, it may be first determined whether the current large file is a file in the file name, if so, the large file is skipped, and if not, the large file is migrated. The file names, which are specific to the files, can be set and adjusted according to the requirements of practical applications, and are not listed here.
S105, accessing the large file through the sharing service device.
After the large file is uploaded to the shared service device, the large file may be accessed through the shared service device when there is an access request for the large file.
In a specific embodiment of the present application, files in the boot/root directory may also be migrated to the home directory or the opt directory at regular time. Wherein/root corresponds to the root user.
That is, considering that some files must be placed in the boot/root directory to be able to run effectively, files in the boot/root directory can be cleaned up periodically and can be migrated to the home directory or the opt directory.
In a specific embodiment of the present application, after uploading the large file to the shared service device, deleting the large file in the local machine includes:
uploading a large file to sharing service equipment, and acquiring a storage address of the large file in the sharing service equipment;
after the storage address of the large file in the local machine is obtained, deleting the large file in the local machine;
determining a storage address of a large file in a local machine as a source address;
determining a storage address of a large file in the shared service equipment as a destination address;
recording a source address, a destination address and migration time in a file record;
Accordingly, accessing the large file through the shared service device includes:
receiving an access request of a large file, and inquiring a destination address from a file record based on a source address;
accessing a large file stored in the shared service device based on the destination address;
further comprises:
receiving a file migration viewing request;
reading a source address, a destination address and migration time from a file record;
determining a migration path of the large file based on the source address, the destination address and the migration time;
outputting a migration path; the migration path is each storage address after sorting based on migration time.
For convenience of description, the above steps are described in combination.
In the embodiment of the application, the large file can be uploaded to the sharing service equipment, and the storage address of the large file in the sharing service equipment is acquired. Before deleting the large file in the local machine, the storage address of the large file in the local machine is acquired.
And determining a storage address of the large file in the local machine as a source address, determining a storage address of the large file in the shared service equipment as a destination address, and recording the source address, the destination address and the migration time in a file record. For example, in the file recording, for a large file a, recording may be performed in the following format, the file name-source address-migration time-destination address of the large file a. If the migration is performed again, the directory address of the last migration can be directly regarded as the source address of the current migration, and the current migration time and the destination address can be directly performed subsequently. Thus, by looking up the record information in the file record, the migration path of the large file and the current storage position can be clarified.
In addition, in the file record, migration reasons may also be saved, where migration reasons may be: the occupancy rate of the local space reaches a migration threshold, the occupancy rate of the directory space reaches the migration threshold, and the directory space is migrated at fixed time. When the migration reasons are stored, the storage can be identified by only adopting numerical numbers, for example, 1 is preset to identify that the local space occupancy rate reaches a migration threshold value, 2 is preset to identify that the space occupancy rate of the catalog to which the local space belongs reaches the migration threshold value, and 3 is preset to carry out the timed migration. Thus, the migration cause can be determined by querying the file record.
After migrating the large file to the shared service equipment, if an access request of the large file is received, inquiring a destination address from a file record based on a source address; i.e. the save address of the current moment of the large file is queried. Then, based on the save address, a large file stored in the shared service device is accessed.
In addition, a file migration view request may be received, and a source address, a destination address, and a migration time may be read from the file record. In order to facilitate the user to check, the migration path of the large file can be determined based on the source address, the destination address and the migration time, and the migration path is output; the migration path is each storage address after sorting based on migration time. For example, the migration path may be specifically: save address 1-save address 2-save address 3. That is, based on the migration path, it can be seen that the large file undergoes 2 migration, the first migration is from save address 1 to save address 2, and the second migration is from save address 2 to save address 3.
By applying the method provided by the embodiment of the application, the catalogue in the open system is inquired to obtain a large file occupying the disk space; the open system is an operating system developed based on a Linux open source kernel; the method comprises the steps of carrying out a first treatment on the surface of the Under the condition that the occupancy rate of the local space reaches a migration threshold value, building shared service equipment in a local area network to which the local space belongs; mounting the local machine on the sharing service equipment; after uploading the large file to the sharing service equipment, deleting the large file in the local machine; the large file is accessed through the shared service device.
By inquiring the catalogue in the domestic system, the large file occupying the disk space can be definitely obtained. Under the condition that the occupancy rate of the local space reaches the migration threshold value, shared service equipment can be built in a local area network to which the local space belongs. The native machine is then mounted on the shared service device. And deleting the large file in the local machine after uploading the large file to the sharing server, so that occupation of the large file to the local space is relieved. In addition, since the shared service device is in a local area network with the local machine and the local machine is mounted on the shared service device, the large file can be accessed through the shared service device. That is, the technical effect of the present application is: the occupation of the large file in the local machine to the space can be reduced by migrating the large file to the shared service equipment, and meanwhile, the large file can be ensured to be still in an accessible state.
It should be noted that, based on the above embodiments, the embodiments of the present application further provide corresponding improvements. The preferred/improved embodiments relate to the same steps as those in the above embodiments or the steps corresponding to the steps may be referred to each other, and the corresponding advantages may also be referred to each other, so that detailed descriptions of the preferred/improved embodiments are omitted herein.
In a specific embodiment of the present application, an abnormal process may also be determined, and if the abnormal process needs to be closed, the abnormal process is terminated. The specific implementation process comprises the following steps:
obtaining an abnormal log file from a var/log/directory and a kernel log record file with vmcore and/or dump as suffixes;
determining a process corresponding to the abnormal log file as a first abnormal process;
determining a second abnormal process based on the kernel log file;
and under the condition that the local storage space gives an alarm, terminating the first abnormal process and/or the second abnormal process.
For convenience of description, the above steps are described in combination.
Various log files are stored under the var/log/directory, the size of the space occupied by each directory can be queried by using du-hs, the depth of the queried directory is set by using du-h-max-depth=2|grep [ GT ] |sort-nr, and the files under the var/log/directory can be traversed by filtering grep (text searching tool, performing row-by-row matching check on target text according to specified filtering conditions). Finding out the kernel log file with vmcore, dump, etc. as the suffix and the exception log file of the exception log.
Since the exception log file is related information corresponding to when the recording process is abnormal, the process corresponding to the exception log file can be directly determined as the first abnormal process.
And analyzing and processing the kernel log file so as to determine a second abnormal process.
In the embodiment of the application, the first abnormal process and the second abnormal process are not distinguished in sequence, and only used for distinguishing the first abnormal process from the second abnormal process, the first abnormal process and the second abnormal process are abnormal processes determined from different log files.
After determining the abnormal process, the first abnormal process and/or the second abnormal process can be terminated under the condition that the local storage space gives an alarm. Only the first abnormal process can be performed through kill, the second abnormal process can be performed through kill, and both the first abnormal process and the second abnormal process can be performed through kill. And may be specific to the particular situation of the alarm. For example, if the alarm is a normal alarm, only the kill first abnormal process may be executed; when the alarm is an emergency alarm, both can be kill. Of course, which abnormal processes of kill can be determined according to the corresponding relation between the specific source of the alarm and the abnormal processes.
In one embodiment of the present application, the ratio of reserved space of the root directory may also be modified to expand the available space of the root directory.
In a security policy of the Linux file system, 5% of disk space is reserved for root users by default and reserved for emergency use. In the embodiment, the ratio of reserved space of the root partition can be modified through tune2fs-m 1/dev/sdxx, so that the consumed space can be spitted out by the security policy. To ensure that the occupancy rate of the root partition is low, so that the root partition operates normally actively under the system.
In one specific embodiment of the present application, performing spatial monitoring includes:
monitoring the occupancy rate of each directory;
and after the occupancy rate of the target directory reaches the alarm threshold, sending a space alarm popup window related to the target directory to equipment in the local area network.
Illustrating: and when the environment is built, disk inquiry is carried out. Specifically, the space can be manually or automatically allocated to the partitions such as boot, efi, home, swap, opt and the like in the installation of the operating system, the partition size of the automatic partition is relatively fixed, the root partition is generally 15G, and the size of each partition can be properly adjusted by the manual partition. After the environment is installed, all hard disk models, capacity, equipment numbers and other configuration information of the environment are collected and operated in the next step through lsblk, storcli, nvmecli, lsscsi and other commands under the os system.
And for information viewing of each partition, the df-a command can be used for viewing corresponding file system information, the df-Hl command can be used for viewing the utilization rate, the idle rate, the type, the space size and other information of the partition, the fdisk-l command can be used for viewing system partition information, the blkid command can be used for viewing the partition or the file system type of the partition, and the shared-l command can be used for viewing the file system type, so that the utilization rate, the idle rate, the space size, the file system type, the equipment number and other information of each partition can be collected.
Wherein the commands and related terms are described as follows:
lsblk: information listing all available block devices, and also displaying dependencies between them;
the store li: the method can be used for inquiring and setting the related information of the bloc raid card;
nvmecli: related operations such as inquiring and setting the nvme disk;
lsscsi: inquiring raid card information and information of all virtual disks and CD-ROM;
df-a: mainly checking the occupation condition of a file system disk;
fdisk-l: checking the partition condition of the disk;
fdisk: the method is used for partitioning the disk;
blkid: checking the global single identification code of the equipment;
du-hs: du is mainly to check the occupation condition of disk space, and count the size of the catalog or file;
grep: the text searching tool performs row-by-row matching check on the target text according to the filtering condition specified by the user;
var/log/: the log under the path records various file logs;
vmcore: the kernel dump file records the state information of the kernel when the system crashes, including memory images, register states, stack information and the like. It can be used to analyze the cause of a system crash;
dump: when the program generates an abnormality, the program state information is used for recording the current program state information;
partial-l: the partition lists the partition table type and partition information of the disk.
The same local area network is constructed, the collected information is screened in daily activities, when the space occupancy rate of the partition reaches 20%, early warning is realized, mail warning is sent to related personnel through time intervals (such as 1 hour, 2 hours, 4 hours and other time segments), and a popup window is sent to equipment of the same local area network to display the current space utilization rate of the local area network and the partition of the current maximum space so as to facilitate the next operation.
In order to facilitate a person skilled in the art to better understand and implement the file processing method provided in the embodiments of the present application, the file processing method is described in detail below with reference to a specific application scenario as an example.
After the OS system is installed, disk polling, disk monitoring, space alarming, oversized abnormal file detection and inquiry, file processing and file recording can be executed.
The disk polling is performed, the partitions such as boot, efi, home, swap, opt and the like are manually or automatically allocated in the installation operation system, the partition size of the automatic partition is relatively fixed, the root partition is generally 15G, and the size of each partition can be properly adjusted by the manual partition. After the environment is installed, all hard disk models, capacity, equipment numbers and other configuration information of the environment are collected and operated in the next step through lsblk, storcli, nvmecli, lsscsi and other commands under the os system.
And (3) magnetic disk monitoring: and for information viewing of each partition, the df-a command can be used for viewing corresponding file system information, the df-Hl command can be used for viewing the utilization rate, the idle rate, the type, the space size and other information of the partition, the fdisk-l command can be used for viewing system partition information, the blkid command can be used for viewing the partition or the file system type of the partition, and the shared-l command can be used for viewing the file system type, so that the utilization rate, the idle rate, the space size, the file system type, the equipment number and other information of each partition can be collected.
The space warning can be carried out, the same local area network can be constructed, the collected information is screened in daily activities, when the space occupancy rate of the partition reaches 20%, the early warning is realized, related personnel are warned through time-division mail, and a popup window is sent to equipment of the same local area network to display the current space utilization rate of the local machine and the partition of the current maximum space so as to facilitate the next operation.
The method can immediately use du-hs to inquire the space occupied by each directory after the space alarm is sent, use du-h-max-depth=2|grep [ GT ] |sort-nr to set the directory depth of the inquiry, filter through grep, traverse the var/log/lower files, the files taking vmcore, dump and the like as suffixes, the abnormal log and other files, screen out the large files taking G or T as units and sort, or inquire the files occupying space through find to collect records.
The file processing includes the following 3 processing modes.
1. And (3) moving the file under boot/root to the home or opt directory at fixed time.
2. When the local space exceeds 50%, a machine configuration https/nfts/ftp sharing service device is built in the local area network to which the local machine belongs, and necessary configuration is carried out on the service. The machine is mounted on an ftp server, and the file is uploaded to the ftp server, so that the occupancy rate of the root partition is guaranteed to be low.
3. After an alarm is sent, a kill process is started or the operation is deleted, and the space is released so as to avoid the problem that some Linux users cannot enter the system due to space explosion.
After the screened large file is uploaded and then is subjected to local deletion processing, a command is used for checking whether resources are not released, comparison information is used for checking occupied and available space and comparing the occupied and available space with capacity, if the size is found to be not as large as the total capacity, the ratio of reserved space of a root partition can be modified through tune2fs-m 1/dev/sdxx, and the space consumed by a security policy can be discharged. The occupancy rate of the root partition is guaranteed to be low, so that normal active operation is performed under the system.
The selection of deleted files in case 3 is flexible and can continue processing or leave as records for viewing the next step depending on scene selection.
And recording files, namely recording all the files according to dates, classifying according to source addresses and destination addresses of the files, and recording the operation so as to meet the requirement of checking or backtracking some files later.
In practical application, the processing means can flexibly select one or more steps to perform operation processing, and can effectively solve the problem that the partition is exploded when the disk is used.
Corresponding to the above method embodiments, the embodiments of the present application further provide a document processing device, where the document processing device described below and the document processing method described above may be referred to correspondingly.
Referring to fig. 2, the apparatus includes the following modules:
a file inquiry module 101, configured to inquire a directory in an open system to obtain a large file occupying a disk space; the open system is an operating system developed based on a Linux open source kernel;
the sharing construction module 102 is configured to construct a sharing service device in a local area network to which the local area network belongs, when the occupancy rate of the local space reaches a migration threshold;
a device mounting module 103, configured to mount a local device on a shared service device;
the file migration module 104 is configured to delete the large file in the local machine after uploading the large file to the shared service device;
a file access module 105, configured to access a large file through the shared service device.
By applying the device provided by the embodiment of the application, the catalogue in the open system is inquired to obtain a large file occupying the disk space; the open system is an operating system developed based on a Linux open source kernel; under the condition that the occupancy rate of the local space reaches a migration threshold value, building shared service equipment in a local area network to which the local space belongs; mounting the local machine on the sharing service equipment; after uploading the large file to the sharing service equipment, deleting the large file in the local machine; the large file is accessed through the shared service device.
By inquiring the catalogue in the domestic operating system, the large file occupying the disk space can be definitely obtained. Under the condition that the occupancy rate of the local space reaches the migration threshold value, shared service equipment can be built in a local area network to which the local space belongs. The native machine is then mounted on the shared service device. And deleting the large file in the local machine after uploading the large file to the sharing server, so that occupation of the large file to the local space is relieved. In addition, since the shared service device is in a local area network with the local machine and the local machine is mounted on the shared service device, the large file can be accessed through the shared service device. That is, the technical effect of the present application is: the occupation of the large file in the local machine to the space can be reduced by migrating the large file to the shared service equipment, and meanwhile, the large file can be ensured to be still in an accessible state.
In a specific embodiment of the present application, further comprising:
the abnormal process processing module is used for acquiring an abnormal log file from the var/log/catalog and recording the log file by a kernel taking vmcore and/or dump as a suffix; determining a process corresponding to the abnormal log file as a first abnormal process; determining a second abnormal process based on the kernel log file; and under the condition that the local storage space gives an alarm, terminating the first abnormal process and/or the second abnormal process.
In a specific embodiment of the present application, the file migration module is further configured to migrate the file in the boot/root directory to the home directory or the opt directory at regular time.
In one specific embodiment of the present application, the file query module is specifically configured to obtain a size of a space occupied by the directory, and determine a depth of the directory based on the size of the space occupied; inquiring the catalogue by using a text searching tool based on the catalogue depth to obtain a large file; wherein, the large file occupies disk space in gigabytes or terabytes.
In a specific embodiment of the present application, further comprising:
and the reserved space adjusting module is used for modifying the reserved space proportion of the root directory so as to enlarge the usable space of the root directory.
In a specific embodiment of the present application, the file migration module is specifically configured to upload a large file to the shared service device, and obtain a storage address of the large file in the shared service device;
after the storage address of the large file in the local machine is obtained, deleting the large file in the local machine;
determining a storage address of a large file in a local machine as a source address;
determining a storage address of a large file in the shared service equipment as a destination address;
Recording a source address, a destination address and migration time in a file record;
correspondingly, the file access module is specifically used for receiving an access request of a large file, and inquiring a destination address from a file record based on a source address; accessing a large file stored in the shared service device based on the destination address;
further comprises: the file access module is used for receiving a file migration viewing request; reading a source address, a destination address and migration time from a file record; determining a migration path of the large file based on the source address, the destination address and the migration time; outputting a migration path; the migration path is each storage address after sorting based on migration time.
In a specific embodiment of the present application, further comprising:
the space alarm module is used for monitoring the occupancy rate of the catalogue; and after the occupancy rate of the target directory reaches the alarm threshold, sending a space alarm popup window related to the target directory to equipment in the local area network.
Corresponding to the above method embodiment, the embodiment of the present application further provides an electronic device, where an electronic device described below and a file processing method described above may be referred to correspondingly.
Referring to fig. 3, the electronic device includes:
a memory 332 for storing a computer program;
a processor 322 for implementing the steps of the file processing method of the above-described method embodiment when executing a computer program.
Specifically, referring to fig. 4, fig. 4 is a schematic diagram of a specific structure of an electronic device according to the present embodiment, where the electronic device may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (e.g., one or more processors) and a memory 332, where the memory 332 stores one or more computer programs 342 or data 344. Wherein the memory 332 may be transient storage or persistent storage. The program stored in memory 332 may include one or more modules (not shown), each of which may include a series of instruction operations in the data processing apparatus. Still further, the processor 322 may be configured to communicate with the memory 332 and execute a series of instruction operations in the memory 332 on the electronic device 301.
The electronic device 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input/output interfaces 358, and/or one or more operating systems 341.
The steps in the file processing method described above may be implemented by the structure of the electronic device.
Corresponding to the above method embodiments, the embodiments of the present application further provide a readable storage medium, where a readable storage medium described below and a file processing method described above may be referred to correspondingly.
A readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the file processing method of the above method embodiments.
The readable storage medium may be a usb 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, and the like.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. 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.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Those skilled in the art may implement the described functionality using different approaches for each particular application, but such implementation should not be considered to be beyond the scope of this application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that, in this document, 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 include, comprise, or any other variation is 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.
The principles and embodiments of the present application are described herein with specific examples, the above examples being provided only to assist in understanding the methods of the present application and their core ideas; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A document processing method, comprising:
Inquiring a catalog in an open system to obtain a large file occupying disk space; the open system is an operating system developed based on a Linux open source kernel;
under the condition that the occupancy rate of the local space reaches a migration threshold value, building shared service equipment in a local area network to which the local space belongs;
mounting a local machine on the shared service equipment;
after uploading the large file to the sharing service equipment, deleting the large file in the local machine;
and accessing the large file through the sharing service equipment.
2. The method of claim 1, wherein querying the directory in the open system for a large file occupying disk space comprises:
acquiring the size of the space occupied by the catalogue, and determining the depth of the catalogue based on the size of the occupied space;
inquiring the catalogue by using a text searching tool based on the catalogue depth to obtain the large file;
wherein the large file occupies disk space in gigabytes or terabytes.
3. The method as recited in claim 1, further comprising:
and (5) migrating the files in the boot/root directory to the home directory or the opt directory at regular time.
4. The method as recited in claim 1, further comprising:
obtaining an abnormal log file from a var/log/directory and a kernel log record file with vmcore and/or dump as suffixes;
determining a process corresponding to the abnormal log file as a first abnormal process;
determining a second abnormal process based on the kernel log file;
and under the condition that the local storage space gives an alarm, terminating the first abnormal process and/or the second abnormal process.
5. The method as recited in claim 1, further comprising:
the ratio of reserved space of the root directory is modified to expand the available space of the root directory.
6. The method of claim 1, wherein deleting the large file in the local machine after uploading the large file to the shared service device comprises:
uploading the large file to the sharing service equipment, and acquiring a storage address of the large file in the sharing service equipment;
after the storage address of the large file in the local machine is obtained, deleting the large file in the local machine;
determining the storage address of the large file in the local as a source address;
Determining a storage address of the large file in the shared service equipment as a destination address;
recording the source address, the destination address and the migration time in a file record;
accordingly, accessing the large file through the shared service device includes:
receiving an access request of the large file, and inquiring the destination address from the file record based on the source address;
accessing the large file stored in the shared service device based on the destination address;
further comprises:
receiving a file migration viewing request;
reading the source address, the destination address and the migration time from the file record;
determining a migration path of the large file based on the source address, the destination address and the migration time;
outputting the migration path; and the migration path is used for sorting all the storage addresses based on the migration time.
7. The method according to any one of claims 1 to 6, further comprising:
monitoring the occupancy rate of the catalogue;
and after the occupancy rate of the target directory reaches the alarm threshold, sending a space alarm popup window related to the target directory to equipment in the local area network.
8. A document processing apparatus, comprising:
the file inquiry module is used for inquiring the catalogue in the open system to obtain a large file occupying the disk space; the open system is an operating system developed based on a Linux open source kernel;
the sharing construction module is used for constructing sharing service equipment in a local area network to which the local machine belongs under the condition that the occupancy rate of the local space reaches a migration threshold value;
the device mounting module is used for mounting the local machine on the shared service device;
the file migration module is used for deleting the large file in the local machine after uploading the large file to the sharing service equipment;
and the file access module is used for accessing the large file through the sharing service equipment.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the file processing method according to any one of claims 1 to 7 when executing said computer program.
10. A readable storage medium, characterized in that the readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the file processing method according to any of claims 1 to 7.
CN202311620042.0A 2023-11-29 2023-11-29 File processing method, device, equipment and readable storage medium Pending CN117591486A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311620042.0A CN117591486A (en) 2023-11-29 2023-11-29 File processing method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311620042.0A CN117591486A (en) 2023-11-29 2023-11-29 File processing method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN117591486A true CN117591486A (en) 2024-02-23

Family

ID=89914812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311620042.0A Pending CN117591486A (en) 2023-11-29 2023-11-29 File processing method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN117591486A (en)

Similar Documents

Publication Publication Date Title
US8756199B2 (en) File level hierarchical storage management system, method, and apparatus
EP3069274B1 (en) Managed service for acquisition, storage and consumption of large-scale data streams
US9276959B2 (en) Client-configurable security options for data streams
US9858322B2 (en) Data stream ingestion and persistence techniques
US10158743B2 (en) Compute node cluster management
US20070180087A1 (en) Computer allocation method
CN112346829B (en) Method and equipment for task scheduling
US9021204B1 (en) Techniques for managing data storage
US20100211949A1 (en) Management computer and processing management method
US20080201474A1 (en) Computer system
CN110825694A (en) Data processing method, device, equipment and storage medium
US8589441B1 (en) Information processing system and method for controlling the same
CN113485999A (en) Data cleaning method and device and server
CN112306802A (en) Data acquisition method, device, medium and electronic equipment of system
CN111125171A (en) Monitoring data access method, device, equipment and readable storage medium
EP4231602A1 (en) Method and apparatus for acquiring private cloud container cluster gene information
GB2497172A (en) Reserving space on a storage device for new data based on predicted changes in access frequencies of storage devices
US7970882B2 (en) Management apparatus and management method
CN106708865B (en) Method and device for accessing window data in stream processing system
US10275738B1 (en) Techniques for handling device inventories
US10140187B1 (en) Techniques for system backup
CN117591486A (en) File processing method, device, equipment and readable storage medium
US9436697B1 (en) Techniques for managing deduplication of data
CN115604294A (en) Method and device for managing storage resources
US9946559B1 (en) Techniques for managing virtual machine backups

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