1e41f4b71Sopenharmony_ci# Distributed File System Overview
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciOpenHarmony distributed file system (hmdfs) provides cross-device file access capabilities in the following scenarios:
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci- The user uses the editing software on one device to edit the files on another device.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci- Music stored on a tablet can be directly viewed and played by an in-car infotainment system.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci- The user uses a tablet to view the photos taken by another device.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciThe hmdfs provides a globally consistent access view across devices dynamically connected to a network via DSoftBus and allows you to implement high-performance read and write operations on files with low latency by using basic file system APIs.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci## Distributed File System Architecture
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci![Distributed File System Architecture](figures/distributed-file-system-architecture.png)
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci- distributedfile_daemon: listens for device online status, establishes links over DSoftBus, and applies data transfer policies based on the security level of the device.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci- hmdfs: implements a network file system in the kernel and provides cache management, file access, metadata management, and conflict resolution.
20e41f4b71Sopenharmony_ci  - Cache management
21e41f4b71Sopenharmony_ci    - After devices are connected to form a Virtual Device, the hmdfs provides file access capabilities, but does not proactively transmit or copy files. Active copy is required when an application needs to save data to a local directory.
22e41f4b71Sopenharmony_ci    - The hmdfs ensures close-to-open cache consistency, which allows data to be flushed when a client closes a file. Then, the latest data can be read when the file is opened on any other client. The hmdfs does not ensure real-time consistency of the file content.
23e41f4b71Sopenharmony_ci    - If data written at the remote end has not been flushed to the local end in a timely manner due to network problems, the file system flushes the data to the local end upon the next network access. However, if the data has been modified on the remote end, only the latest data can be flushed.
24e41f4b71Sopenharmony_ci  - File access
25e41f4b71Sopenharmony_ci    - OpenHarmony provides the unified [ohos.file.fs](../reference/apis-core-file-kit/js-apis-file-fs.md) APIs for accessing the local and distributed file systems.
26e41f4b71Sopenharmony_ci    - The files in the local file system are accessed in overlay mode.
27e41f4b71Sopenharmony_ci    - The files on another device are accessed over a synchronous network.
28e41f4b71Sopenharmony_ci        > **NOTE**
29e41f4b71Sopenharmony_ci        >
30e41f4b71Sopenharmony_ci        > symlink is not supported.
31e41f4b71Sopenharmony_ci  - Metadata management
32e41f4b71Sopenharmony_ci    - In distributed networking, file creation, deletion, and modification on a device are synced to another device, at a speed subject to the network condition.
33e41f4b71Sopenharmony_ci    - If a device goes offline, its data is no longer visible to other devices. However, due to the delay in sensing the device offline, the files of some offline devices may also be visible to other devices. Therefore, you need to consider the network delay in application development.
34e41f4b71Sopenharmony_ci  - Conflict resolution
35e41f4b71Sopenharmony_ci    - If a file name conflict occurs on the local and remote devices, the file on the remote device is renamed.
36e41f4b71Sopenharmony_ci    - If a file name conflict occurs between multiple remote devices, the name of the file with the smallest device access ID is retained and the files on other devices are renamed.
37e41f4b71Sopenharmony_ci    - If the directory tree already has remote files in networking scenario, a file with a duplicate file name cannot be created successfully.
38e41f4b71Sopenharmony_ci    - The conflict files are renamed in "_conflict_dev_ID" format. The IDs automatically increment from 1.
39e41f4b71Sopenharmony_ci    - If a local directory and a remote directory have the same name, it does not yield a conflict. The files of the two directories will be merged. For the files with the same name, the name of the file in the remote directory will be appended with "_remote_directory".
40