Mass storage must be provisioned (partiioned and formatted) prior to use. For Windows-based systems this typically happens via a GUI-based wizard or the Disk Management tool located within the Computer Management application. For Linux-based LabVIEW Real-Time targets National Instruments recommends using the Linux ext4 file system for mass storage devices.
Note: You must have admin privileges to provision mass storage devices.
WARNING – ALL DISK PARTITIONS AND DATA ON THE TARGETED DRIVE WILL BE LOST!
Drives in Linux are listed by the command:
/dev/disk/by-id
Typically, mass storage will appear as sdb, sdc, etc. If a drive has partitions these will be displayed as a suffix of 1, 2, etc. depending on the partition. For example, on the cRIO-9030 the internal drive and partitions will appear as
- Internal SSD: sda
- SD Card: sdb
- USB drive: sdc, etc.
Once you identify the mass storage device you’d like to provision, make note of its label (e.g. sdc), referred to as <disk> for the rest of these steps.
Next partition the drive using fdisk and the disk label by entering:
fdisk /dev/<disk>
This will start the fdisk program. Menu options may differ slightly based on the version of the utility, but ‘m’ will list help.
Commands for partitioning within fdisk:
- ‘o’ to create an empty partition
- ‘n’ to create a new partition
- ‘p’ to set this partition as primary
- ‘1’ to set partition number 1
- First and last sector, use defaults
- ‘t’ to set partition type
- ‘83’ to set Linux partition type
- ‘a’ to make partition active
- ‘p’ to print the partition table as defined
- ‘w’ to write the partition table and exit fdisk
Depending on the initial state of the drive, you may need to force a refresh of the partition tables using the 'partprobe' command before continuing. Alternatively, you can remove and reinsert the mass storage device.
You may need to first unmount the drive using the command :
umount /dev/<disk>
Next use the mkfs.ext4 command to format the partition as designation by <disk+partition>, for example:
sdc1
mkfs.ext4 /dev/<disk+partition>
or
mkfs.ext4 /dev/<disk+partition> -L <disk label>
if you wish to label the partition.
Note that you may see drive activity for a few minutes after remounting the drive. This is a temporary background task that creates the disk journal of newly-created ext4 file systems.
It is strongly recommended to re-enumerate (connect and reconnect the drive) or reboot the target system to cleanly mount the newly partitioned drive before using.
You can use the follow command to reboot:
/sbin/shutdown -r now