Intelligent mapping and bidirectional synchronization system and method for cloud disk and local file system
By using intelligent mapping and bidirectional synchronization technology, the mapping relationship between cloud disk and local file system is dynamically established, which solves the problems of static mapping, low synchronization efficiency and insufficient cross-platform compatibility in existing technologies. It realizes seamless integration and real-time synchronization between cloud disk and local file system, improving user experience and data reliability.
Patent Information
- Application Number
- CN202511538991.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-01-16
AI Technical Summary
In existing technologies, the mapping and synchronization between cloud disks and local file systems suffer from problems such as static mapping, low synchronization efficiency, loss of cloud disk attributes, and insufficient cross-platform compatibility, resulting in a poor user experience.
The intelligent mapping module dynamically establishes a mapping relationship between the cloud disk and the local file system. It uses the cloud disk API to obtain the directory structure and convert it into a local virtual directory tree. Combined with extended attribute storage, it stores cloud disk-specific attributes, monitors file changes in real time, and adopts a two-way synchronization mechanism to achieve real-time synchronization between cloud disk files and local files. It also implements permission mapping and file locking through a cross-platform adaptation module.
It achieves seamless integration of cloud storage and local file system, supports dynamic updates, real-time synchronization, and cross-platform compatibility, improves user experience and data reliability, and meets the convenient operation needs of family and personal scenarios.
Smart Images

Figure CN121349985A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of IT and software development, and particularly relates to an intelligent mapping and bidirectional synchronization system and method of a cloud disk and a local file system. BACKGROUND
[0002] A cloud disk is an online storage service based on cloud computing technology, which can realize file uploading, downloading, management and sharing through a network. A local file system is a file management system provided by an operating system (such as Linux or Windows), which is used to manage the file and directory structure of a local storage device (such as a hard disk or a USB flash disk). The local file system can be Windows Explorer or a Linux terminal.
[0003] Current Internet cloud disks are mainly accessed through a web page, a dedicated APP or a client, and the operation mode is quite different from that of a local file system, which is difficult to meet the needs of home users for "class NAS" convenient operation. "Class NAS" usually refers to a storage device that has some core functions of a NAS (Network Attached Storage), but is more simplified in form, configuration or positioning. The core is to realize multi-device file sharing and access through a network.
[0004] In the prior art, some solutions attempt to display cloud disk files as local directories through simple mapping or synchronization tools, but have the following defects:
[0005] 1. Static mapping: After the cloud disk directory structure changes, the local mapping cannot be automatically updated and needs to be manually refreshed. The cloud disk operation is separated from the local file system, and the user needs to adapt to the dedicated tool, lacking the convenient experience of class NAS.
[0006] 2. Low synchronization efficiency: high delay in bidirectional synchronization and lack of conflict handling mechanism. For example, when the same file is modified on both ends at the same time, it is easy to cause data confusion. Bidirectional synchronization refers to real-time monitoring of file changes in the local file system and the cloud disk, automatically synchronizing local modifications to the cloud disk, and synchronizing cloud disk modifications to the local, ensuring data consistency on both ends.
[0007] The cloud disk and the local data have high synchronization delay and simple conflict handling, which easily leads to data inconsistency or loss.
[0008] 3. Loss of cloud disk properties: the properties unique to the cloud disk, such as sharing status and version history, cannot be intuitively reflected in the local file system, and the management efficiency is low.
[0009] 4. Poor cross-platform adaptation: when mounted through the SMB protocol in the Windows system, the functions of permission mapping and file locking are not perfectly adapted and compatible. The SMB protocol is a network file sharing protocol commonly used in Windows systems to realize cross-device file access.
[0010] The prior art mainly includes a traditional cloud disk client, a cloud disk access tool based on a basic mounting technology, a simple file synchronization software, and a NAS device, and has the following limitations:
[0011] 1. The traditional cloud disk client (for example, a web page end and a special APP)
[0012] Such a scheme requires a user to operate the cloud disk through a special interface, and the operation logic of the local file system (for example, a Windows resource manager and a Linux terminal) is completely split (for example, relying on an “upload / download” button rather than a local habit such as dragging and copying), the user needs to additionally learn the operation rules, and especially in a home scenario, it is difficult to meet the convenient use demand of a NAS; and data synchronization relies on a timing refresh, and the delay is high (usually minutes), which easily leads to inconsistency between the local and the cloud disk data.
[0013] 2. The basic mounting tool based on FUSE (for example, some open source cloud disk mounting schemes)
[0014] Such a scheme can mount the cloud disk as a local directory through FUSE, but has the following core defects: first, the mapping relationship is static, and the cloud disk directory structure change (for example, adding a folder) needs to be manually refreshed, and cannot be dynamically synchronized; second, only the display of file basic information (for example, name and size) is supported, and cloud disk specific properties (for example, sharing state and version history) cannot be reflected through the local file system, leading to management confusion; third, the two-way synchronization mechanism is simple, and when facing concurrent modification on both ends, the “overriding synchronization” is mostly used, which easily causes data loss.
[0015] 3. Simple file synchronization software (for example, a traditional synchronization tool)
[0016] Such a tool only focuses on one-way / double-way copying of file content, does not support mapping of the cloud disk directory tree and the local file system, the user cannot directly access the cloud disk as a “local directory”, and still needs to manage the synchronization rules through the tool interface; and lacks deep adaptation to the cloud disk API, and cannot handle cloud disk specific scenarios such as permission control (for example, sharing permission) and version management.
[0017] In summary, in the prior art, the cloud disk file is displayed as a local directory through simple mapping or synchronization tools, but there are problems such as static mapping, low synchronization efficiency, loss of cloud disk properties, and cross-platform adaptation. SUMMARY
[0018] In view of the above deficiencies of the prior art, the purpose of the present application is to provide an intelligent mapping and two-way synchronization system and method of a cloud disk and a local file system, to realize cloud disk property visualization, cross-platform compatibility, and optimized access efficiency.
[0019] The application discloses a cloud disk and local file system intelligent mapping and bidirectional synchronization method.
[0020] S1, an intelligent mapping relationship between a cloud disk and a local file system is established, and the method comprises the following steps:
[0021] When receiving a cloud disk mounting request initiated by a user through a local client, an intelligent mapping module acquires a cloud disk root directory structure by calling an interface of a cloud disk interface module, and converts the cloud disk root directory structure into a local virtual directory tree; and a special attribute of the cloud disk is stored by using an extended attribute of the local file system;
[0022] When the cloud disk interface module listens to a file change in the cloud disk, the intelligent mapping module is triggered to update a mapping relationship of the local file system;
[0023] When the local file system interface module listens to a file change in the local file system, a user space module is triggered to call the cloud disk interface module to synchronize change information to the cloud disk, and the intelligent mapping module is triggered to refresh a mapping relationship of the cloud disk;
[0024] S2, real-time monitoring of cloud disk file and local file system changes is implemented to realize bidirectional synchronization of the cloud disk file and the local file;
[0025] S21, a system event is used to listen to file change information in the local file system in real time, and cloud disk WebHook or timing polling is used to acquire cloud disk file change information;
[0026] S22, when listening to a file change in the local file system, a user space module uploads a local change file through a cloud disk interface module, and carries a timestamp and content hash, and an upload path is reversely parsed into a cloud disk path by an intelligent mapping module local path;
[0027] When listening to a file change in the cloud disk, a bidirectional synchronization module receives a cloud disk change notification, and downloads an update file to the local through the cloud disk interface module.
[0028] Further, in S1, the cloud disk root directory structure is acquired, and the method comprises the following steps:
[0029] After receiving the cloud disk mounting request, the user space module sends a directory structure acquisition instruction to the intelligent mapping module to request to acquire the cloud disk directory structure, and simultaneously sends a cloud authentication token, a root directory ID and a paging parameter;
[0030] The intelligent mapping module acquires a ListDirectory interface of a cloud disk interface module according to the directory structure, and calls a cloud disk directory data by using the ListDirectory interface, wherein the ListDirectory interface is used for encapsulating a directory list API of a cloud disk server;
[0031] The cloud disk interface module parses the cloud disk directory data in a JSON format returned by the ListDirectory interface into a standardized structure, extracts core fields of each directory and file, and generates a cloud disk directory structure.
[0032] Further, in S1, the cloud disk root directory structure is converted into a local virtual directory tree, including:
[0033] In the Linux system, a fuse_mkdir function of the FUSE interface is called, parameters are set as a local path and a permission mask, the function returns 0 to indicate that the creation is successful, a directory tree generated by the intelligent mapping module is mounted, and an extended attribute support is specified in a mounting parameter, so as to ensure that cloud disk specific attributes are normally read and written;
[0034] In the Windows system, a NetShareAdd function of the SMB service is called through the cross-platform adaptation module, a local mapping directory is shared as a network driver, and a CreateDirectoryW function is called to create a corresponding local directory node, so as to realize automatic mapping of cloud disk permissions and Windows file permissions.
[0035] Further, when it is detected that a directory or a file with the same name already exists under a mounting point of the local file system, the intelligent mapping module automatically appends a preset suffix field to a target path, records a conflict mapping relationship to a local configuration file, and issues a path conflict prompt and a conflict processing result to a user.
[0036] Further, in S1, the cloud disk specific attributes are stored by using the extended attributes of the local file system, including:
[0037] First, the cloud disk specific attributes are encapsulated into a JSON string;
[0038] In the Linux system, a setxattr function of the local file system interface module is called, parameters include a local file path, an extended attribute name, an attribute value, an attribute value length and an XATTR_CREATE flag, and the user can view the attribute;
[0039] In the Windows system, the cross-platform adaptation module calls the SetFileAttributesExW function or obtains the file handle through the Windows API GetFileHandle, and then calls the BackupWrite function to write the extended attribute; for permission mapping, the cloud disk shareStatus=1 is converted into the Windows NTFS permission, the security descriptor of the directory is set through the SetNamedSecurityInfoW function, and the read permission of the home user group is added.
[0040] Further, in S2, when the cloud disk and the local file system simultaneously modify the same file, a three-level strategy of timestamp, hash check sum and user preset rule is adopted; if there is no conflict, the synchronization is directly performed, if there is a conflict, a copy of the conflict file is automatically generated, the modification contents of the cloud disk and the local file system are retained, and the copy path is stored in the directory tree cache of the intelligent mapping module, so as to ensure that the user views the conflict file through the local directory.
[0041] Further, the method further comprises the following steps: identifying hot data based on the access frequency and the file size by using the cache optimization module, and preloading the hot data to the local cache.
[0042] The second aspect of the application provides a cloud disk and local file system intelligent mapping and bidirectional synchronization system, comprising:
[0043] The cloud disk and local file system intelligent mapping and bidirectional synchronization system comprises an intelligent mapping module, a bidirectional synchronization module, a user space module, a cloud disk interface module and a local file system interface module, wherein
[0044] The intelligent mapping module is used for acquiring the cloud disk root directory structure by calling the interface of the cloud disk interface module, converting the cloud disk root directory structure into a local virtual directory tree, dynamically establishing the mapping relationship between the cloud disk directory tree and the local file system, and storing the cloud disk specific attribute through metadata extension;
[0045] The cloud disk interface module is used for adopting the ListDirectory interface to encapsulate the directory list API of the cloud disk server, parsing the cloud disk directory data returned by the ListDirectory interface into a standardized structure, extracting the core fields of each directory and file to generate the cloud disk directory structure, listening to whether the file in the cloud disk is changed, triggering the intelligent mapping module to update the mapping relationship of the local file system when the file is changed, providing the file basic operation, sharing management and version query function, and providing the standardized cloud disk access interface for the system;
[0046] The local file system interface module is used for listening to whether a file in the local file system is changed, triggering a user space module to call a cloud disk interface module to synchronize change information to the cloud disk when the file is changed, and refreshing mapping relationship of the cloud disk by the intelligent mapping module; the local file system interacts with an operating system kernel, and mounting, reading and writing, and permission management operations of the local file system are realized;
[0047] The user space module is used for receiving a cloud disk mounting request from a local client, sending a directory structure acquisition instruction to the intelligent mapping module to request to acquire a cloud disk directory structure, and sending a cloud authentication token, a root directory ID and a paging parameter; the user space module uploads a local changed file through the cloud disk interface module when a file in the local file system is changed, and carries a timestamp and a content hash, and an upload path is reversely parsed from a local path of the intelligent mapping module to a cloud disk path; the user space module coordinates interaction between the functional modules, processes a local file operation request and converts the local file operation request into a cloud disk interface call;
[0048] The bidirectional synchronization module is used for listening to local and cloud disk file changes, realizing real-time synchronization, and solving concurrent modification conflicts through a timestamp, hash verification and a user rule.
[0049] Further, the application further comprises a cross-platform adaptation module and a cache optimization module, wherein,
[0050] The cross-platform adaptation module is used for adapting different operating systems, and realizing cross-platform mapping of permission mapping and file locking functions;
[0051] The cache optimization module is used for identifying hot data based on access frequency and file size, and preloading the hot data to a local cache.
[0052] In a third aspect, the application provides a cloud disk file system, comprising a user layer, a protocol layer, a core module layer and a cloud disk server, wherein,
[0053] The user layer comprises a Linux terminal and a Windows resource manager;
[0054] The protocol layer comprises a FUSE mounting protocol and an SMB protocol;
[0055] The core module layer comprises the intelligent mapping and bidirectional synchronization system of the cloud disk and the local file system according to any one of claims 8-9;
[0056] The cloud disk server comprises a file storage service, a shared permission service and a version management service.
[0057] The application has the following advantages:
[0058] The system and method described in the application, through the integrated design of "intelligent mapping + bidirectional synchronization + cross-platform adaptation", not only solves the problems of complex operation of traditional cloud disk and disconnection with local system, but also overcomes the defects of existing synchronization tools in real-time, conflict processing and compatibility, finally realizes the technical effects of cloud disk local use, data non-loss, operation zero learning and cross-end full compatibility, significantly improves the practicality and ease of use of cloud disk in home and personal scenarios.
[0059] 1. Dynamic intelligent mapping: the root directory structure is obtained by cloud disk API paging and the exception is processed, the local virtual directory tree is constructed, the cloud disk specific attributes are stored by using system extended attributes (Linux xattr, Windows NTFS extended attributes), the path conflict automatic processing and mapping relationship cache are supported.
[0060] 2. Conflict-aware synchronization: based on the directory tree cache of the intelligent mapping module, the fast association of fileId and local path is realized, the copy path generated by the three-level conflict processing mechanism is included in the mapping relationship management. An efficient bidirectional synchronization mechanism is constructed to synchronize the data of both ends in real time and solve the concurrent modification conflict.
[0061] 3. Hot data cache optimization: based on the directory tree of the intelligent mapping module, "hot data" is identified, the file is cached and bound with fileId, and the cache invalidation and mapping attribute synchronization are triggered by cloud disk attribute update.
[0062] 4. Cross-platform permission adaptation: the field mapping rules of cloud disk permissions and local file system permissions are combined with the extended attribute storage of the intelligent mapping module to realize the localization synchronization of permissions.
[0063] 5. Cross-platform compatibility: supports Linux, Windows and other systems, expands the application scenarios, supports cross-platform adaptation (Linux, Windows, etc.), and ensures the consistency of operations under different systems.
[0064] 6. User experience improvement: cloud disk files are presented in the form of local directories, the operation habit is consistent with the local file system, and the "NAS-like" use demand of the family is met.
[0065] 7. Data reliability enhancement: real-time bidirectional synchronization + conflict processing mechanism, avoiding data loss or chaos.
[0066] 8. Cloud disk attribute visualization: cloud disk specific attributes such as sharing state and version can be viewed locally to improve management efficiency. Realize dynamic intelligent mapping of cloud disk directory tree and local file system, support local display of cloud disk specific attributes (sharing, version, etc.)
[0067] 9、Access efficiency optimization: cache reduces repeated downloads, improves availability in weak or offline environments. Through cache optimization, improve cloud disk file access speed, reduce network dependence. BRIEF DESCRIPTION OF DRAWINGS
[0068] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings:
[0069] Figure 1 Flow chart of the intelligent mapping and bidirectional synchronization method of a cloud disk and a local file system according to an embodiment of the present application;
[0070] Figure 2 Flow chart of the intelligent mapping method according to an embodiment of the present application;
[0071] Figure 3 Flow chart of the bidirectional synchronization method according to an embodiment of the present application;
[0072] Figure 4 Structure diagram of the intelligent mapping and bidirectional synchronization system of a cloud disk and a local file system according to an embodiment of the present application;
[0073] Figure 5 Architecture diagram of the cloud disk file system according to an embodiment of the present application. DETAILED DESCRIPTION
[0074] In order to make the personnel in the art better understand the technical solutions in the embodiments of the present application, the technical solutions of the present application will be described clearly and completely in conjunction with the drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. It should be understood that these descriptions are only exemplary and are not used to limit the scope of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor should belong to the scope of protection of the present application.
[0075] In addition, in the following description, the description of well-known structures and techniques is omitted to avoid unnecessary confusion of the concepts disclosed in the present application.
[0076] In the description of the present application, it should be noted that, unless otherwise explicitly specified and limited, the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" are only for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "mounting", "connecting", "connecting" should be broadly understood, for example, it can be fixedly connected, or it can be detachably connected, or integrally connected; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium, or it can be the communication between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0077] The exemplary embodiments will be described in detail herein, with examples shown in the drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Rather, they are merely examples of methods and systems consistent with some aspects of the present application as detailed in the appended claims.
[0078] The present application proposes a cloud disk and local file system intelligent mapping and bidirectional synchronization system and method, which can realize seamless integration of cloud disk and local file system, solve the problems of traditional cloud disk operation and local system split, synchronization delay, attribute management loss and cross-platform adaptation deficiency, and let users conveniently use the cloud disk in a familiar NAS-like way, suitable for cloud storage management in home and personal scenarios.
[0079] As Figure 1 shown, the present application proposes a cloud disk and local file system intelligent mapping and bidirectional synchronization method, comprising:
[0080] S1, establishing an intelligent mapping relationship between the cloud disk and the local file system.
[0081] Intelligent mapping refers to dynamically converting the directory tree of the cloud disk (including file attributes, sharing state, version information, etc.) into a directory structure recognizable by the local file system, and realizing the localization of cloud disk specific attributes through metadata extension.
[0082] The process of intelligent mapping will be described below. Figure 2
[0083] Reference is made to Figure 2 When receiving a cloud disk mounting request initiated by a user through a local client, the intelligent mapping module obtains a cloud disk root directory structure by calling an interface of the cloud disk interface module, and converts the cloud disk root directory structure into a local virtual directory tree.
[0084] In the present application, the cloud disk root directory structure includes a file ID, a name, a type, a sharing state, a version number, etc.
[0085] Specifically, the cloud disk root directory structure is first obtained, including the following steps:
[0086] 1. Sending a request: the user initiates a cloud disk mounting request through a local client (such as inputting a mounting point path / mnt / cloud_disk), and the user space module sends a directory structure obtaining instruction to the intelligent mapping module after receiving the cloud disk mounting request, requesting to obtain the cloud disk directory structure, and at the same time, the user space module sends a cloud authentication token (Token), a root directory ID and a paging parameter to the intelligent mapping module. The intelligent mapping module subsequently passes the cloud authentication token (Token), the root directory ID and the paging parameter to the cloud disk interface API to obtain cloud disk directory data.
[0087] 2. API calling and data returning: the intelligent mapping module calls the ListDirectory interface of the cloud disk interface module according to the directory structure obtaining instruction, and uses the ListDirectory interface to call cloud disk directory data, wherein the ListDirectory interface is used to encapsulate the directory list API of the cloud server side.
[0088] 3. Directory data analysis: the cloud disk interface module analyzes the cloud disk directory data returned by the ListDirectory interface in JSON format into a standardized structure, extracts the core fields of each directory and file, and generates a cloud disk directory structure. The cloud disk directory structure is generated based on the cloud authentication token, the root directory ID and the paging parameter.
[0089] In the present application, the core fields of each directory and file include a fileId (cloud disk unique identifier), a name, a type (directory / file), a parentId (parent directory ID), a shareStatus (sharing state: 0 = private, 1 = family sharing, 2 = public sharing), a version, a createTime (creation timestamp), and a modifyTime (modification timestamp).
[0090] Then, the cloud disk root directory structure is converted into a local virtual directory tree, including the following steps:
[0091] In the Linux system, the fuse_mkdir function of the FUSE interface is called, parameters are set as a local path (for example, / mnt / cloud_disk / home photo album), a permission mask (default 0755), the function returns 0 to indicate that the creation is successful, a directory tree generated by the smart mapping module is mounted, and extended attribute support is specified in the mounting parameter, so that the normal reading and writing of cloud disk specific attributes are ensured.
[0092] In the application, the Linux system is implemented by a libfuse module, interaction with a FUSE kernel module is implemented, including mounting, reading and writing, metadata operation and the like, the FUSE interface module accepts a request of the kernel and forwards the request to a user space daemon process, and the processing result of the user space daemon process is returned to the kernel. A function of the corresponding libfuse is called, and the local file directory mapping under the Linux system can be implemented. The user state file system is an implementation manner of the file directory mapping under Linux, a virtual user state file system is implemented based on the libfuse technology, the cloud disk directory structure of the cloud can be mapped to the virtual file system, and the purpose is achieved.
[0093] In the Windows system, the NetShareAdd function of the SMB service is called through the cross-platform adaptation module, a local mapping directory is shared as a network drive (the shared name CloudDisk), and the CreateDirectoryW function is called to create a corresponding local directory node (for example, Z:\CloudDisk\home photo album), so that the automatic mapping of the cloud disk permission and the Windows file permission is implemented.
[0094] In the application, the Windows system is implemented based on the SMB service, and the corresponding function is also called, so that the file directory mapping of the Windows system is implemented.
[0095] The application can implement cross-platform adaptation.
[0096] In the Linux system, the directory tree generated by the smart mapping module is mounted through the FUSE, and the extended attribute support is specified in the mounting parameter, so that the normal reading and writing of the cloud disk specific attributes are ensured. In the application, the -o user_xattr option is set to realize the specified extended attribute support, and the extended attribute is enabled.
[0097] In the Windows system, the local mapping directory is shared as the network drive through the SMB service by the cross-platform adaptation module, and the automatic mapping of the cloud disk permission (for example, the "read-only" permission) and the Windows file permission (the access control permission of the NTFS file system, NTFS ACL) is implemented.
[0098] When detecting that a directory or file with the same name already exists under the mounting point of the local file system, it is determined that a path conflict occurs, and the path conflict needs to be processed. Specifically, the intelligent mapping module automatically appends a preset suffix field to the target path, records the conflict mapping relationship to the local configuration file, and simultaneously issues a path conflict prompt and conflict processing result to the user.
[0099] For example, if a directory with the same name as / mnt / cloud_disk / home photo album already exists under the local mounting point, the intelligent mapping module automatically appends a “_cloud” suffix to the target path, that is, / mnt / cloud_disk / home photo album_cloud, records the conflict mapping relationship to the local configuration file ( / etc / cloud_disk / conflict_map.conf), and simultaneously issues a prompt and processing result of the conflict to the user in a pop-up window.
[0100] In addition, the application supports dynamic updating. When a file change is detected in the cloud disk or the local file system, the mapping relationship between the cloud disk and the local file system is dynamically updated.
[0101] When the cloud disk interface module detects that a file in the cloud disk has changed (for example, a new file is added), the intelligent mapping module is triggered to update the mapping relationship of the local file system.
[0102] When the local file system interface module detects that a file in the local file system has changed (for example, a file is renamed), the user space module is triggered to call the cloud disk interface module to synchronize the change information to the cloud disk, and the intelligent mapping module is triggered to refresh the mapping relationship of the cloud disk.
[0103] The unique attribute of the cloud disk is stored by using the extended attribute of the local file system. For example, the unique attribute of the cloud disk is a shared folder, and the extended attribute of the local file system is the xattr of the Linux system or the NTFS alternate data stream of Windows. The shared folder attribute of the cloud disk is stored by using the xattr of the Linux system or the NTFS alternate data stream of Windows.
[0104] The specific process of storing the unique attribute of the cloud disk by using the extended attribute of the local file system is described below.
[0105] First, the attribute data is formatted, including: encapsulating the unique attribute of the cloud disk into a JSON string. The unique attribute of the cloud disk includes: shareStatus, version, shareMembers (shared member list), etc.
[0106] Linux system (xattr interface):
[0107] In the Linux system, the local file system interface module calls the setxattr function, and the parameters include: the local file path (such as / mnt / cloud_disk / home photo album), the extended attribute name (prefix user.cloud., such as user.cloud.attr), the attribute value (the above JSON string), the attribute value length, the XATTR_CREATE flag (avoiding covering the existing attribute), supporting the user to view the attribute. The user can view the attribute through the getfattr-n user.cloud.attr / mnt / cloud_disk / home photo album command.
[0108] Windows system (NTFS extended attribute):
[0109] In the Windows system, the cross-platform adaptation module calls the SetFileAttributesExW function or obtains the file handle through the Windows API GetFileHandle, and then calls the BackupWrite function to write the extended attribute (attribute name CloudAttr).
[0110] For permission mapping, the cloud disk shareStatus=1 (family sharing, read-only) is converted into the Windows NTFS permission, the security descriptor of the directory is set through the SetNamedSecurityInfoW function, and the "read" permission of the "family user group" is added (the "write" permission is refused).
[0111] S2, real-time monitoring of the change of the cloud disk file and the local file system, realizing the bidirectional synchronization of the cloud disk file and the local file.
[0112] Reference Figure 3 As shown in the figure, the bidirectional synchronization of the cloud disk file and the local file includes the following steps:
[0113] S21, the change information of the file in the local file system is monitored in real time through the operating system event, and the change information of the cloud disk file is obtained through the cloud disk WebHook or timing polling.
[0114] Among them, the operating system event is the inotify of the Linux system and the FileSystemWatcher of the Windows system. The change information of the file in the local file system is monitored in real time through the operating system event, for example, the creation, modification or deletion of the file is captured.
[0115] This step can realize the monitoring of the change of the cloud disk and the local file.
[0116] S22, when the user space module listens to the change of the file in the local file system, the local changed file is uploaded through the cloud disk interface module, and a timestamp and content hash are carried, and the uploading path is reversely parsed from the local path of the intelligent mapping module to the cloud disk path. For example, / mnt / cloud_disk / home_album / photo.jpg is parsed as parentId=123456.
[0117] When the cloud disk and the local file system modify the same file at the same time, the three-level strategy of "timestamp (prefer the latest) -> hash check (judge the content difference) -> user preset rule (such as "local priority") is adopted. If there is no conflict, the conflict file is automatically generated (for example, file.txt_conflict_20250810), the modified content of the cloud disk and the local file system is reserved, and the copy path is stored in the directory tree cache of the intelligent mapping module, so that the user can view the conflict file through the local directory.
[0118] The conflict processing in the synchronization process will be described below.
[0119] When the cloud disk and the local file system modify the same file at the same time, the three-level strategy of "timestamp (prefer the latest) -> hash check (judge the content difference) -> user preset rule (such as "local priority") is adopted. If there is no conflict, the conflict file is automatically generated (for example, file.txt_conflict_20250810), the modified content of the cloud disk and the local file system is reserved, and the copy path is stored in the directory tree cache of the intelligent mapping module, so that the user can view the conflict file through the local directory.
[0120] The intelligent mapping and bidirectional synchronization method of the cloud disk and the local file system of the application further includes the following steps: the cache optimization module identifies hot data based on access frequency and file size, and preloads the hot data to the local cache.
[0121] In the application, the cache optimization module preloads the hot data with access frequency ≥ 3 times and size < 200MB to the local cache within 7 days, and the cache expiration time is combined with the file modification time (24 hours without access to automatically clean up) and the cloud disk version (the cache is invalidated after the cloud disk is updated).
[0122] As shown in Figure 4 The application provides an intelligent mapping and bidirectional synchronization system of a cloud disk and a local file system, which includes an intelligent mapping module 1, a cloud disk interface module 2, a local file system interface module 3, a user space module 4 and a bidirectional synchronization module 5.
[0123] Specifically, the intelligent mapping module 1 is used to call the interface of the cloud disk interface module 2, acquire the cloud disk root directory structure, convert the cloud disk root directory structure into a local virtual directory tree, dynamically establish the mapping relationship between the cloud disk directory tree and the local file system, and store the cloud disk specific attributes through metadata extension.
[0124] In the present application, cloud disk unique attributes, such as shared state, version number, etc.
[0125] The cloud disk interface module 2 is used to encapsulate the directory list API of the cloud disk server with the ListDirectory interface, and parse the cloud disk directory data returned by the ListDirectory interface in JSON format into a standardized structure, and extract the core fields of each directory and file to generate a cloud disk directory structure.
[0126] The cloud disk interface module 2 listens to whether the file in the cloud disk changes, and triggers the intelligent mapping module 1 to update the mapping relationship of the local file system when the change occurs; provides file basic operation CRUD, shared management and version query functions, and provides a standardized cloud disk access interface for the system.
[0127] The local file system interface module 3 is used to listen to whether the file in the local file system changes, and triggers the user space module to synchronize the change information to the cloud disk when the change occurs, and the intelligent mapping module 1 refreshes the mapping relationship of the cloud disk; the local file system interacts with the operating system kernel to realize the mounting, reading and writing, and permission management operations of the local file system.
[0128] The local file system interface module interacts with the operating system kernel to realize the mounting, reading and writing, and permission management operations of the local file system. For example, the virtual file system VFS of Linux and the SMB service of Windows.
[0129] The user space module 4 is used to receive the cloud disk mounting request from the local client, and sends the directory structure acquisition instruction to the intelligent mapping module, requests to obtain the cloud disk directory structure, and sends the cloud authentication token, root directory ID and paging parameters.
[0130] The user space module 4 uploads the local changed file through the cloud disk interface module 2 when the file in the local file system changes, and carries the timestamp and content hash, and the upload path is inversely parsed from the local path of the intelligent mapping module 1 to the cloud disk path. The user space module 4 is used as the hub of the system, coordinates the interaction between the various functional modules, processes the local file operation request and converts it into a cloud disk interface call.
[0131] The bidirectional synchronization module 5 is used to listen to the local and cloud disk file changes, realize real-time synchronization, and solve the concurrent modification conflict through timestamp, hash check and user rules.
[0132] The intelligent mapping and bidirectional synchronization system of the cloud disk and the local file system of the present application further comprises a cross-platform adaptation module and a cache optimization module 7.
[0133] The cross-platform adaptation module 6 is used for adapting different operating systems, such as adapting Linux (FUSE protocol), Windows (SMB protocol) and the like, and realizing cross-platform functions such as permission mapping and file locking.
[0134] The cache optimization module 7 is used for identifying hot data based on access frequency and file size, and preloading to a local cache, so as to reduce repeated network transmission.
[0135] As shown in Figure 5 The cloud disk file system comprises a user layer, a protocol layer, a core module layer and a cloud disk server.
[0136] The user layer comprises a Linux terminal and a Windows resource manager.
[0137] The protocol layer comprises a FUSE mounting protocol and an SMB protocol.
[0138] The core module layer comprises the intelligent mapping and bidirectional synchronization system of the cloud disk and the local file system in the above embodiment.
[0139] The cloud disk server comprises a file storage service, a sharing permission service and a version management service.
[0140] The intelligent mapping and bidirectional synchronization method and system of the cloud disk and the local file system will be described below by taking the Tianyi cloud disk as an example.
[0141] (1) Intelligent mapping: after the "family shared folder" of the Tianyi cloud disk is mounted locally, the user.cloud.share=family attribute can be viewed through the getfattr command, and the user can intuitively identify the shared directory.
[0142] (2) Bidirectional synchronization: after the user modifies the work report.docx locally, the file is synchronized to the Tianyi cloud disk within 3 seconds; meanwhile, when other devices modify the file in the cloud disk, the local file is automatically updated within 10 seconds, and if there is a conflict, a conflict copy is generated.
[0143] (3) Cross-platform use: the Windows user accesses the cloud disk mapping directory shared by the SMB through the "network location", the operation mode is consistent with that of the local folder, and the cloud disk "read-only" permission automatically limits local modification.
[0144] (4) Cache acceleration: the frequently used photo folder (<200MB) of the user is pre-cached to the local, and the user can still open and view the folder when the network is disconnected.
[0145] In summary, the cloud disk and local file system intelligent mapping and bidirectional synchronization method and system of the application, through the intelligent mapping module, the cloud disk directory tree is dynamically converted into a directory structure that can be recognized by the local file system, and the cloud disk specific attributes (such as sharing state, version information) are associated through metadata extension; through the bidirectional synchronization module, the local and cloud disk file changes are monitored in real time, and the "timestamp + hash check + user rule" processing is combined to handle concurrent modification conflicts, ensuring data consistency; at the same time, through the cross-platform adaptation module, the permission mapping and operation compatibility of Linux, Windows and other systems are realized, and the access efficiency is improved through cache optimization
[0146] The cloud disk and local file system intelligent mapping and bidirectional synchronization method and system of the application can realize the following functions:
[0147] (1) Dynamic intelligent mapping: through cloud disk API, the root directory structure is obtained and exceptions are handled, the local virtual directory tree is constructed, the cloud disk specific attributes are stored by using system extended attributes (Linux xattr, Windows NTFS extended attributes), and path conflict automatic processing and mapping relationship caching are supported;
[0148] (2) Conflict-aware synchronization: based on the directory tree cache of the intelligent mapping module, the fast association of fileId and local path is realized, and the copy path generated by the three-level conflict processing mechanism is included in the mapping relationship management;
[0149] (3) Cross-platform permission adaptation: the field mapping rules of cloud disk permissions and local file system permissions are combined with the extended attribute storage of the intelligent mapping module to realize the localization synchronization of permissions;
[0150] (4) Hot data cache optimization: based on the directory tree of the intelligent mapping module, the "hot data" is identified, the cache file is bound with fileId, and the cloud disk attribute update triggers cache invalidation and mapping attribute synchronization.
[0151] The cloud disk and local file system intelligent mapping and bidirectional synchronization method and system of the application can be applied to the following scenarios: home or personal users access and manage cloud disk files through local file systems (such as Windows Explorer, Linux terminal) in a NAS-like operation mode, realizing real-time bidirectional synchronization of cloud disk and local data and cross-platform compatible use.
[0152] Home scenario: centralized management of photos, documents, etc., NAS-like convenient operation, whole family sharing without learning cost.
[0153] Personal multi-device: real-time synchronization of multiple terminals, local modification is updated to the cloud disk in real time, and seamless connection across devices.
[0154] Weak network / offline: cache frequently used files, access offline, and automatically synchronize modifications after networking.
[0155] Cross-platform office: Linux / Windows compatible, uniform permissions and consistent operations when team collaboration.
[0156] Finally, it should be noted that the above examples are only used to illustrate the technical solutions of the embodiments of the present application, and are not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered within the protection scope of the present application.
Claims
1. A method for intelligent mapping and bidirectional synchronization of cloud disk and local file system, characterized in that, Comprise: S1, establish the intelligent mapping relationship of cloud disk and local file system, comprising: When receiving the cloud disk mounting request initiated by the user through the local client, the intelligent mapping module obtains the cloud disk root directory structure by calling the interface of the cloud disk interface module, and converts the cloud disk root directory structure into a local virtual directory tree; The unique attributes of the cloud disk are stored by using the extended attributes of the local file system; When the cloud disk interface module listens to the change of the file in the cloud disk, the intelligent mapping module is triggered to update the mapping relationship of the local file system; When the local file system interface module listens to the change of the file in the local file system, the user space module is triggered to call the cloud disk interface module to synchronize the change information to the cloud disk, and the intelligent mapping module is triggered to refresh the mapping relationship of the cloud disk; S2, real-time monitoring of cloud disk file and local file system change, realizing the bidirectional synchronization of cloud disk file and local file; S21, real-time monitoring of the change information of the file in the local file system through the operating system event, and obtaining the change information of the cloud disk file through the cloud disk WebHook or timing polling; S22, when the change of the file in the local file system is listened to, the user space module uploads the local changed file through the cloud disk interface module, and carries the timestamp and content hash at the same time, and the upload path is reversely parsed into the cloud disk path by the local path of the intelligent mapping module; When the change of the file in the cloud disk is heard, the bidirectional synchronization module receives the cloud disk change notification, and downloads the updated file to the local through the cloud disk interface module.
2. The intelligent mapping and bidirectional synchronization method of cloud disk and local file system according to claim 1, characterized in that, In S1, the cloud disk root directory structure comprises: After receiving the cloud disk mounting request, the user space module sends a directory structure acquisition instruction to the intelligent mapping module, requests to obtain the cloud disk directory structure, and sends the cloud disk authentication token, root directory ID and paging parameter at the same time; The intelligent mapping module calls the ListDirectory interface of the cloud disk interface module according to the directory structure acquisition instruction, and utilizes the ListDirectory interface to call the cloud disk directory data, wherein the ListDirectory interface is used to encapsulate the directory list API of the cloud disk server; The cloud disk interface module parses the JSON format cloud disk directory data returned by the ListDirectory interface into a standardized structure, extracts the core fields of each directory and file, and generates the cloud disk directory structure. 3.The intelligent mapping and bidirectional synchronization method of cloud disk and local file system according to claim 1, characterized in that, In S1, the cloud disk root directory structure is converted into a local virtual directory tree, comprising: In the Linux system, the fuse_mkdir function of the FUSE interface is called, the parameters are set as the local path, the permission mask, the function returns 0 to indicate that the creation is successful, the directory tree generated by the intelligent mapping module is mounted, and the extended attribute support is specified in the mounting parameter to ensure the normal read and write of the unique attributes of the cloud disk. In the Windows system, the local mapping directory is shared as a network drive by calling the NetShareAdd function of the SMB service through the cross-platform adaptation module, and the CreateDirectoryW function is called to create the corresponding local directory node, so as to realize the automatic mapping of the cloud disk permission and the Windows file permission.
4. The intelligent mapping and bidirectional synchronization method of a cloud disk and a local file system according to claim 3, characterized in that, When it is detected that a directory or a file with the same name already exists under the mounting point of the local file system, the intelligent mapping module automatically appends a preset suffix field to the target path, records the conflict mapping relationship to the local configuration file, and simultaneously issues a path conflict prompt and a conflict processing result to the user.
5. The intelligent mapping and bidirectional synchronization method of cloud disk and local file system according to claim 1, characterized in that, In S1, the unique attributes of the cloud disk are stored by using the extended attributes of the local file system, including: First, the unique attributes of the cloud disk are encapsulated as a JSON string; In the Linux system, the local file system interface module calls the setxattr function, and the parameters include the local file path, the extended attribute name, the attribute value, the attribute value length and the XATTR_CREATE flag, and the user can view the attribute; In the Windows system, the cross-platform adaptation module calls the SetFileAttributesExW function or obtains the file handle through the Windows API GetFileHandle, and then calls the BackupWrite function to write the extended attribute; for permission mapping, the cloud disk shareStatus = 1 is converted into the Windows NTFS permission, the security descriptor of the directory is set through the SetNamedSecurityInfoW function, and the read permission of the home user group is added.
6. The intelligent mapping and bidirectional synchronization method of cloud disk and local file system according to claim 1, characterized in that, In S2, when the cloud disk and the local file system simultaneously modify the same file, a three-level strategy of timestamp, hash check and user preset rule is adopted; if there is no conflict, the file is directly synchronized, if there is a conflict, a copy of the conflict file is automatically generated, the modification contents of the cloud disk and the local file system are retained, and the copy path is stored in the directory tree cache of the intelligent mapping module, so as to ensure that the user can view the conflict file through the local directory.
7. The intelligent mapping and bidirectional synchronization method of cloud disk and local file system according to claim 1, characterized in that, Further comprising the following steps: identifying hot data based on access frequency and file size by using the cache optimization module, and preloading the hot data to the local cache.
8. An intelligent mapping and bidirectional synchronization system of cloud disk and local file system, characterized in that, Comprise: The intelligent mapping module, the bidirectional synchronization module, the user space module, the cloud disk interface module, the local file system interface module, wherein, The intelligent mapping module is used for acquiring the cloud disk root directory structure by calling the interface of the cloud disk interface module, and converting the cloud disk root directory structure into a local virtual directory tree, dynamically establishing the mapping relationship between the cloud disk directory tree and the local file system, and storing the unique attributes of the cloud disk through metadata extension; The cloud disk interface module is configured to adopt a ListDirectory interface to encapsulate a directory list API of a cloud disk server, and parse cloud disk directory data in a JSON format returned by the ListDirectory interface into a standardized structure, extract core fields of each directory and file to generate a cloud disk directory structure, listen to whether a file in the cloud disk changes, and trigger the intelligent mapping module to update a mapping relationship of a local file system when a change occurs; and provide file basic operation, sharing management and version query functions, and provide a standardized cloud disk access interface for the system. The local file system interface module is configured to listen to whether a file in a local file system changes, and trigger a user space module to call a cloud disk interface module to synchronize change information to a cloud disk and refresh a mapping relationship of the cloud disk by the intelligent mapping module when a change occurs; and the local file system interacts with an operating system kernel to realize mounting, reading and writing and permission management operations of the local file system. The user space module is configured to receive a cloud disk mounting request from a local client, and send a directory structure acquisition instruction to the intelligent mapping module to request to acquire a cloud disk directory structure, and send a cloud authentication token, a root directory ID and a paging parameter; the user space module uploads a local changed file through the cloud disk interface module when a file in the local file system changes, and carries a timestamp and a content hash, and an upload path is reversely parsed from a local path of the intelligent mapping module into a cloud disk path; the user space module coordinates interaction between the functional modules, processes a local file operation request and converts the local file operation request into a cloud disk interface call. The bidirectional synchronization module is configured to listen to local and cloud disk file changes, realize real-time synchronization, and solve concurrent modification conflicts through a timestamp, hash verification and a user rule.
9. The intelligent mapping and bidirectional synchronization system of cloud disk and local file system according to claim 8, characterized in that, Further comprising: a cross-platform adaptation module and a cache optimization module, wherein the cross-platform adaptation module is configured to adapt to different operating systems, and realize cross-platform mapping of permission mapping and file locking functions; the cache optimization module is configured to identify hot data based on access frequency and file size, and pre-load the hot data to a local cache.
10. A cloud disk file system, characterized in that, comprising: a user layer, a protocol layer, a core module layer and a cloud disk server, wherein the user layer comprises a Linux terminal and a Windows resource manager; the protocol layer comprises a FUSE mounting protocol and an SMB protocol; the core module layer comprises the intelligent mapping and bidirectional synchronization system of the cloud disk and the local file system according to any one of claims 8-9; the cloud disk server comprises a file storage service, a sharing permission service and a version management service.
Citation Information
Cited By
Storage service multi-terminal full-quantity synchronization method, device, equipment, medium and product
CN122001903A