简体   繁体   中英

Improving speed on du command on mount point

Is there a way to improve speed on du command on mount point?

I am looking to retrieve occupied space of top level directory of a specified directory in bytes with below command on a mount point & I see its super slow.

du -b --max-depth=1 <mountName>

Whereas df on other hand works super fast to retrieve data of mount point.

Would like to know if there is a way to use du on mount point & get required data in a faster way?

Also is there a way to get sub-directory size ( in bytes ) on top level directory using different command on a mount point?

du traverses the directory tree, while df doesn't. That is why df is so much faster, but also only works on whole partitions -- it just reads that partition's metadata. I don't think there is a way around du being slower.

Also is there a way to get sub-directory size ( in bytes ) on top level directory using different command on a mount point?

du -b -s <mountpoint>/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM