164 Star 224 Fork 1.2K

openGauss / docs

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
在XFS文件系统中-使用du命令查询数据文件大小大于文件实际大小.md 973 Bytes
Copy Edit Raw Blame History
liyang authored 2020-12-15 10:33 . fix bugs

在XFS文件系统中,使用du命令查询数据文件大小大于文件实际大小

问题现象

在数据库使用过程中,通过如下du命令查询数据文件大小,查询结果大于文件实际的大小。

 du -sh file

原因分析

XFS文件系统有预分配机制,预分配的大小由参数allocsize确定。du命令显示的文件大小包括该预分配的磁盘空间。

处理办法

  • 将XFS文件系统挂载选项allocsize设置为默认值(64KB)减缓该问题。

  • 使用du命令时,增加--apparent-size选项,查看实际文件的大小。

du -sh file --apparent-size
  • XFS文件系统有回收预分配空间的机制,文件系统可以通过回收文件预分配的空间,使du命令显示为实际文件的大小。
1
https://gitee.com/opengauss/docs.git
git@gitee.com:opengauss/docs.git
opengauss
docs
docs
1.1.0

Search