Creating Hardlinks and Symlinks in Android

android Oreo(API 26) add Files.createLink and FileSystemProvider.createLink for hard link.

android lollipop(API 21) add Os.link for hard link

API 26 also add LinkPermission("hard") and LinkPermission("symbolic"), but I do not know how to use them.


Call to Os.link is failing because Android uses FAT32 file system by default for external storage. FAT32 file system does not support hard links and soft links that is why you are getting operation not permitted error.

EPERM The filesystem containing oldpath and newpath does not support the creation of hard links.

You can read more information about link system call here

Furthermore you cannot fake hard links or soft links on FAT32 accurately. And also note that for creating hard link in Android requires root permission.