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.

const Poco::Util::AbstractConfiguration & config,
                      const String & config_prefix,
                      ContextPtr context,
                      String & path,
                      UInt64 & keep_free_space_bytes)
{
    path = config.getString(config_prefix + ".path", "");
    if (name == "default")
    {
        if (!path.empty())
            throw Exception(
                "\"default\" disk path should be provided in <path> not it <storage_configuration>",
                ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG);
        path = context->getPath();
    }
    else
    {
        if (path.empty())
            throw Exception("Disk path can not be empty. Disk " + name, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG);
        if (path.back() != '/')
            throw Exception("Disk path must end with /. Disk " + name, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG);
    }
    if (!FS::canRead(path) || !FS::canWrite(path))
        throw Exception("There is no RW access to the disk " + name + " (" + path + ")", ErrorCodes::PATH_ACCESS_DENIED);
    bool has_space_ratio = config.has(config_prefix + ".keep_free_space_ratio");
    if (config.has(config_prefix + ".keep_free_space_bytes") && has_space_ratio)
        throw Exception(
            "Only one of 'keep_free_space_bytes' and 'keep_free_space_ratio' can be specified",
            ErrorCodes::EXCESSIVE_ELEMENT_IN_CONFIG);
    keep_free_space_bytes = config.getUInt64(config_prefix + ".keep_free_space_bytes", 0);