You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Blobfuse2使用touch命令更新ADLS存储中文件的时间戳?

Blobfuse2挂载ADLS后touch更新时间戳不同步问题解决

问题根源

  1. 缓存模式限制:当前使用的stream缓存组件仅针对文件内容读写做优化,默认不支持将utimens(时间戳修改)操作同步到ADLS云端。从日志可见,执行touch后仅触发了本地属性读取(Datalake::GetAttr),无任何云端元数据更新请求。
  2. 文件打开标志不兼容:日志中Flags (8801) not supported to open ... when write back cache is on的警告表明,touch操作打开文件时的标志位不被stream缓存支持,导致时间戳变更无法被捕获并同步。

解决方案

1. 切换到file_cache并启用云端同步

修改blobfuse2.yaml配置,替换缓存组件为file_cache并开启同步:

allow-other: true

logging:
  type: base
  level: log_debug
  file-path: ./blobfuse2.log

components:
  - libfuse
  - file_cache
  - azstorage

libfuse:
  attribute-expiration-sec: 10  # 缩短属性缓存过期时间,加快同步感知
  entry-expiration-sec: 10
  negative-entry-expiration-sec: 240

file_cache:
  path: /mnt/blobfuse_cache  # 替换为本地可用的缓存目录
  timeout-sec: 30
  sync-to-cloud: true  # 强制缓存变更同步到云端
  upload-delay-sec: 0  # 立即同步,无延迟

attr_cache:
  timeout-sec: 10  # 避免本地缓存旧元数据

azstorage:
  type: adls
  account-name: MASK
  account-key: MASK
  endpoint: https://MASK.blob.core.windows.net
  mode: key
  container: input

操作步骤:

  • 卸载现有挂载:blobfuse2 unmount input2
  • 重新挂载:blobfuse2 mount input2 --config-file=blobfuse2.yaml
  • 执行touch操作后,检查ADLS端文件时间戳是否更新

2. 启用libfuse的utimens同步(Blobfuse2 >=2.0.0)

若不想切换缓存模式,可尝试在libfuse配置中添加sync-utimens选项:

libfuse:
  attribute-expiration-sec: 120
  entry-expiration-sec: 120
  negative-entry-expiration-sec: 240
  sync-utimens: true  # 强制将时间戳修改同步到云端

注意:该功能仅在Blobfuse2 2.0.0及以上版本支持,需先确认版本:blobfuse2 --version

3. 临时手动同步(azcopy)

若以上方案无法立即实施,可使用azcopy手动更新文件元数据:

azcopy set-properties "https://<your-account>.dfs.core.windows.net/input/<your-file>" --last-modified "$(date -u +%Y-%m-%dT%H:%M:%SZ)"

验证要点

  • 执行touch后,查看Blobfuse2日志是否出现Datalake::SetAttr或类似云端更新请求
  • 登录Azure Portal,检查ADLS容器中目标文件的Last modified时间是否与本地挂载点一致

内容的提问来源于stack exchange,提问作者Ivan Freire

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 03:29:55