Setting Up and Using External Storage Devices on NI Linux Real-Time Targets

概要

This document describes how to detect, partition, and format your ext4 file system. Mass storage must be provisioned (partitioned and formatted) prior to use. NI recommends using the ext4 filesystem for removable storage devices for best performance. If cross-platform accessibility is required, i.e., with Windows devices, FAT32 can be used. Please note that FAT32 does not support files larger than 4 GByte and partition size is limited to a maximum of 2 TByte. You will have to use Linux shell commands to perform the following steps. Alternatively, to a locally attached display and keyboard, SSH remote access to the LinuxRT system can be used. SSH access can be enabled via NI MAX. Windows 10 b1709 and later ship with a native ssh client that can be used from a command prompt. You can log into your LinuxRT system with ssh admin@<RT system's IP address>.

Procedure

Note: You must have admin privileges to provision mass storage devices.
WARNING – ALL DISK PARTITIONS AND DATA ON THE TARGETED DRIVE WILL BE LOST!

  1. Physically attach the removable storage to the LinuxRT system.
  2. Get command shell access as admin via SSH or local display and keyboard.
  3. Find the internal storage ID with
    ls /dev/disk/by-id/ | grep -v 'part.@$'
  4. Copy or memorize the ID for your external storage. Please replace any occurence of <storage ID> in the following commands with this ID. You can use TAB to complete the device paths.
  5. Unmount the storage with
    umount /dev/disk/by-id/<storage ID>*
  6. Create a GPT partition table containing a single partition with
    echo -e 'label: gpt\n;' | sfdisk /dev/disk/by-id/<storage ID> --no-reread -W always -f --no-tell-kernel

  7. Format the new partition as ext4 as follows. If you prefer FAT32, replace ext4 with fat. Note that you have to attach -part1 to your storage ID.
    mkfs.ext4 <storage ID>-part1

  8. Finally, mount the new partition into the LinuxRT file system to access files and data. To mount it into /media/usb, create the folder and mount it with the following commands:
    mkdir -m 777 /media/usb
    chown -R lvuser:ni /media/usb
    (This is necessary to enable storage access for LabVIEW code.)
    mount -o rw,users /dev/disk/by-id/<storage ID>-part1 /media/usb

Automatically Mount Storage After Reboot

If you wish to mount the storage automatically after a reboot of the RT system into /media/usb, run the following command once:

echo "/dev/disk/by-id/<storage ID>-part1 /media/usb ext4 rw,users 0 2" >> /etc/fstab