Speed up mv command in pod

Current my entrypoint inside my docker is doing a mv on a folder which is 5GB.
In kubernetes, the command become a copy and it take up to around 5min for the mv command to complete.
Previously in Vsphere Integrated Container (VIC), the command take 1 sec to complete as it really a move command.

Please let me know if anyone know some setting which i can so that kubernetes will do a mv instead of a copy.

Cluster information:

Kubernetes version: NA
Cloud being used: Private Cloud
Installation method: NA
Host OS: Linux
CNI and version: NA
CRI and version: NA

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

This is entirely about what kind of volume you are using and how your node mounts. If you are copying between different mounts, the move has to become a copy plus delete.

If it is on the same filesystem it SHOULD optimize to a rename(). If it isn’t you might have to peek at whatever tool you are using (e.g. strace) to see why it is deciding it can’t

Any idea how can I force to the same mount? Cause I really just doing a simple mv command and it will be up to system to decide. When i did strace on mv command, it is showing up as a cp command.

You have not provided nearly enough information to hazard a guess on this. We would need to know what kind of volumes, how they are provisioned, where they are mounted, whether the move op crossed volumes, etc.

[root@xtc2381p1a /]# df -h
Filesystem Size Used Avail Use% Mounted on
overlay 49G 26G 21G 55% /
tmpfs 64M 0 64M 0% /dev
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sdc1 147G 61M 140G 1% /etc/hosts
/dev/sdb1 49G 26G 21G 55% /etc/hostname
shm 64M 0 64M 0% /dev/shm
tmpfs 63G 12K 63G 1% /run/secrets/kubernetes.io/serviceaccount
tmpfs 63G 0 63G 0% /proc/acpi
tmpfs 63G 0 63G 0% /sys/firmware

Filesystem is overlay and we are using /

Take note of process 266 which is doing a mv command and did strace on 266 it is doing copy.

[root@xtc2381p1a /]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 15:32 pts/0 00:00:00 /bin/bash /murex/Setup/StartUp.sh
root 245 1 0 15:34 pts/0 00:00:00 /bin/bash /murex/Setup/GetMTEPCus_tar.sh
root 263 245 0 15:35 pts/0 00:00:00 su murex --shell=/bin/bash -c (cd /murex && mv generic-murex mxpacific4 && cp -r generic-dbatch/dbatch /murex/mxpacific4)
murex 264 263 0 15:35 ? 00:00:00 bash -c (cd /murex && mv generic-murex mxpacific4 && cp -r generic-dbatch/dbatch /murex/mxpacific4)
murex 265 264 0 15:35 ? 00:00:00 bash -c (cd /murex && mv generic-murex mxpacific4 && cp -r generic-dbatch/dbatch /murex/mxpacific4)
murex 266 265 4 15:35 ? 00:00:12 mv generic-murex mxpacific4
root 267 0 0 15:36 pts/1 00:00:00 bash
root 297 267 0 15:40 pts/1 00:00:00 ps -ef
[root@xtc2381p1a /]# strace -p 266
strace: Process 266 attached
lstat(“generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template/5_mrtm_unloadSourceCombined.mxres”, {st_mode=S_IFREG|0755, st_size=1314, …}) = 0
renameat2(AT_FDCWD, “generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template/5_mrtm_unloadSourceCombined.mxres”, AT_FDCWD, “mxpacific4/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template/5_mrtm_unloadSourceCombined.mxres”, 0) = 0
utimensat(AT_FDCWD, “mxpacific4/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, [{tv_sec=1659421341, tv_nsec=227339909} /* 2022-08-02T14:22:21.227339909+0800 /, {tv_sec=1656566058, tv_nsec=0} / 2022-06-30T13:14:18+0800 */], 0) = 0
lchown(“mxpacific4/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, 16801, 168) = 0
llistxattr(“generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, NULL, 0) = 46
llistxattr(“generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, “”, 46) = 0
getxattr(“generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, “system.posix_acl_access”, 0x7ffe554f71b0, 132) = -1 ENODATA (No data available)
stat(“generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, {st_mode=S_IFDIR|0755, st_size=4096, …}) = 0
setxattr(“mxpacific4/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, “system.posix_acl_access”, “\2\0\0\0\1\0\7\0\377\377\377\377\4\0\5\0\377\377\377\377 \0\5\0\377\377\377\377”, 28, 0) = 0
getxattr(“generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, “system.posix_acl_default”, 0x7ffe554f71b0, 132) = -1 ENODATA (No data available)
stat(“generic-murex/bin/MRA/20220709_MX3.1.26_RUN_ES_LOCAL_CCY/bin/DBS/yearly/MASBIR-03/template”, {st_mode=S_IFDIR|0755, st_size=4096, …}) = 0