Configuring Storage Devices

You can connect your external SSD or USB disk to the corresponding port on the device and mount the file system to access the data stored on it. When the device is turned off, it is necessary to unmount the storage device so that it can be safely pulled out.

The connectable storage devices of device include USB storage devices and SSD. This chapter introduces how to configure the mounting and unmounting of storage devices.

Mounting a Storage Device

If the Lite version of the operating system is used (the Desktop version of the system supports automatic mounting), after the storage device is connected to the corresponding port on the device, it is necessary to mount the storage device in a specific folder location through configuration, usually in the /mnt folder, such as /mnt/mydisk.

TIP

The "/mnt" folder must be empty.

Preparation:

The storage device is ready to be mounted.

Steps:

  1. Connect the storage device to be mounted to the corresponding port on the device (USB storage device is inserted into USB port).
  2. Run the following command to view all disk partitions on the device.
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL

​After running the command, the information displayed is as follows:

image-20240603154811246

  • UUID、NAME、FSTYPE、SIZE、MOUNTPOINT、LABEL and MODEL are disk parameters that need to be listed.

  • The types of MOUNTPOINT are“/”and“/boot”.

  • The storage device whose LABEL is "ADMESY" is the inserted USB storage device, and the corresponding disk name is sda1.

  • FSTYPE indicates the file system type contained.

  • If the file system type of the inserted storage device is exFAT, please run the following commands to install the exFAT driver.

​sudo apt update
​sudo apt install exfat-fuse

​- If the file system type of the inserted storage device is NTFS (only read permission is supported), you can install ntfs-3g driver to realize write permission. Run the following commands to install ntfs-3g drivers.

​sudo apt update
​sudo apt install ntfs-3g
  1. Run the following command to get the location of the disk partition.
sudo blkid

​After running the command, the following information is displayed, which the disk partition of the connected storage device is displayed as "/dev/sda1".

image-20240603155248473

  1. Create a target folder as the mount point of the storage device. Assuming that the mount name is mydisk and the directory to be mounted is "/mnt", the command to be executed is as follows:
sudo mkdir /mnt/mydisk
  1. Mount the storage device at the created mount point, and execute the following command:
sudo mount /dev/sda1 /mnt/mydisk
  1. Verify the success of mounting the storage device by executing the following command.
ls /mnt/mydisk
  • After executing the command, if the displayed information lists all files in the storage device, it means that the mount is successful.
  • After executing the command, if the displayed information does not list the contents of related files, it means that the mount is failed.

Unmount The Storage Device

When the device is turned off, it is necessary to manually unmount the storage device so that it can be pulled out safely.

WARNING

Both Lite and Desktop versions of the system need to manually unmount the storage device.

Preparation:

The storage device has been successfully mounted.

Steps:

If "/mnt" is the mounted directory and "mydisk" is the name of the mount point, you can execute the following command to complete the unmounting.

sudo umount /mnt/mydisk
  • After executing the command, if no error message is displayed, it means that the unmounting has been completed and the storage device can be completely pulled out.
  • After executing the command, if an error message is displayed, it means that the unmounting is failed.

Set The Storage Device To Mount Automatically

If you are using the Lite version of operating system, you can automatically mount it by modifying the fstab settings.

Preparation:

The storage device to be mounted has been connected to the corresponding port on the device.

Steps:

  1. Execute the following command to view all disk partitions on the device and get the file system type of the storage device to be mounted, as “vfat” shown in the figure below.
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL

image-20240603160833957

  1. Execute the following command to obtain the UUID of the storage device to be mounted, such as "7C9E-4F13" in the figure below.
sudo blkid

image-20240603160858901

  1. Execute the following command to open the fstab file.
sudo nano /etc/fstab
  1. Add the following to the fstab file.
UUID=7C9E-4F13 /mnt/mydisk vfat defaults,auto,users,rw,nofail 0 0
  • The value of UUID is the value found in Step 2 above.
  • /mnt is the directory to be mounted, and mydisk is the name of the mount point.
  • Vfat is the file system type queried in step 1.
  • If the type of file system is FAT or NTFS, the added content is "UUID = 7C9E-4F13 /mnt/mydisk vfat defaults,auto,users,rw,no fail umask = 000 0 0",which will allow all users to "read/write" access to each file on the storage device.

WARNING

More information about the fstab command can be viewed by executing the man fstab command.

  1. Use Ctrl+X to save the file and exit edit mode.