← Back to Error Index
root@linuxfix:~/exdev$
EXDEV
Invalid cross-device link

Solutions

Prerequisites: Start by updating your system to resolve common issues and ensure the solutions provided below are compatible with your current environment.
check_latest_version && sudo apt update && sudo apt upgrade -y
Use copy instead of link

Copy files across filesystems:

cp source_file /other/filesystem/
rsync -av source/ /other/filesystem/dest/
tar -cf - source | (cd /dest && tar -xf -)
Create symbolic links

Use symlinks which work across filesystems:

ln -s /path/to/file /other/filesystem/link
ln -sf target linkname
Move within same filesystem

Perform operations within the same filesystem:

mv file /same/filesystem/location
find /same/fs -name "file" -exec ln {} /same/fs/link \;

What is EXDEV?

EXDEV occurs when trying to create a hard link across different filesystems or devices.

Common scenarios: Creating hard links between different partitions, moving files across filesystems with rename(), or link operations across mount points.

Common Causes

  • Hard link across different filesystems
  • Rename operation across mount points
  • Link between different devices
  • Cross-filesystem atomic operations
  • Different filesystem types

Debugging Tips

df -h
mount | grep /path
stat file1 file2
findmnt /path/to/file

Prevention

  • Understand filesystem boundaries
  • Use symbolic links for cross-filesystem references
  • Check mount points before operations
  • Use copy operations for cross-filesystem moves
errno filesystem links devices