How to use bash to test directory limits of filesystem

泪湿孤枕 提交于 2019-12-10 23:13:04

问题


I need to test how many directories and files I can create on a filesystem (network mounted and local (usb) drives). I now use this bash line:

for i in {0..999999}; do mkdir -p $i; pushd $i; done

I know that it probably can be done better and I'd like to know how to. (in bash, not too complicated)


回答1:


while (true); do
  mkdir a
  cd a
done

Creates something like ./a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/...




回答2:


Any file/directory is represented using an inode, take a look at df -i and you should get an overview of the number of files/directories you have the possiblity to create/use.




回答3:


The cd method actually works better and faster... My ext4 usb stick starts to mock at about 1040 folders...

And the network part is to test my wins2k3 config, but my virtualbox fails at the moment because I think I screwed something up...



来源:https://stackoverflow.com/questions/4279590/how-to-use-bash-to-test-directory-limits-of-filesystem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!