Movatterモバイル変換


[0]ホーム

URL:


CN115407940A - Method and system for cleaning and optimizing disk files - Google Patents

Method and system for cleaning and optimizing disk files
Download PDF

Info

Publication number
CN115407940A
CN115407940ACN202211027025.1ACN202211027025ACN115407940ACN 115407940 ACN115407940 ACN 115407940ACN 202211027025 ACN202211027025 ACN 202211027025ACN 115407940 ACN115407940 ACN 115407940A
Authority
CN
China
Prior art keywords
disk
file
virtual disk
folder
establishing
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
CN202211027025.1A
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.)
Fujian Tianqing Online Interactive Technology Co Ltd
Original Assignee
Fujian Tianqing Online Interactive 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 Fujian Tianqing Online Interactive Technology Co LtdfiledCriticalFujian Tianqing Online Interactive Technology Co Ltd
Priority to CN202211027025.1ApriorityCriticalpatent/CN115407940A/en
Publication of CN115407940ApublicationCriticalpatent/CN115407940A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明提供了一种磁盘文件清理优化的方法及其系统,所述方法包括如下步骤:步骤S1、磁盘首次进行清理时,要对整个磁盘进行扫描,扫描缓存文件夹、垃圾文件;步骤S2、建立虚拟磁盘;步骤S3、将缓存文件夹通过软连接方式迁移到虚拟磁盘中;步骤S4、快速清理虚拟磁盘,从而对磁盘文件进行清理;可以快速地对磁盘进行清理,提高清理效率。

Figure 202211027025

The present invention provides a method and system for cleaning and optimizing disk files. The method includes the following steps: step S1, when cleaning the disk for the first time, scan the entire disk, scan cache folders and garbage files; step S2, Create a virtual disk; step S3, migrate the cache folder to the virtual disk through a soft link; step S4, quickly clean up the virtual disk, thereby cleaning up disk files; the disk can be quickly cleaned up to improve cleaning efficiency.

Figure 202211027025

Description

Translated fromChinese
一种磁盘文件清理优化的方法及其系统Method and system for cleaning and optimizing disk files

技术领域technical field

本发明涉及磁盘清理技术领域,特别是一种磁盘文件清理优化的方法及其系统。The invention relates to the technical field of disk cleaning, in particular to a method and system for cleaning and optimizing disk files.

背景技术Background technique

目前磁盘文件清理,经常有很多小文件清理需要大量时间对文件进行扫描,清理速度慢。现有技术是通过对所有文件进行扫描,扫描到后,将扫描到的垃圾文件逐个进行清理,因为大部分垃圾文件都是数量多的小文件,而机械磁盘是连续读写比较快,随机读写比较慢,小文件无法快速连续读写。本发方案通过软连接把垃圾文件存储在虚拟磁盘中,从而可以利用连续读写一下子把文件清理。At present, disk file cleaning often requires a lot of time to scan files for many small files, and the cleaning speed is slow. The existing technology is to scan all the files, and after scanning, clean up the scanned junk files one by one, because most of the junk files are small files with a large number, and the mechanical disk is relatively fast in continuous read and write, random read Writing is relatively slow, and small files cannot be read and written in rapid succession. The solution of the present invention stores the garbage files in the virtual disk through the soft connection, so that the files can be cleaned up at once by continuous reading and writing.

发明内容Contents of the invention

为克服上述问题,本发明的目的是提供一种磁盘文件清理优化的方法,通过软连接把垃圾文件存储在虚拟磁盘中,利用连续读写一下子把文件清理。In order to overcome the above problems, the object of the present invention is to provide a method for cleaning and optimizing disk files, which stores garbage files in virtual disks through soft connections, and uses continuous reading and writing to clean up files at once.

本发明采用以下方案实现:一种磁盘文件清理优化的方法,所述方法包括如下步骤:The present invention is realized by adopting the following scheme: a method for cleaning and optimizing disk files, said method comprising the following steps:

步骤S1、磁盘首次进行清理时,要对整个磁盘进行扫描,扫描缓存文件夹、垃圾文件;Step S1, when the disk is cleaned up for the first time, the entire disk should be scanned, including cache folders and junk files;

步骤S2、建立虚拟磁盘;Step S2, creating a virtual disk;

步骤S3、将缓存文件夹通过软连接方式迁移到虚拟磁盘中;Step S3, migrating the cache folder to the virtual disk through a soft link;

步骤S4、快速清理虚拟磁盘,从而对磁盘文件进行清理。Step S4, quickly clean up the virtual disk, so as to clean up the disk files.

进一步的,所述步骤S2进一步具体为:建立固定虚拟磁盘1,将固定虚拟磁盘1挂载到盘符1;建立vhd虚拟磁盘文件2,通过windows挂载磁盘命令将虚拟磁盘文件2挂载到盘符2。Further, the step S2 is further specifically: establish a fixed virtual disk 1, mount the fixed virtual disk 1 to the drive letter 1; establish a vhd virtual disk file 2, and mount the virtual disk file 2 to the Drive letter 2.

进一步的,所述建立固定虚拟磁盘1,将固定虚拟磁盘1挂载到盘符1,具体为:建立固定虚拟磁盘1,固定虚拟磁盘1中的分块采用循环地址方式,将逻辑空间映射到盘符1固定空间内;当写入内容超过固定空间内地址,则自动覆盖之前的文件,这样无论垃圾文件怎么增加,都只会占用固定空间。Further, the establishment of the fixed virtual disk 1, and the mounting of the fixed virtual disk 1 to the drive letter 1, specifically: the establishment of the fixed virtual disk 1, the blocks in the fixed virtual disk 1 adopt a circular address method, and the logical space is mapped to In the fixed space of drive letter 1; when the written content exceeds the address in the fixed space, the previous file will be automatically overwritten, so that no matter how many junk files increase, it will only occupy the fixed space.

进一步的,所述步骤S3进一步具体为:记录并将缓存文件夹建立软连接映射到挂载盘符1下的文件夹;即记录缓存文件夹的路径,在盘符1下方建立除了盘符不同,路径与缓存文件夹的路径是相同的文件夹,将缓存文件夹的路径和盘符1下方建立的文件夹的路径进行软连接映射;Further, the step S3 is further specifically: recording and mapping the cache folder to the folder under the mounted drive letter 1 by establishing a soft link; , the path and the path of the cache folder are the same folder, and the path of the cache folder and the path of the folder established under drive letter 1 are soft-linked;

记录垃圾文件的上级文件夹,并将整个文件夹移动到盘符2的对应文件夹中,再将整个文件夹建立软连接指向盘符2中对应文件夹。Record the upper-level folder of the junk file, move the entire folder to the corresponding folder in drive letter 2, and then establish a soft link for the entire folder to point to the corresponding folder in drive letter 2.

进一步的,所述步骤S4进一步具体为:对固定虚拟磁盘无需清理,垃圾文件只会占用固定大小空间;根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。Further, the step S4 is further specifically: no need to clean up the fixed virtual disk, and the junk files will only occupy a fixed size space; according to the recorded junk file name, the junk files are deleted, and the non-junk file records are kept in the vhd virtual disk file 2 middle.

进一步的,所述步骤S2进一步具体为:建立vhd虚拟磁盘文件1,通过windows挂载磁盘命令将虚拟磁盘文件1挂载到盘符1;建立vhd虚拟磁盘文件2,通过windows挂载磁盘命令将虚拟磁盘文件2挂载到盘符2。Further, the step S2 is further specifically: set up a vhd virtual disk file 1, mount the virtual disk file 1 to the drive letter 1 by the windows mount disk command; set up the vhd virtual disk file 2, and mount the disk file by the windows mount disk command Virtual disk file 2 is mounted to drive letter 2.

进一步的,所述步骤S4进一步具体为:将vhd虚拟磁盘文件1直接格式化,并重新创建记录的缓存文件夹;根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。Further, the step S4 is further specifically: the vhd virtual disk file 1 is directly formatted, and the cache folder of the record is recreated; according to the recorded garbage file name, the garbage file is deleted, and the non-junk file records are kept in the vhd virtual disk. Disk file 2.

本发明还提供了一种磁盘文件清理优化的系统,所述系统包括:磁盘扫描模块、虚拟磁盘建立模块、迁移模块、以及清理模块;The present invention also provides a system for cleaning and optimizing disk files. The system includes: a disk scanning module, a virtual disk establishment module, a migration module, and a cleaning module;

所述磁盘扫描模块,在磁盘首次进行清理时,要对整个磁盘进行扫描,扫描缓存文件夹、垃圾文件;The disk scanning module, when the disk is cleaned up for the first time, will scan the entire disk, scan cache folders and junk files;

所述虚拟磁盘建立模块,建立虚拟磁盘;The virtual disk building module is used to create a virtual disk;

所述迁移模块,将缓存文件夹通过软连接方式迁移到虚拟磁盘中;The migration module migrates the cache folder to the virtual disk through a soft link;

所述清理模块,快速清理虚拟磁盘,从而对磁盘文件进行清理。The cleaning module quickly cleans up the virtual disk, thereby cleaning up the disk files.

进一步的,所述虚拟磁盘建立模块进一步具体为:建立固定虚拟磁盘1,将固定虚拟磁盘1挂载到盘符1;建立vhd虚拟磁盘文件2,通过windows挂载磁盘命令将虚拟磁盘文件2挂载到盘符2。Further, the virtual disk establishment module is further specifically: establishing a fixed virtual disk 1, mounting the fixed virtual disk 1 to the drive letter 1; establishing a vhd virtual disk file 2, and mounting the virtual disk file 2 through the windows mount disk command Load it to drive letter 2.

进一步的,所述建立固定虚拟磁盘1,将固定虚拟磁盘1挂载到盘符1,具体为:建立固定虚拟磁盘1,固定虚拟磁盘1中的分块采用循环地址方式,将逻辑空间映射到盘符1固定空间内;当写入内容超过固定空间内地址,则自动覆盖之前的文件,这样无论垃圾文件怎么增加,都只会占用固定空间。Further, the establishment of the fixed virtual disk 1, and the mounting of the fixed virtual disk 1 to the drive letter 1, specifically: the establishment of the fixed virtual disk 1, the blocks in the fixed virtual disk 1 adopt a circular address method, and the logical space is mapped to In the fixed space of drive letter 1; when the written content exceeds the address in the fixed space, the previous file will be automatically overwritten, so that no matter how many junk files increase, it will only occupy the fixed space.

进一步的,所述迁移模块进一步具体为:记录并将缓存文件夹建立软连接映射到挂载盘符1下的文件夹;即记录缓存文件夹的路径,在盘符1下方建立除了盘符不同,路径与缓存文件夹的路径是相同的文件夹,将缓存文件夹的路径和盘符1下方建立的文件夹的路径进行软连接映射;Further, the migration module is further specifically: recording and mapping the cache folder to establish a soft link to the folder under the mounted drive letter 1; , the path and the path of the cache folder are the same folder, and the path of the cache folder and the path of the folder established under drive letter 1 are soft-linked;

记录垃圾文件的上级文件夹,并将整个文件夹移动到盘符2的对应文件夹中,再将整个文件夹建立软连接指向盘符2中对应文件夹。Record the upper-level folder of the junk file, move the entire folder to the corresponding folder in drive letter 2, and then establish a soft link for the entire folder to point to the corresponding folder in drive letter 2.

进一步的,所述清理模块进一步具体为:对固定虚拟磁盘无需清理,垃圾文件只会占用固定大小空间;根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。Further, the cleaning module is further specifically: the fixed virtual disk does not need to be cleaned, and the junk files only occupy a fixed size space; according to the recorded junk file name, the junk files are deleted, and the non-junk file records are kept in the vhd virtual disk file 2 middle.

进一步的,所述虚拟磁盘建立模块进一步具体为:建立vhd虚拟磁盘文件1,通过windows挂载磁盘命令将虚拟磁盘文件1挂载到盘符1;建立vhd虚拟磁盘文件2,通过windows挂载磁盘命令将虚拟磁盘文件2挂载到盘符2。Further, the module for establishing the virtual disk is further specifically: establish a vhd virtual disk file 1, mount the virtual disk file 1 to drive letter 1 by a windows mount disk command; set up a vhd virtual disk file 2, and mount the disk by windows The command mounts virtual disk file 2 to drive letter 2.

进一步的,所述清理模块进一步具体为:将vhd虚拟磁盘文件1直接格式化,并重新创建记录的缓存文件夹;根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。Further, the cleaning module is further specifically: directly formatting the vhd virtual disk file 1, and recreating the recorded cache folder; according to the recorded garbage file name, the garbage file is deleted, and the non-junk file records are kept in the vhd virtual Disk file 2.

本发明的有益效果在于:本发明通过软连接把垃圾文件存储在虚拟磁盘中,利用连续读写一下子把文件清理。同时避免了清理垃圾时候要对整个磁盘进行扫描费时,可以做到秒清理垃圾,提高清理垃圾的效率。The beneficial effect of the present invention is that: the present invention stores garbage files in virtual disks through soft connections, and uses continuous reading and writing to clean up files at once. At the same time, it avoids the time-consuming scanning of the entire disk when cleaning up garbage, and can clean up garbage in seconds, improving the efficiency of cleaning up garbage.

附图说明Description of drawings

图1是本发明的方法流程示意图。Fig. 1 is a schematic flow chart of the method of the present invention.

图2是本发明的工作原理框图。Fig. 2 is a working principle block diagram of the present invention.

具体实施方式Detailed ways

下面结合附图对本发明做进一步说明。The present invention will be further described below in conjunction with the accompanying drawings.

请参阅图1所示,一种磁盘文件清理优化的方法,所述方法包括如下步骤:See also shown in Figure 1, a kind of method for disk file cleaning optimization, described method comprises the following steps:

步骤S1、磁盘首次进行清理时,要对整个磁盘进行扫描,扫描缓存文件夹、垃圾文件;Step S1, when the disk is cleaned up for the first time, the entire disk should be scanned, including cache folders and junk files;

步骤S2、建立虚拟磁盘;Step S2, creating a virtual disk;

步骤S3、将缓存文件夹通过软连接方式迁移到虚拟磁盘中;Step S3, migrating the cache folder to the virtual disk through a soft link;

步骤S4、快速清理虚拟磁盘,从而对磁盘文件进行清理。Step S4, quickly clean up the virtual disk, so as to clean up the disk files.

下面结合实施例对本发明做进一步说明:The present invention will be further described below in conjunction with embodiment:

实施例一:Embodiment one:

一种磁盘文件清理优化的方法,该方法为:1.第一次需要对整理磁盘进行扫描,扫描缓存文件夹,垃圾文件;A method for cleaning and optimizing disk files, the method is as follows: 1. It is necessary to scan the defragmentation disk for the first time, scanning cache folders and junk files;

2.建立虚拟磁盘2. Create a virtual disk

2.1.建立vhd虚拟磁盘文件1,将虚拟磁盘挂载到盘符12.1. Create vhd virtual disk file 1, mount the virtual disk to drive letter 1

例如把1.vhd文件挂载到E:\盘,然后通过E:\就可以访问到1.vhd虚拟磁盘中的文件;通过windows的api创建vhd虚拟磁盘文件1,For example, mount the 1.vhd file to the E:\ disk, and then access the files in the 1.vhd virtual disk through E:\; create a vhd virtual disk file 1 through the windows API,

2.2.建立vhd虚拟磁盘文件2,将虚拟磁盘挂载到盘符22.2. Create vhd virtual disk file 2, mount the virtual disk to drive letter 2

例如把2.vhd文件挂载到F:\盘,然后通过E:\就可以访问到2.vhd虚拟磁盘中的文件;For example, mount the 2.vhd file to the F:\ disk, and then access the files in the 2.vhd virtual disk through E:\;

3.将缓存文件夹通过软连接方式迁移到虚拟磁盘中,通过调用windows的api创建软链接;3. Migrate the cache folder to the virtual disk through a soft link, and create a soft link by calling the Windows API;

3.1.记录并将缓存文件夹建立软连接映射到挂载盘符1下的文件夹3.1. Record and map the cache folder to establish a soft connection to the folder under mount drive letter 1

缓存文件夹cache folder

D:\优酷\cacheD:\Youku\cache

在挂载1.vhd的E:\下也创建Also created under E:\ where 1.vhd is mounted

E:\优酷\cacheE:\Youku\cache

建立D:\优酷\cache文件夹软连接到E:\优酷\cacheCreate a soft link to the D:\Youku\cache folder to E:\Youku\cache

3.2.记录垃圾文件的上级文件夹,并将整个文件夹移动到盘符2的对应文件夹中,再将原来的文件夹建立软连接指向盘符2中对应文件夹。(该对应文件夹与垃圾文件的上级文件夹相比:除了盘符不同,路径是相同的;)3.2. Record the upper-level folder of the junk file, and move the entire folder to the corresponding folder in drive letter 2, and then establish a soft link to the original folder to point to the corresponding folder in drive letter 2. (The corresponding folder is compared with the upper-level folder of junk files: except for the different drive letters, the path is the same;)

比如有的软件垃圾文件没有独立文件夹For example, some software junk files do not have independent folders

D:\软件1\上级文件夹\软件.exeD:\software 1\superior folder\software.exe

D:\软件1\上级文件夹\软件.logD:\software 1\superior folder\software.log

其中.exe文件是有用的不能被清理,.log的文件是日志文件属于垃圾文件。Among them, .exe files are useful and cannot be cleaned up, and .log files are log files that belong to junk files.

所以,将D:\软件1\上级文件夹\移动到2.vhd虚拟磁盘对应挂载的F:\软件1\上级文件夹\Therefore, move D:\software 1\upper folder\ to F:\software 1\upper folder\ that is mounted corresponding to the 2.vhd virtual disk

然后建立D:\软件1\上级文件夹\软连接指向F:\软件1\上级文件夹\Then establish D:\software 1\superior folder\soft link pointing to F:\software 1\superior folder\

清理文件时候只清理过F:\软件1\上级文件夹\软件.logWhen cleaning files, only F:\software 1\superior folder\software.log is cleaned up

4.快速清理虚拟磁盘4. Quickly clean up the virtual disk

4.1vhd虚拟磁盘文件1直接格式化,并重新创建记录的缓存文件夹;4.1 Format the vhd virtual disk file 1 directly, and recreate the recorded cache folder;

直接把1.vhd对应的E盘格式化,然后,创建E:\优酷\cacheDirectly format the E disk corresponding to 1.vhd, and then create E:\Youku\cache

由于建立D:\优酷\cache文件夹软连接到E:\优酷\cache,所以,优酷在创建新缓存时候依然可以写入到E:\优酷\cache下,比如E:\优酷\cache\视频缓存1;Since the D:\Youku\cache folder is softly connected to E:\Youku\cache, Youku can still write to E:\Youku\cache when creating a new cache, such as E:\Youku\cache\Video cache1;

4.2根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。4.2 Delete the junk files according to the recorded junk file names, and keep the non-junk file records in the vhd virtual disk file 2.

然后建立D:\软件1\上级文件夹\软连接指向F:\软件1\上级文件夹\Then establish D:\software 1\superior folder\soft link pointing to F:\software 1\superior folder\

清理文件时候只清理过F:\软件1\上级文件夹\软件.logWhen cleaning files, only F:\software 1\superior folder\software.log is cleaned up

不删除F:\软件1\上级文件夹\软件.exe。F:\Software 1\upper folder\software.exe is not deleted.

实施例二:Embodiment two:

一种磁盘文件清理优化的方法,该方法为:1.第一次需要对整理磁盘进行扫描,扫描缓存文件夹,垃圾文件A method for cleaning and optimizing disk files, the method is as follows: 1. For the first time, it is necessary to scan the defragmentation disk, scan cache folders, and junk files

2.建立虚拟磁盘2. Create a virtual disk

2.1.建立固定虚拟磁盘1,将虚拟磁盘挂载到盘符1;2.1. Create a fixed virtual disk 1 and mount the virtual disk to drive letter 1;

2.1.1固定虚拟磁盘中的分块采用循环地址方式,将逻辑空间映射到固定空间内;2.1.1 The blocks in the fixed virtual disk adopt the circular address method to map the logical space to the fixed space;

2.1.2当写入内容超过固定空间内地址,则自动覆盖之前的文件。所以,无论垃圾文件怎么增加,都只会占用固定空间;2.1.2 When the written content exceeds the address in the fixed space, the previous file will be automatically overwritten. Therefore, no matter how many junk files increase, they will only occupy a fixed space;

2.2.建立vhd虚拟磁盘文件2,将虚拟磁盘挂载到盘符2;通过windows的api创建vhd虚拟磁盘文件2,2.2. Create vhd virtual disk file 2, mount the virtual disk to drive letter 2; create vhd virtual disk file 2 through windows api,

3.将缓存文件夹通过软连接方式迁移到虚拟磁盘中3. Migrate the cache folder to the virtual disk through a soft link

3.1.记录并将缓存文件夹建立软连接映射到挂载盘符1下的文件夹3.1. Record and map the cache folder to establish a soft connection to the folder under mount drive letter 1

3.2.记录垃圾文件的上级文件夹,并将整个文件夹移动到盘符2的对应文件夹中,再将原来的文件夹建立软连接指向盘符2中对应文件夹。3.2. Record the upper-level folder of the junk file, and move the entire folder to the corresponding folder in drive letter 2, and then establish a soft link to the original folder to point to the corresponding folder in drive letter 2.

4.快速清理虚拟磁盘4. Quickly clean up the virtual disk

4.1固定虚拟磁盘无需清理,只会占用固定大小空间;4.1 The fixed virtual disk does not need to be cleaned up, it will only occupy a fixed size space;

4.2根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。4.2 Delete the junk files according to the recorded junk file names, and keep the non-junk file records in the vhd virtual disk file 2.

请参阅图2所示,本发明还提供了一种磁盘文件清理优化的系统,所述系统包括:磁盘扫描模块、虚拟磁盘建立模块、迁移模块、以及清理模块;Referring to Fig. 2, the present invention also provides a system for cleaning and optimizing disk files, said system comprising: a disk scanning module, a virtual disk establishment module, a migration module, and a cleaning module;

所述磁盘扫描模块,在磁盘首次进行清理时,要对整个磁盘进行扫描,扫描缓存文件夹、垃圾文件;The disk scanning module, when the disk is cleaned up for the first time, will scan the entire disk, scan cache folders and junk files;

所述虚拟磁盘建立模块,建立虚拟磁盘;The virtual disk building module is used to create a virtual disk;

所述迁移模块,将缓存文件夹通过软连接方式迁移到虚拟磁盘中;The migration module migrates the cache folder to the virtual disk through a soft link;

所述清理模块,快速清理虚拟磁盘,从而对磁盘文件进行清理。The cleaning module quickly cleans up the virtual disk, thereby cleaning up the disk files.

实施例三:本发明的一种磁盘文件清理优化的系统,所述系统包括:磁盘扫描模块、虚拟磁盘建立模块、迁移模块、以及清理模块;Embodiment three: a system for cleaning and optimizing disk files of the present invention, said system includes: a disk scanning module, a virtual disk establishment module, a migration module, and a cleaning module;

所述磁盘扫描模块,在磁盘首次进行清理时,要对整个磁盘进行扫描,扫描缓存文件夹、垃圾文件;The disk scanning module, when the disk is cleaned up for the first time, will scan the entire disk, scan cache folders and junk files;

所述虚拟磁盘建立模块,建立虚拟磁盘;The virtual disk building module is used to create a virtual disk;

所述虚拟磁盘建立模块进一步具体为:建立固定虚拟磁盘1,将固定虚拟磁盘1挂载到盘符1;建立vhd虚拟磁盘文件2,通过windows挂载磁盘命令将虚拟磁盘文件2挂载到盘符2。Described virtual disk establishment module is further specifically: establishes fixed virtual disk 1, mounts fixed virtual disk 1 to drive letter 1; Establishes vhd virtual disk file 2, mounts virtual disk file 2 to disk by windows mount disk command character 2.

所述建立固定虚拟磁盘1,将固定虚拟磁盘1挂载到盘符1,具体为:建立固定虚拟磁盘1,固定虚拟磁盘1中的分块采用循环地址方式,将逻辑空间映射到盘符1固定空间内;当写入内容超过固定空间内地址,则自动覆盖之前的文件,这样无论垃圾文件怎么增加,都只会占用固定空间。The establishment of the fixed virtual disk 1, the fixed virtual disk 1 is mounted to the drive letter 1, specifically: the establishment of the fixed virtual disk 1, the blocks in the fixed virtual disk 1 adopt a circular address method, and the logical space is mapped to the drive letter 1 In the fixed space; when the written content exceeds the address in the fixed space, the previous file will be automatically overwritten, so that no matter how many junk files increase, it will only occupy the fixed space.

所述迁移模块,将缓存文件夹通过软连接方式迁移到虚拟磁盘中;The migration module migrates the cache folder to the virtual disk through a soft link;

所述迁移模块进一步具体为:记录并将缓存文件夹建立软连接映射到挂载盘符1下的文件夹;即记录缓存文件夹的路径,在盘符1下方建立除了盘符不同,路径与缓存文件夹的路径是相同的文件夹,将缓存文件夹的路径和盘符1下方建立的文件夹的路径进行软连接映射;The migration module is further specifically: record and map the cache folder to the folder under the mounted drive letter 1 by establishing a soft link; that is, record the path of the cache folder, and set up under the drive letter 1 except that the drive letter is different, the path is the same as The path of the cache folder is the same folder, and the path of the cache folder and the path of the folder established under drive letter 1 are soft-linked;

记录垃圾文件的上级文件夹,并将整个文件夹移动到盘符2的对应文件夹中,再将整个文件夹建立软连接指向盘符2中对应文件夹。Record the upper-level folder of the junk file, move the entire folder to the corresponding folder in drive letter 2, and then establish a soft link for the entire folder to point to the corresponding folder in drive letter 2.

所述清理模块,快速清理虚拟磁盘,从而对磁盘文件进行清理。The cleaning module quickly cleans up the virtual disk, thereby cleaning up the disk files.

所述清理模块进一步具体为:对固定虚拟磁盘无需清理,垃圾文件只会占用固定大小空间;根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。The cleaning module is further specifically: the fixed virtual disk does not need to be cleaned, and the garbage files only occupy a fixed size space; according to the recorded garbage file names, the garbage files are deleted, and the non-junk file records are retained in the vhd virtual disk file 2.

实施例四:本发明的一种磁盘文件清理优化的系统,所述系统包括:磁盘扫描模块、虚拟磁盘建立模块、迁移模块、以及清理模块;Embodiment 4: A system for cleaning and optimizing disk files of the present invention, said system comprising: a disk scanning module, a virtual disk establishment module, a migration module, and a cleaning module;

所述磁盘扫描模块,在磁盘首次进行清理时,要对整个磁盘进行扫描,扫描缓存文件夹、垃圾文件;The disk scanning module, when the disk is cleaned up for the first time, will scan the entire disk, scan cache folders and junk files;

所述虚拟磁盘建立模块,建立虚拟磁盘;The virtual disk building module is used to create a virtual disk;

所述虚拟磁盘建立模块进一步具体为:建立vhd虚拟磁盘文件1,通过windows挂载磁盘命令将虚拟磁盘文件1挂载到盘符1;建立vhd虚拟磁盘文件2,通过windows挂载磁盘命令将虚拟磁盘文件2挂载到盘符2。Described virtual disk establishment module is further specifically: set up vhd virtual disk file 1, mount virtual disk file 1 to drive letter 1 by windows mount disk command; set up vhd virtual disk file 2, mount virtual disk file 2 by windows mount disk command Disk file 2 is mounted to drive letter 2.

所述迁移模块,将缓存文件夹通过软连接方式迁移到虚拟磁盘中;The migration module migrates the cache folder to the virtual disk through a soft link;

所述迁移模块进一步具体为:记录并将缓存文件夹建立软连接映射到挂载盘符1下的文件夹;即记录缓存文件夹的路径,在盘符1下方建立除了盘符不同,路径与缓存文件夹的路径是相同的文件夹,将缓存文件夹的路径和盘符1下方建立的文件夹的路径进行软连接映射;The migration module is further specifically: record and map the cache folder to the folder under the mounted drive letter 1 by establishing a soft link; that is, record the path of the cache folder, and set up under the drive letter 1 except that the drive letter is different, the path is the same as The path of the cache folder is the same folder, and the path of the cache folder and the path of the folder established under drive letter 1 are soft-linked;

记录垃圾文件的上级文件夹,并将整个文件夹移动到盘符2的对应文件夹中,再将整个文件夹建立软连接指向盘符2中对应文件夹。Record the upper-level folder of the junk file, move the entire folder to the corresponding folder in drive letter 2, and then establish a soft link for the entire folder to point to the corresponding folder in drive letter 2.

所述清理模块,快速清理虚拟磁盘,从而对磁盘文件进行清理。The cleaning module quickly cleans up the virtual disk, thereby cleaning up the disk files.

所述清理模块进一步具体为:将vhd虚拟磁盘文件1直接格式化,并重新创建记录的缓存文件夹;根据记录的垃圾文件名,将垃圾文件删除,非垃圾文件记录保留在vhd虚拟磁盘文件2中。Described cleaning module is further specifically: the vhd virtual disk file 1 is directly formatted, and recreates the cache folder of the record; according to the garbage file name of the record, the garbage file is deleted, and the non-junk file record is retained in the vhd virtual disk file 2 middle.

以上所述仅为本发明的较佳实施例,凡依本发明申请专利范围所做的均等变化与修饰,皆应属本发明的涵盖范围。The above descriptions are only preferred embodiments of the present invention, and all equivalent changes and modifications made according to the scope of the patent application of the present invention shall fall within the scope of the present invention.

Claims (14)

CN202211027025.1A2022-08-252022-08-25 Method and system for cleaning and optimizing disk filesPendingCN115407940A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202211027025.1ACN115407940A (en)2022-08-252022-08-25 Method and system for cleaning and optimizing disk files

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202211027025.1ACN115407940A (en)2022-08-252022-08-25 Method and system for cleaning and optimizing disk files

Publications (1)

Publication NumberPublication Date
CN115407940Atrue CN115407940A (en)2022-11-29

Family

ID=84160611

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202211027025.1APendingCN115407940A (en)2022-08-252022-08-25 Method and system for cleaning and optimizing disk files

Country Status (1)

CountryLink
CN (1)CN115407940A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
AU5608890A (en)*1989-05-311990-12-06Raxco, Inc.Method for eliminating file fragmentation and reducing average seek times in a magnetic disk media environment
CN102279892A (en)*2011-09-072011-12-14盛乐信息技术(上海)有限公司Method and system for cleaning up temporary files
CN111930309A (en)*2020-07-312020-11-13中国人民解放军海军工程大学File circular storage method and device based on data blocking technology
CN112346663A (en)*2020-11-262021-02-09上海天旦网络科技发展有限公司Multi-partition rotation data writing and clearing method and system
CN113176857A (en)*2021-04-302021-07-27康键信息技术(深圳)有限公司Massive small file access optimization method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
AU5608890A (en)*1989-05-311990-12-06Raxco, Inc.Method for eliminating file fragmentation and reducing average seek times in a magnetic disk media environment
CN102279892A (en)*2011-09-072011-12-14盛乐信息技术(上海)有限公司Method and system for cleaning up temporary files
CN111930309A (en)*2020-07-312020-11-13中国人民解放军海军工程大学File circular storage method and device based on data blocking technology
CN112346663A (en)*2020-11-262021-02-09上海天旦网络科技发展有限公司Multi-partition rotation data writing and clearing method and system
CN113176857A (en)*2021-04-302021-07-27康键信息技术(深圳)有限公司Massive small file access optimization method, device, equipment and storage medium

Similar Documents

PublicationPublication DateTitle
US9092325B2 (en)Fast block device and methodology
US10120795B2 (en)Wear-leveling nandflash memory reading/writing method
CN112463730B (en) A method, system and medium for hierarchical optimization of storing massive small files
CN113626431A (en)LSM tree-based key value separation storage method and system for delaying garbage recovery
CN110018966A (en)A kind of memory, storage system, host and data manipulation, rubbish recovering method
CN103793475B (en)A kind of method of Distributed File System Data migration
CN107341267A (en)A kind of distributed file system access method and platform
TW201702860A (en) Autonomous space compression storage device and method
EP4579423A1 (en)Storage system and data processing method
US8046391B2 (en)Storage apparatus and its file control method and storage system
CN101727298A (en)Method and device for realizing independent redundant arrays of inexpensive disks
CN100347705C (en)Method for file merge
CN111107050A (en)Distributed wave recording method and device for power distribution network dynamic simulation system
CN103259998B (en)Recording system and method for aerial survey image data
CN115407940A (en) Method and system for cleaning and optimizing disk files
CN105573677A (en)Implementation method of efficient storage
CN111090549B (en)Volume CBT drive-based method for incrementally migrating volume-level data back to original machine
US20140143488A1 (en)Datastore for Non-Overwriting Storage Devices
CN104156327A (en)Method for recognizing object power failure in write back mode in distributed file system
CN115658624B (en)Metadata writing method and system for coping with unstable time interval of system
JP4079244B2 (en) Reorganization processing method for write-once type storage media volume
CN115373701B (en) A software rapid installation method and system
CN108733753A (en)A kind of file reading and application entity
CN102622307A (en)Operating method for hard disk data and hard disk controller
JP3725375B2 (en) Data reorganization method in storage media library

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp