Mount with noauto_da_alloc
# mount | grep ' / '
/dev/nvme0n1p1 on / type ext4 (rw,relatime,discard,noauto_da_alloc,data=ordered)
root@ip-10-0-0-127:~/slow-mv# cat empty-file.sh
#!/bin/bash
echo "Copy time:"
time cp 5GB 5GB.copy
echo "Move time:"
time mv 5GB.copy 5GB
# ./empty-file.sh
Copy time:
real 0m31.431s
user 0m0.023s
sys 0m3.386s
Move time:
real 0m0.301s
user 0m0.000s
sys 0m0.258s
Previously the mv
would take almost 11 seconds on this system, now it's only .3 seconds with noauto_da_alloc
.