There are times when you need to have your external drives mounted when the Jetson Nano boots. Let’s go over it! Looky here:
The Ubuntu documentation has a good summary of storage devices, volumes and partitions. Money quote:
The word volume is used to describe a storage device, like a hard disk. It can also refer to a part of the storage on that device, because you can split the storage up into chunks. The computer makes this storage accessible via your file system in a process referred to as mounting. Mounted volumes may be hard drives, USB drives, DVD-RWs, SD cards, and other media. If a volume is currently mounted, you can read (and possibly write) files on it.
Often, a mounted volume is called a partition, though they are not necessarily the same thing. A “partition” refers to a physical area of storage on a single disk drive. Once a partition has been mounted, it can be referred to as a volume because you can access the files on it. You can think of volumes as the labeled, accessible “storefronts” to the functional “back rooms” of partitions and drives.Ubuntu Documentation
The system does not automatically mount all partitions. For example if you leave a USB drive in and reboot the system, the flash drive does not automatically mount. If you need the drive mounted, let’s say you are using it for a swapfile, you will need to tell the system to automatically mount the drive.
Here’s some documentation about Automounting Partitions Automatically. The discussion is fairly rich in dealing with different system level parameters. In our case, we will be using per-user mounting to automount a drive.
In a previous article on setting up a swapfile on the Jetson Nano, we state that:
If the swapfile is to be loaded at boot time, make sure that the location is mounted when the machine boots.
However, we didn’t really go over how to do that with an external drive, such as a USB drive. In the video, we automount a Samsung 500GB Solid State Disk (SSD), though you can use a smaller SSD, or a USB Hard Disk Drive (HDD). This works with thumb drives too.
The configuration file /etc/fstab contains the necessary information to automate the process of mounting partitions. In a nutshell, mounting is the process where a raw (physical) partition is prepared for access and assigned a location on the file system tree (or mount point).Introduction to fstab
There is a convenience script in the JetsonHacksNano account on Github in the installSwapfile repository. This is the same repository we use in the previous article for installing the swapfile. Note: The repository has been updated to include the autoMount convenience script. You will need to update the repository if it is already installed.
First, clone the repository:
$ git clone https://github.com/JetsonHacksNano/installSwapfile
and then switch to the repositories directory:
$ cd installSwapfile
You are then ready to prepare the fstab entry. You will need to know the volume label which you wish to mount.
$ ./autoMount.sh -l <volume label>
The script will form the fstab entry, and ask if you want to include it in /etc/fstab.
This is an area where there are many options, the script simply uses the most common options for a removable drive. You may want to modify the fstab entry or script to suit your needs.
Automounting is a useful tool when you need to have a drive available right after boot. Hopefully this will guide you (or provide enough information to act as a jumping off point) to set up this feature.
- Tested on Jetson Nano, L4T 32.1.0