File replication using file content location identifiers
Systems and methods for file replication using file content location identifiers. An example method may comprise: receiving an identifier of a data structure associated with a file residing on a first file server, the data structure referencing a physical location of the contents of the file; identifying a file system operation to be performed with respect to a replica of the file residing on a second file server; and performing the file system operation by accessing the replica of the file using a file name alias comprising the identifier of the data structure.
1. A method, comprising:
receiving, by a processing device, an index node number identifying a first index node associated with a file residing on a first file server, the first index node referencing a physical location of contents of the file;
identifying a replica of the file residing on a second file server;
assigning the index node number of the first index node to a second index node referencing a physical location of contents of the replica of the file on the second file server;
constructing a file name alias by appending the index node number of the first index node to an identifier of a defined directory; and
performing, by the processing device, a file system operation by accessing the replica of the file using the file name alias, wherein the file system operation comprises at least one of creating the replica of the file on the second file server, copying the contents of the file from the first file server to the second file server, deleting the replica of the file on the second file server, or renaming the replica of the file on the second file server.
2. The method of claim 1 , wherein the file name alias is provided by a hard link.
3. The method of claim 1 , wherein the receiving comprises reading a log record comprising the index node number of the first index node.
4. The method of claim 1 , wherein the first file server belongs to a first storage cluster and the second file server belongs to a second storage cluster.
5. The method of claim 1 , wherein the index node comprises a plurality of identifiers of disk blocks.
6. The method of claim 1 , wherein the index node comprises at least one of: a creation time of the file, an access time of the file, or a modification time of the file.
7. The method of claim 1 , wherein the index node comprises at least one of: a group identifier associated with the file or a user identifier associated with the file.
8. The method of claim 1 , wherein the index node comprises an access permission associated with the file.
9. The method of claim 1 , wherein identifying the replica of the file residing on the second file server further comprises:
creating the replica of the file on the second file server; and
assigning a randomly generated identifier to the second index node referencing the physical location of contents of the replica of the file on the second file server.
10. A system, comprising:
a memory; and
a processing device, operatively coupled to the memory, to:
receive an index node number identifying a first index node associated with a file residing on a first file server, the first index node referencing a physical location of contents of the file;
identify a replica of the file residing on a second file server;
assign the index node number of the first index node to a second index node referencing a physical location of contents of the replica of the file on the second file server;
construct a file name alias by appending the index node number of the first index node to an identifier of a defined directory; and
perform a file system operation by accessing the replica of the file using the file name alias, wherein the file system operation comprises at least one of creating the replica of the file on the second file server, copying the contents of the file from the first file server to the second file server, deleting the replica of the file on the second file server, or renaming the replica of the file on the second file server.
11. The system of claim 10 , wherein the file name alias is provided by a hard link.
12. The system of claim 10 , wherein the processing device is further to:
create the replica of the file on the second file server; and
assign a randomly generated identifier to the second index node referencing the physical location of contents of the replica of the file on the second file server.
13. The system of claim 10 , wherein the index node comprises a plurality of identifiers of disk blocks that store the contents of the file.
14. A non-transitory computer-readable storage medium comprising executable instructions that, when executed by a processing device, cause the processing device to:
receive, by the processing device, an index node number identifying a first index node associated with a file residing on a first file server, the first index node referencing a physical location of contents of the file;
identify a replica of the file residing on a second file server;
assign the index node number of the first index node to a second index node referencing a physical location of contents of the replica of the file on the second file server;
construct a file name alias by appending the index node number of the first index node to an identifier of a defined directory; and
perform, by the processing device, a file system operation by accessing the replica of the file using the file name alias, wherein the file system operation comprises at least one of creating the replica of the file on the second file server, copying the contents of the file from the first file server to the second file server, deleting the replica of the file on the second file server, or renaming the replica of the file on the second file server.
15. The non-transitory computer-readable storage medium of claim 14 , wherein the file name alias is provided by a hard link.
16. The non-transitory computer-readable storage medium of claim 14 , further comprising executable instructions causing the processing device to read a log record comprising the index node number of the first index node.
17. The non-transitory computer-readable storage medium of claim 14 , wherein the index node comprises a plurality of identifiers of disk blocks that store the contents of the file.