In class IDiskRemote, all metadata file system operations use os file system api directly.
There is little extendiability if we want store the metadata of HDFS or S3 into distributed file system.
So I suggest change this way by using DiskPtr and will propose a pull request.

In addition, metadata of HDFS or S3 only store local FS which is not sharable.

: remote_fs_root_path(remote_fs_root_path_), metadata_file_path(metadata_file_path_) {}
};
struct IDiskRemote::Metadata : RemoteMetadata
{
    
    static constexpr UInt32 VERSION_ABSOLUTE_PATHS = 1;
    static constexpr UInt32 VERSION_RELATIVE_PATHS = 2;
    static constexpr UInt32 VERSION_READ_ONLY_FLAG = 3;
    
    const String & disk_path;
    
    size_t total_size = 0;
    
    UInt32 ref_count = 0;
    
    bool read_only = false;
    
    Metadata(const String & remote_fs_root_path_,
            const String & disk_path_,
            const String & metadata_file_path_,
            bool create = false);
    void addObject(const String & path, size_t size);
    
    void save(bool sync = false);
};
class RemoteDiskDirectoryIterator final : public IDiskDirectoryIterator