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.

bool isRemote() const override { return true; }
    bool supportZeroCopyReplication() const override { return true; }
    std::unique_ptr<ReadBufferFromFileBase> readFile(
        const String & path,
        const ReadSettings & settings,
        std::optional<size_t> size) const override;
    std::unique_ptr<WriteBufferFromFileBase> writeFile(const String & path, size_t buf_size, WriteMode mode) override;
    void removeFromRemoteFS(RemoteFSPathKeeperPtr fs_paths_keeper) override;
    RemoteFSPathKeeperPtr createFSPathKeeper() const override;
    
    
    
    bool checkUniqueId(const String & hdfs_uri) const override;
private:
    String getRandomName() { return toString(UUIDHelpers::generateV4()); }
    const Poco::Util::AbstractConfiguration & config;
    HDFSBuilderWrapper hdfs_builder;
    HDFSFSPtr hdfs_fs;
    SettingsPtr settings;
};
}