2

I want to create a symbolic link of a file, such that both the source file and its symbolic link are inside my USB stick drive. I have tried two method as follows:

1- Right click and then "Make Link". The result is an error that says:

The target doesn't support symbolic links.

2- In the terminal, I use:

ln -s "USB_DIRECTORY/test.txt" "USB_DIRECTORY/testLink.txt"

The result is the following error:

Operation not permitted

Is there a way to create symbolic links in a USB stick drive?

  • 1
    What file system is there? (Maybe it is not a linux file system.) – sudodus Apr 23 '18 at 16:28
  • 2
    Source and destination filesystems need to support symbolic links. FAT filesystems do not. I dont think NTFS symbolic links are POSIX compliant. – Bruni Apr 23 '18 at 16:30
  • 1
    My USB is formatted as FAT32. Which file system is suitable for a USB stick that first, supports the symbolic link and second, can be used in any operating system (including Linux, Windows, and Mac)? – Unique Apr 23 '18 at 16:39
2

Try UDF

UDF is a free file system, that works with Linux and Windows.

There are problems in MacOS. I have no Apple computer, but I have read that MacOS can manage UDF. However, recent tests by @Unique, the OP, indicates that it does not work. There are different versions (of UDF), and we must conclude that the version described here is not supported by MacOS.

UDF supports linux symbolic links.

There is a detailed description how to install it in this AskUbuntu link:

Full compatibility with Linux, Windows and MacOS

  • UDF probably lacks tools to repair the file system,

    • FOSS
    • Maybe it is possible to find repair tools in Windows via this link: fsck tools for UDF, and there is some tool available as source code
    • Can be created in Ubuntu
    • Compatible with linux style links.
    • Compatible with linux style permissions. You can create and modify permissions of individual files (which is not possible with FAT and NTFS).
    • A UDF partition will not be prompted for formatting by Windows 10 (while the linux ext4 file system is affected, and can be destroyed by mistake).
    • How to create and use UDF: Using the UDF as a successor of FAT for USB sticks

      So, to use it, assuming your USB stick is /dev/sdx:

      1. Install the package udftools

        sudo apt-get install udftools
        
      2. Create a partition table and one partition with gparted or gnome-disks

      3. Wipe the first mibibyte of the target partition with the risky dd (double-check the command line!)

        sudo dd if=/dev/zero of=/dev/sdx1 bs=1M count=1
        
      4. Run mkudffs,

        sudo mkudffs -b 512 --media-type=hd --lvid=my-label /dev/sdx1
        

      Wipe the first mibibyte of the partition to erase the previous file system information (or other remaining data), to prevent you USB stick from being detected as a FAT after it has been formatted with UDF.

      The -b 512 is to force a file system block size equal to the USB stick's physical block size, as required by the UDF specification. Adapt it if you have the luck of having a USB stick with a more appropriate block size.

      After that, your USB stick will be usable for reading and writing with GNU/Linux and the other free operating systems of course, but also with current versions of Windows (read-only with the outdated version XP) and with MacOS.


From Wikipedia

Universal Disk Format (UDF) is a profile of the specification known as ISO/IEC 13346 and ECMA-167 and is an open vendor-neutral file system for computer data storage for a broad range of media. In practice, it has been most widely used for DVDs and newer optical disc formats, supplanting ISO 9660. Due to its design, it is very well suited to incremental updates on both recordable and (re)writable optical media. UDF is developed and maintained by the Optical Storage Technology Association (OSTA).

  • 1
    After doing these instructions, I am able to create symbolic links on Linux, but unfortunately, the MacOs High Sierra does not mount the USB stick. – Unique Apr 23 '18 at 20:12
  • 1
    @Unique, I have read that MacOS can manage UDF, but there are different versions (of UDF), and it is possible that this version is not supported by MacOS, which is too bad. I will modify the answer. – sudodus Apr 24 '18 at 5:20
  • @everybody, who runs both Ubuntu and MacOS (various versions), Please make a partition with the UDF file system in a USB pendrive and test if MacOS can manage it (mount the partition, write and read files). – sudodus Apr 24 '18 at 5:32
1

FAT32, unlike NTFS, does not support symlinks, as per https://www.linuxquestions.org/questions/blog/the-dsc-472367/not-even-linux-can-create-symlinks-on-fat32-36281/ and https://superuser.com/questions/216332/is-there-anything-like-a-link-or-shared-mount-point-for-fat32-folders-in-linux-a

Therefore, if you want symlinks on a Windows-readable drive, use NTFS.

Mac OS X requires additional work to enable writing to a USB flash drive as per http://osxdaily.com/2013/10/02/enable-ntfs-write-support-mac-os-x/ and https://techsviewer.com/write-ntfs-drives-macos-high-sierra/ but is able to read NTFS natively.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.