1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
| ossfs 是阿里云提供的一款工具,可将对象存储(OSS)的 Bucket 挂载为 Linux 系统上的本地文件系统,使用户能像操作本地文件一样访问 OSS 数据。
目前 ossfs 有两个主要版本:
- **ossfs 1.0**:基于 FUSE 实现,适用于 AI 训练、大数据分析等需类本地文件操作的场景,但不适用于高并发混合读写或强一致性要求的业务。其写入机制为“先写本地缓存,文件关闭时才上传至 OSS”,因此不适合直接用于长期打开的日志文件等场景。
- **ossfs 2.0**:在 1.0 基础上进行了性能优化,显著提升大文件顺序读写和高并发小文件访问能力,更适合 AI 训练/推理、大数据处理等计算密集型任务。它仅支持顺序追加写入,不支持随机写或并发写同一文件。
两者均仅支持 Linux 系统(如 CentOS 7.0+、Ubuntu 20.04+、Alibaba Cloud Linux 2+),依赖 FUSE 2.8.4+,且不支持 Windows、硬链接、归档类 Bucket 等。
安全方面推荐使用 RAM 用户最小权限 AccessKey(配置于 `/etc/passwd-ossfs`,权限 640)或 ECS RAM Role 自动获取临时凭证。非 root 用户(如 www)挂载时需指定 `-ouid`、`-ogid` 和 `-o passwd_file` 参数。
如需高性能或新型 AI/ML 场景,建议优先选用 ossfs 2.0。
相关链接 ossfs 1.0 | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/ossfs-overview/ 文件上传 ossfs文件上传原理-对象存储-阿里云_对象存储(OSS) | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/file-upload ossfs 2.0 | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/ossfs-2-0/ ossfs如何通过非root用户挂载Bucket到ECS实例 ossfs挂载Bucket时指定非root用户-对象存储-阿里云_对象存储(OSS)[KB:39524] | 对象存储 https://help.aliyun.com/zh/oss/how-ossfs-mounts-a-bucket-to-an-ecs-instance-by-using-a-non-root-user ossfs | 对象存储 https://help.aliyun.com/zh/oss/ossfs-faq/ 通过 ossfs 存储应用程序日志 通过 ossfs 存储应用程序日志_对象存储(OSS) | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/ossfs-storing-application-logs 安装ossfs 2.0 在Linux系统中安装ossfs 2.0_对象存储(OSS) | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/install-ossfs-2-0
在 ossfs 1.0 中,将挂载配置写入 `/etc/fstab` 的格式如下:
``` ossfs#bucket_name mount_point fuse _netdev,url=url,allow_other 0 0 ```
其中:
- `bucket_name` 替换为实际的 OSS Bucket 名称; - `mount_point` 替换为本地已存在的挂载目录路径; - `url=url` 中的 `url` 替换为对应 Bucket 的 Endpoint(如 `https://oss-cn-hangzhou.aliyuncs.com`)。
该配置适用于 Ubuntu 14.04 及以上、CentOS 6.5 及以上系统。配置前需确保已将 AccessKey 信息写入 `/etc/passwd-ossfs` 并设置权限为 640。
相关链接 挂载存储空间 | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/advanced-configurations 配置开机自动挂载 在Linux系统重启后自动挂载OSS存储空间-对象存储-阿里云_对象存储(OSS) | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/configure-auto-mount-on-for-ossfs-2-0
使用 ossfs 挂载广州地域的 OSS Bucket 并启用 V4 签名,需在挂载命令或 `/etc/fstab` 中明确指定 `-osigv4` 和 `-oregion=cn-guangzhou`。
### 1. **命令行挂载格式**
```bash ossfs your-bucket-name /mount/point -o url=https://oss-cn-guangzhou.aliyuncs.com -o sigv4 -o region=cn-guangzhou ```
- `your-bucket-name`:替换为您的实际 Bucket 名称 - `/mount/point`:替换为本地已存在的挂载目录 - Endpoint 使用 `https://oss-cn-guangzhou.aliyuncs.com`(公网);若在同地域 ECS 内网访问,请改用 `https://oss-cn-guangzhou-internal.aliyuncs.com`
### 2. **写入 `/etc/fstab` 的格式**
```fstab ossfs#your-bucket-name /mount/point fuse _netdev,allow_other,url=https://oss-cn-guangzhou.aliyuncs.com,sigv4,region=cn-guangzhou 0 0 ```
> ⚠️ 前提条件: > > - 已将 AccessKey 写入 `/etc/passwd-ossfs`,并执行 `chmod 640 /etc/passwd-ossfs` > - 系统已安装 FUSE 且 ossfs 版本 ≥ 1.91.4(支持 V4 签名)
希望以上信息能帮到您,如有其他问题,欢迎随时提出!
相关链接 1.91.4版本 | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/version-1-91-4 挂载存储空间 | 对象存储 https://help.aliyun.com/zh/oss/developer-reference/advanced-configurations 创建存储空间 | 对象存储 https://help.aliyun.com/zh/oss/user-guide/create-a-bucket-4
您遇到的错误包含两个关键问题,需分别处理:
---
### 一、挂载点非空导致挂载失败
**错误信息**:
``` ossfs: MOUNTPOINT directory /mnt/ossfs1 is not empty. if you are sure this is safe, can use the 'nonempty' mount option. ```
**原因分析**: ossfs 默认要求挂载目录必须为空。若目录中存在文件或子目录(即使未被其他文件系统占用),挂载将被拒绝。
**解决方案**: 在挂载命令或 `/etc/fstab` 配置中显式添加 `nonempty` 挂载选项。
- **命令行示例**(广州地域 + V4 签名):
```bash ossfs your-bucket /mnt/ossfs1 \ -o url=https://oss-cn-guangzhou.aliyuncs.com \ -o sigv4 \ -o region=cn-guangzhou \ -o allow_other \ -o nonempty ```
- **/etc/fstab 示例**:
```fstab ossfs#your-bucket /mnt/ossfs1 fuse _netdev,allow_other,url=https://oss-cn-guangzhou.aliyuncs.com,sigv4,region=cn-guangzhou,nonempty 0 0 ```
> **重要提醒**: > 使用 `nonempty` 前请确认目录内原有文件不会与 OSS 内容冲突。挂载后,原本地文件将被隐藏(卸载后恢复),但不会被删除。
---
### 二、fstab 修改后 systemd 未生效
**错误信息**:
``` mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. ```
**原因分析**: systemd 在启动时会缓存 `/etc/fstab` 的内容。修改 fstab 后若未重载配置,执行 `mount -a` 或系统自动挂载仍会使用旧规则。
**解决方案**: 执行以下命令强制 systemd 重新加载 fstab 配置:
```bash sudo systemctl daemon-reload ```
之后再尝试挂载:
```bash sudo mount -a ```
---
### 完整操作流程建议:
1. **确保挂载目录存在且权限正确**:
```bash sudo mkdir -p /mnt/ossfs1 sudo chmod 755 /mnt/ossfs1 ```
2. **配置 `/etc/passwd-ossfs` 并设置安全权限**:
```bash echo "your-bucket:ACCESS_KEY_ID:ACCESS_KEY_SECRET" | sudo tee /etc/passwd-ossfs sudo chmod 640 /etc/passwd-ossfs ```
3. **编辑 `/etc/fstab` 添加完整挂载项**(含 `nonempty` 和 V4 参数)。
4. **重载 systemd 并测试挂载**:
```bash sudo systemctl daemon-reload sudo mount -a ```
> **注意**:若仍报错,请检查 ossfs 版本是否 ≥ 1.91.4(V4 签名最低要求),并确认 Bucket 所在地域为 `cn-guangzhou`。
相关链接 常见问题 挂载问题 挂载报错"ossfs: Mountpoint directory /tmp/ossfs is not empty. if you are sure this is safe, can use the 'nonempty' mount option" https://help.aliyun.com/zh/oss/developer-reference/ossfs-faq ossfs 1.0异常问题排查 适用场景1:挂载失败 解决方案 https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/troubleshooting-ossfs-exception ossfs 1.0存储卷FAQ 挂载 OSS存储卷挂载失败,业务Pod Event提示FailedMount https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/faq-about-oss-volumes-1 常见问题 挂载问题 挂载报错MOUNTPOINT: Directory does not exist: /mnt/ossfs2 https://help.aliyun.com/zh/oss/developer-reference/ossfs-2-0-faq ossfs常见挂载报错原因分析 挂载报错 "ossfs: Could not determine how to establish security credentials. Please check your password file, ram\_role, or environment variables." https://help.aliyun.com/zh/oss/analysis-of-common-mount-error-causes-of-ossfs NFS文件系统常见挂载错误原因及其解决方案 mount: /nfs/testdir: mount point does not exist https://help.aliyun.com/zh/alinux/support/common-mount-errors-of-nfs-file-system-and-their-solutions Alibaba Cloud Linux 4操作系统自启动配置指南 问题原因及解决方案 问题原因分析 https://help.aliyun.com/zh/alinux/support/alibaba-cloud-linux-4-startup-configuration-guide 挂载文件系统失败故障排查 挂载NFS协议文件系统时,返回mount: can't find /root/nas in /etc/fstab该如何处理? https://help.aliyun.com/zh/nas/user-guide/fix-mount-issues Linux系统通过接入点访问文件系统 接入点挂载失败排查 挂载文件系统时,返回mount.nfs: Unknown error 521该如何处理? https://help.aliyun.com/zh/nas/user-guide/linux-system-accesses-file-system-through-access-point Linux系统的ECS实例中,启动SSH服务时提示“must be owned by root and not group or world-writable”错误怎么办? 问题现象 https://help.aliyun.com/zh/ecs/what-should-i-do-if-the-must-be-owned-by 常见报错 任务运行中常见的报错 DTS-RETRY-ERR-0127:MongoCommandException (.\)? cloud instance error (.\)? disk locked https://help.aliyun.com/zh/dts/support/common-errors-and-troubleshooting/ 跨应用和平台,AI记忆不再丢失_部署教程 手动部署 应用到生产环境 服务自启动 https://www.aliyun.com/solution/tech-solution-deploy/2974766 在Linux实例中执行systemctl命令报错怎么办? https://help.aliyun.com/zh/ecs/support/what-do-i-do-if-an-error-occurs-when-i-run-the-systemctl-command-on-a-linux-instance Linux实例 命令执行结果差异 解决方案 https://help.aliyun.com/zh/ecs/user-guide/differences-between-running-commands-remotely-and-locally-on-linux-instances ossfs 2.0存储卷FAQ 挂载 OSS存储卷挂载失败 https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/ossfs2-0-storage-volume-faqs 启动容器镜像出现docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]报错 解决方案 https://help.aliyun.com/zh/egs/support/what-do-i-do-if-docker-error-response-from-daemon-could-not-select-device-driver-with-capabilities-gpu-is-reported-during-a-container-image-startup 【产品公告】关于 Ubuntu 节点 systemd 升级后容器网络异常的公告 解决方案 控制台 https://help.aliyun.com/zh/ack/product-overview/announcement-on-container-network-anomaly-after-ubuntu-node-systemd-upgrade 出错提示“Deprecated XFS mount options present in FSTAB” 解决方案 https://help.aliyun.com/zh/smc/support/how-to-do-if-the-deprecated-xfs-mount-options-present-in-fstab-error-message-appears
ossfs 1.0 最新版(以 1.91.x 及以上版本为代表)支持丰富的挂载参数配置,涵盖认证、网络、缓存、权限、性能调优等多个维度。以下基于阿里云官方文档对 ossfs 1.0 的参数能力进行系统梳理,并重点回答您关心的**缓存时间设置**和**缓存目录位置**问题。
---
### 一、ossfs 1.0 支持的主要配置参数分类
#### 1. **认证与 Bucket 配置**
| 参数 | 说明 | | ------------------ | ------------------------------------------------------------ | | `url` | 指定 OSS Endpoint,如 `https://oss-cn-guangzhou.aliyuncs.com` | | `passwd_file` | 指定 AccessKey 配置文件路径,默认为 `/etc/passwd-ossfs` | | `sigv4` + `region` | 启用 V4 签名时必须同时指定,如 `-osigv4 -oregion=cn-guangzhou`(注意:在命令行中为两个独立选项,在 fstab 中合并为 `sigv4,region=xxx`) |
> **注意**:V4 签名要求 ossfs 版本 ≥ 1.91.4。
#### 2. **权限与用户映射**
| 参数 | 说明 | | ------------- | ------------------------------------------------------------ | | `uid` / `gid` | 设置挂载点内所有文件/目录归属的用户 UID 和组 GID | | `umask` | 权限掩码,用于调整文件默认权限(如 `umask=022` 使文件权限变为 644/755) | | `allow_other` | 允许非挂载用户访问挂载点(需配合 FUSE 配置,通常仅 root 可用) |
#### 3. **元数据缓存控制(关键)**
| 参数 | 默认值 | 说明 | | --------------------- | --------------------------------- | ------------------------------------------------------------ | | `max_stat_cache_size` | 100,000(1.91+)<br>1,000(旧版) | 元数据缓存条目上限,单位为“个”。设为 `0` 可禁用缓存,但会显著增加 HeadObject 请求量 | | `stat_cache_expire` | 900 秒(15 分钟) | 元数据缓存失效时间。设为 `-1` 表示永不过期(**不推荐**,除非数据完全静态) | | `readdir_optimize` | false | 启用后 `ls` 不主动请求每个文件的元数据(如 uid/gid),可减少请求,但部分场景仍需 HeadObject | | `disable_noobj_cache` | false(即启用) | 控制“文件不存在”信息是否被缓存(1.91.6+ 新增) |
✅ **结论:ossfs 1.0 支持设置缓存时间**,通过 `stat_cache_expire` 参数控制元数据缓存的有效期。
#### 4. **数据缓存(临时文件缓存)**
| 参数 | 说明 | | ----------------- | ------------------------------------------------------------ | | `use_cache` | **启用本地数据缓存**,并指定缓存目录路径(如 `-ouse_cache=/tmp/ossfs-cache`) | | `tmpdir` | 指定临时文件目录(用于写入过程中的中间文件),**不能与 `use_cache` 同时使用** | | `del_cache` | 挂载/卸载时自动清理 `use_cache` 指定目录下的缓存文件 | | `ensure_diskfree` | 预留磁盘空间(MB),防止缓存占满磁盘 |
> **默认行为**:若未指定 `use_cache`,ossfs **不会持久化缓存读取的数据**,但写入操作仍会使用系统临时目录(如 `/tmp`)作为中间缓存。
#### 5. **性能与网络调优**
| 参数 | 默认值 | 说明 | | --------------------------------------- | -------------- | -------------------------------------------------- | | `parallel_count` | 20(1.91+) | 分片上传并发数 | | `multipart_size` | 30 MB(1.91+) | 分片大小 | | `max_dirty_data` | 5120 MB | 写入超过此阈值时提前上传(避免大文件关闭前不上传) | | `connect_timeout` / `readwrite_timeout` | 300 / 120 秒 | 连接与读写超时 | | `retries` | 2 | 请求失败重试次数 |
---
### 二、缓存目录具体存在哪里?
#### 1. **元数据缓存(Metadata Cache)**
- **存储位置**:纯内存缓存,**不落盘**。 - **作用对象**:文件/目录的元信息(如大小、修改时间、权限等)。 - **控制参数**:`max_stat_cache_size`、`stat_cache_expire`。
#### 2. **数据缓存(Data Cache)**
- **默认情况**:**不启用**,除非显式指定 `-ouse_cache=PATH`。 - **启用后位置**:由 `use_cache` 参数指定的目录(如 `/data/ossfs-cache`)。 - **内容**:已读取的文件数据块会被缓存到该目录,后续读取可直接从本地返回。 - **注意事项**: - 缓存目录需有足够磁盘空间; - 缓存不会自动清理,需手动或通过 `del_cache` 控制; - **不适用于强一致性场景**,因缓存可能滞后于 OSS 实际数据。
#### 3. **临时文件目录(用于写入)**
- **默认位置**:系统临时目录(通常是 `/tmp`)。 - **可覆盖参数**:`tmpdir`(如 `-otmpdir=/data/tmp`)。 - **用途**:写入文件时先写入本地临时文件,关闭时才上传至 OSS(ossfs 1.0 的核心机制)。
---
### 三、重要提醒
- **缓存一致性风险**:元数据和数据缓存均无法实时感知其他客户端(如 OSS 控制台、ossutil、SDK)对文件的修改,可能导致读取陈旧数据。若业务对一致性要求高,应: - 降低 `stat_cache_expire`(如设为 60 秒); - 或禁用缓存(`max_stat_cache_size=0`,但性能下降); - 避免使用 `use_cache`。
- **安全建议**:AccessKey 应使用 RAM 用户最小权限,并将 `/etc/passwd-ossfs` 权限设为 `640`。
---
综上,ossfs 1.0 最新版**支持通过 `stat_cache_expire` 设置元数据缓存时间**,而**数据缓存需手动启用并指定目录**,默认情况下仅使用内存缓存元数据、使用 `/tmp` 作为写入临时目录。
相关链接 配置ossfs 1.0 https://help.aliyun.com/zh/oss/developer-reference/configurations-for-ossfs-1-0 使用ossfs 1.0静态存储卷 kubectl https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/mount-statically-provisioned-oss-volumes 使用ossfs 1.0动态存储卷 kubectl 1、创建存储类StorageClass https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/use-dynamically-provisioned-oss-volumes ossfs 1.0存储卷FAQ 挂载 OSS存储卷挂载时间延长 https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/faq-about-oss-volumes-1 挂载选项说明 https://help.aliyun.com/zh/oss/developer-reference/common-options 使用数据集 高级配置示例 使用ossfs 2.0挂载访问OSS https://help.aliyun.com/zh/dataworks/user-guide/use-datasets 元数据缓存 配置选项 https://help.aliyun.com/zh/oss/developer-reference/ossfs-metadata-cache ossfs 1.0新版本功能介绍及性能压测 1.91及以上版本新增功能 基础POSIX操作优化和缺陷修复 https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/introduction-of-new-functions-and-performance-pressure-measurement-of-ossfs-version-1-91-and-above 使用数据集 高级配置示例 使用ossfs 2.0挂载访问OSS https://help.aliyun.com/zh/dataworks/user-guide/use-datasets-1 减少OSS请求并提升挂载点性能 优化方式 延长元数据缓存时间 https://help.aliyun.com/zh/oss/developer-reference/optimise-metadata-requests-to-speed-up-file-loading 数据缓存 配置选项 https://help.aliyun.com/zh/oss/developer-reference/ossfs-data-cache 挂载选项说明 常用配置项 https://help.aliyun.com/zh/oss/developer-reference/description-of-mount-options ossfs 2.0 功能介绍 POSIX API支持情况 https://help.aliyun.com/zh/oss/developer-reference/ossfs-2-0/ 提升ls命令文件列出速度 参数说明 https://help.aliyun.com/zh/oss/developer-reference/accelerate-file-listing 配置ossfs 2.0 常用配置示例 挂载Bucket并配置内存限制 https://help.aliyun.com/zh/oss/developer-reference/configure-ossfs-2-0
要判断当前 ossfs 挂载是否启用了 **OSS V4 签名**,可通过以下三种权威方法进行验证:
---
### 一、检查挂载命令或 `/etc/fstab` 配置中是否显式启用 V4
ossfs 默认使用 **V1 签名**。只有在挂载时**同时指定 `-osigv4` 和 `-oregion=<region-id>`**,才会启用 V4 签名。
✅ **正确启用 V4 的命令示例(广州地域)**:
```bash ossfs my-bucket /mnt/oss -o url=https://oss-cn-guangzhou.aliyuncs.com -o sigv4 -o region=cn-guangzhou ```
✅ **/etc/fstab 中的正确写法**:
```fstab ossfs#my-bucket /mnt/oss fuse _netdev,allow_other,url=https://oss-cn-guangzhou.aliyuncs.com,sigv4,region=cn-guangzhou 0 0 ```
> ⚠️ **关键点**: > > - 仅加 `sigv4` 而未指定 `region`,挂载会失败或回退到 V1; > - `region` 必须与 Bucket 实际所在地域一致(如广州为 `cn-guangzhou`),否则会报 `Invalid signing region` 错误。
---
### 二、通过抓包或日志查看 HTTP 请求头中的 `Authorization` 字段
这是**最直接、最可靠**的判断方式。V1 与 V4 签名在请求头中有明显区别:
| 签名版本 | `Authorization` 头格式特征 | | ----------- | ------------------------------------------------------------ | | **V1 签名** | 以 `OSS` 开头:<br>`Authorization: OSS LTAIxxxx:signature_base64` | | **V4 签名** | 以 `OSS4-HMAC-SHA256` 开头:<br>`Authorization: OSS4-HMAC-SHA256 Credential=LTAIxxxx/20250405/cn-guangzhou/oss/aliyun_v4_request, AdditionalHeaders=..., Signature=...` |
🔍 **操作建议**:
- 使用 `tcpdump` 或 `Wireshark` 抓取 ossfs 发往 OSS Endpoint 的 HTTPS 流量(需解密或使用 HTTP 代理); - 或启用 ossfs 调试日志(挂载时加 `-d -f` 参数),观察输出中是否包含上述 V4 格式的 Authorization 头。
> 📌 **注意**:由于 HTTPS 加密,默认无法直接看到明文头,建议在测试环境临时使用 HTTP Endpoint(如 `http://oss-cn-guangzhou.aliyuncs.com`)以便抓包分析(生产环境不推荐)。
---
### 三、检查 ossfs 版本是否支持 V4 签名
V4 签名功能**从 ossfs 1.91.4 版本开始支持**。若版本过低,即使配置了 `sigv4` 也无法生效。
🔧 **查看当前版本**:
```bash ossfs --version # 或 ossfs -V ```
✅ **有效版本示例输出**:
``` ossfs version 1.91.4 ```
> ⚠️ **重要提醒**: > 若版本低于 1.91.4,请先升级 ossfs,否则无法使用 V4 签名。阿里云已明确通知:**OSS V1 签名将在未来停用**,新用户自 2025 年 3 月 1 日起无法使用 V1,所有用户应尽快迁移到 V4。
---
### 总结:快速确认是否启用 V4 的 checklist
| 检查项 | 是否满足 | | --------------------------------------------------------- | -------- | | ✅ ossfs 版本 ≥ 1.91.4 | 是 / 否 | | ✅ 挂载命令含 `-osigv4` | 是 / 否 | | ✅ 挂载命令含 `-oregion=正确地域ID`(如 `cn-guangzhou`) | 是 / 否 | | ✅ 实际请求头中 `Authorization` 以 `OSS4-HMAC-SHA256` 开头 | 是 / 否 |
**只有全部满足,才表示真正启用了 V4 签名**。
相关链接 挂载存储空间 挂载命令格式 https://help.aliyun.com/zh/oss/developer-reference/advanced-configurations V1签名升级为V4签名 常见问题 如何快速确认我现在使用的是OSS V1签名还是V4签名? https://help.aliyun.com/zh/oss/developer-reference/guidelines-for-upgrading-v1-signatures-to-v4-signatures 签名版本4(推荐) Authorization 请求头 https://help.aliyun.com/zh/oss/developer-reference/recommend-to-use-signature-version-4 1.91.4版本 新增功能 新增支持OSS V4签名功能 https://help.aliyun.com/zh/oss/developer-reference/version-1-91-4 签名版本4(推荐) SDK签名实现 https://help.aliyun.com/zh/oss/developer-reference/add-signatures-to-urls 签名版本4(推荐) POST签名介绍 表单 https://help.aliyun.com/zh/oss/developer-reference/signature-version-4-recommend 初始化(Browser.js SDK) 新建Client V4签名(推荐) https://help.aliyun.com/zh/oss/developer-reference/initialization ossfs常见挂载报错原因分析 挂载报错 "ossfs: Failed to check bucket and directory for mount point : Bad Request(host=http://oss-cn-[RegionID].aliyuncs.com, message=Invalid signing region in Authorization header.)" https://help.aliyun.com/zh/oss/analysis-of-common-mount-error-causes-of-ossfs 常见问题 ossutil支持v4签名么? https://help.aliyun.com/zh/oss/developer-reference/faq-9 签名版本1 https://help.aliyun.com/zh/oss/developer-reference/signature-version-1 初始化(C# SDK V1) 新建OssClient V4签名(推荐) https://help.aliyun.com/zh/oss/developer-reference/initialization-ossclient OSS Java SDK V1 客户端配置 签名版本 https://help.aliyun.com/zh/oss/developer-reference/oss-java-sdk/ 0002-00000034 问题描述 https://help.aliyun.com/zh/oss/user-guide/0002-00000034 常见问题 其他问题 使用ossfs 2.0时出现大量404日志 https://help.aliyun.com/zh/oss/developer-reference/ossfs-2-0-faq
|