NTFS USB on Torizon OS

Hi everyone,
I’m trying to handle the mounting of a NTFS usb key in Torizon OS. Current setup:

Software summary
Bootloader:               U-Boot
Kernel version:           5.15.148-6.6.0-devel-6.6.0-devel+git.23a8e831749d #1-TorizonCore SMP PREEMPT Thu Feb 29 20:25:21 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/cc0ef91894079e4feee54bcbbd00fa84f6a72325a6ce51d9ba99437ab56b6a94/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.6.0-devel-20240313-build.529
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-imx8mp-15128331

Hardware info
HW model:                 Toradex Verdin iMX8M Plus WB on Yavia Board
Toradex version:          0064 V1.1A
Serial number:            15128331
Processor arch:           aarch64

When I plug a fat usb key, it is correctly recognized and auto-mounted under /media.
Output of lsblk:

sda            8:0    1 28.6G  0 disk
`-sda1         8:1    1 28.6G  0 part /var/rootdirs/media/UBUNTU 18_0
mmcblk2      179:0    0 14.6G  0 disk
`-mmcblk2p1  179:1    0 14.6G  0 part /var
mmcblk2boot0 179:32   0    4M  1 disk
mmcblk2boot1 179:64   0    4M  1 disk
zram0        253:0    0    0B  0 disk

In this case, I can read and write my /media/UBUNTU\ 18_0/ directory

When I plug a NTFS usb I see these messages in dmsg:

[ 3664.893749] usb 1-1.1: new high-speed USB device number 6 using xhci-hcd
[ 3665.029549] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[ 3665.030994] scsi host0: usb-storage 1-1.1:1.0
[ 3666.076037] scsi 0:0:0:0: Direct-Access      USB      SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
[ 3666.077633] sd 0:0:0:0: [sda] 120176640 512-byte logical blocks: (61.5 GB/57.3 GiB)
[ 3666.079063] sd 0:0:0:0: [sda] Write Protect is off
[ 3666.079080] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 3666.079432] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 3666.087797]  sda: sda1
[ 3666.090468] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 3666.370180] ntfs: driver 2.1.32 [Flags: R/W MODULE].
[ 3666.371679] ntfs: (device sda1): parse_options(): Unrecognized mount option windows_names.

and the Usb is not auto-mounted:

sda            8:0    1 57.3G  0 disk
`-sda1         8:1    1 57.3G  0 part
mmcblk2      179:0    0 14.6G  0 disk
`-mmcblk2p1  179:1    0 14.6G  0 part /var
mmcblk2boot0 179:32   0    4M  1 disk
mmcblk2boot1 179:64   0    4M  1 disk
zram0        253:0    0    0B  0 disk

If I manually mount it via sudo mount /dev/sda1 /media/ntfs-usb, I can access the usb under /media/ntfs-usb, I can read from it but I cannot write; a write operation throws Read-only file system

Searching online and in the forum seems that ntfs-3g is required to mount read/write a NTFS usb. However, I find no way to add it in Torizon OS.

My final goal is to access the mounted usb in a container but following this topic, I was able to access all directories mounted in /media so my problem here is how to access with write access a NTFS usb.

thanks in advance

NTFS (New Technology File System) is a proprietary file system developed by Microsoft for Windows operating systems. Pre-built Yocto Project images for Toradex systems do not include built-in support for mounting, reading, and writing to NTFS-formatted disks.
However, there are Linux solutions available, such as the ntfs-3g driver, that can be integrated into your Yocto Project image to enable limited NTFS functionality. It’s important to be aware of potential limitations when using NTFS on a Linux system, such as:

  • Permissions: NTFS permissions may not translate perfectly to Linux permissions.
  • Performance: NTFS might not perform as well as native Linux file systems like ext4.
  • Stability: While generally stable, using NTFS for critical data might introduce a slight risk of data corruption in case of unexpected system crashes.

For optimal performance, security, and permission control, it’s recommended to use a native Linux file system like ext4 on your Toradex system.

Hi @alex.tx
thank you for your answer.
One of the big reasons to choose Toradex product is TorizonOS, so I won’t build my own Yocto build, but I’m interested in what is (or will be) available in Torizon. OS.
I know that NTFS is proprietary solution by MS, and based on my experience it’s not so common having an USB key formatted with NTFS.
On the other side, since the caustomer uses its own USB key, what is the filesystem on it is out of my control.
Yes, I can write in the manual that some filesystems are supported and some others aren’t, but all of us know that almost nobody reads manuals :frowning:
And whan a customer (1 every 100, or less, probably) plugs his own NTFS-formatted USB key into my product it doesn’t works. And he will complain, for sure.
If NTFS won’t be available in TorizonOS, is there a way to detect that the filesystem is not suppported? In this way I can show a warning to the user (at least, as a workaround).

This is the reason why I asked for this feature.

Hello @vix,

While writing to an NTFS volume is not currently supported on Torizon OS by default, this can be done on a container.

The ntfs-3g utility required for this is a userspace package, therefore, if you include it in your container and mount the flash drive within the container which will write to the device, no additional component is needed on the base Torizon OS.

This approach does not allow for Torizon OS to easily auto-mount the flash drive, but this functionality can be setup in a container with sufficient permissions.

I did a quick test and ntfs-3g is capable of mounting an NTFS-formatted flash drive and write to it within a container. This package is available on the debian feeds and can be easily installed to a container running on Torizon OS.

Best Regards,