The behavior you're observing is likely due to how Android's package manager (pm) and the adb uninstall command interact with the /data/data/<package> directory. Here's why /data/data/com.termux_bak/ might be deleted when running adb uninstall com.termux:
Android's Package Manager Behavior:
When you run adb uninstall com.termux, the Android package manager (pm) removes:
com.termux./data/data/com.termux/ directory, including all its contents (files, subdirectories, etc.).Symbolic Links or Bind Mounts:
/data/data/com.termux_bak/ was not a true copy but instead a symbolic link or bind mount pointing to /data/data/com.termux/, then moving the directory with mv would not create an independent copy. Instead, it would just create a new reference to the same data.adb uninstall runs, it removes the original /data/data/com.termux/ directory, which would also delete the data referenced by /data/data/com.termux_bak/ if it was a link or bind mount.Filesystem-Level Behavior:
/data partition may use copy-on-write (CoW) or union filesystems. In such cases, moving a directory might not create a true independent copy, and the uninstallation could still affect the "moved" directory.Termux-Specific Behavior:
/data/data/com.termux/) might have special permissions or SELinux contexts that cause the entire directory tree to be treated as a single unit during uninstallation./data/data/com.termux/If you want to safely back up Termux's data before uninstalling, use one of these methods:
tar to Create a True Copybashadb shell "tar -czf /sdcard/termux_backup.tar.gz -C /data/data/ com.termux" adb pull /sdcard/termux_backup.tar.gz adb shell rm /sdcard/termux_backup.tar.gz
bashadb shell cp -r /data/data/com.termux /sdcard/com.termux_bak
/sdcard), which is not affected by adb uninstall.rsync (if available)bashadb shell rsync -a /data/data/com.termux/ /sdcard/com.termux_bak/
mv Didn’t Work as Expectedmv on Android (especially in /data) might not behave like a traditional Unix mv. If the filesystem is FUSE-based or uses bind mounts, the move operation might not create a true independent copy.adb uninstall command forcefully removes the package's data directory, regardless of whether it was moved or linked.Always copy (not move) data before uninstalling an app if you want to preserve it. Use tar, cp -r, or rsync to ensure a true backup. The mv command in /data may not work as expected due to Android's filesystem quirks.
Vibe can make mistakes. Check answers. Learn more