Why Do My USB Devices Change Directories When My Linux Real-Time Target is Restarted?

Updated Nov 21, 2017

Reported In

Hardware

  • cRIO-9065
  • cRIO-9068
  • cRIO-9063
  • cRIO-9064
  • cRIO-9066
  • cRIO-9031
  • cRIO-9038
  • cRIO-9033
  • cRIO-9039
  • cRIO-9032
  • cRIO-9913

Issue Details

I have multiple USB devices mounted to my Linux cRIO running NI Linux Real-Time. When the cRIO is restarted, the device enumerated as /u is now enumerated as /v and vice versa. Why is this occurring?

Solution

This is expected behavior, see the additional information for further explanation. 

Workarounds that are supported by NI:
  1. You can keep a text file or INI file saved on the USB that can be read to identify the drive. For example, you can compare the text file saved on each device to determine which device is which.
  2. If placing a file on the USB is not an option, you can detect the UUID or partition label of the of the drive by using the blkid utility. This is not installed on cRIO by default but can be installed using opkg Package Manager. Calling blkid -U <UUID> will check if a device matches a specific UUID number. The Install/Configure a Package using opkg on Linux RTOS is a step-by-step guide on how to use opkg.
Note: Software installed via opkg is not officially supported by National Instruments.

Additional Information

The order in which drives are detected and named in Linux is not fixed. On an NI Linux Real-Time cRIO, the first USB that is mounted to the system will be mapped to the /u directory, the second USB will be mapped to /v directory, and so on. If multiple USB drives are removed over time or a USB hub is used, it is expected that the directories the USB drives are mapped to can change, since the USB drives may mount to the operating system in a different order.

WAS THIS ARTICLE HELPFUL?

Not Helpful