Ali*_*tan 5 find disk-usage mv
我使用以下命令在我的服务器上查找和移动大量文件:
find SomeDir/ -maxdepth 10 -type f -mtime +90 -exec mv {} SomeDir2/ \;
Run Code Online (Sandbox Code Playgroud)
移动大约 700,000 个文件后,我收到此错误:
mv: cannot move ‘SomeDir/Dir1/Dir2/Dir3/file.jpg.gz’ to ‘SomeDir2/file.jpg.gz’: No space left on device
Run Code Online (Sandbox Code Playgroud)
df -i
有以下结果:
/dev/sdb1 322125824 144163358 177962466 45% /files
Run Code Online (Sandbox Code Playgroud)
df -h
有以下结果:
/dev/sdb1 4.8T 3.5T 1.1T 78% /files
Run Code Online (Sandbox Code Playgroud)
我做所有的操作/files
,没有其他目录
文件系统是ext4
.
更新
按照建议我跑dmesg -Hwx
,输出是EXT4-fs warning (device sdb1): ext4_dx_add_entry:2016: Directory index full!
max_dir_size_kb
您可能在目录挂载时超出设置(或保留默认值):
Run Code Online (Sandbox Code Playgroud)max_dir_size_kb=n This limits the size of the directories so that any attempt to expand them beyond the specified limit in kilobytes will cause an ENOSPC error. This is useful in memory-constrained environments, where a very large directory can cause severe performance problems or even provoke the Out Of Memory killer. (For example, if there is only 512 MB memory available, a 176 MB directory may seriously cramp the system's style.)
(翻译为ENOSPC
错误消息)No space left on device
perror
因此,请确保在安装时未指定该选项(或指定了一个非常大的数字)。
另外,备注: