USB flash drives are widely used to store various files and directories. They are great to exchange data from or to different computers. They are found literally everywhere. In this recipe, we are going to mount an external USB flash drive. This way, you will have access to the contents of the flash drives.
This recipe requires the following ingredients:
A booted up Linux on the Banana Pi
A USB flash drive
Access to the Banana Pi's shell
Perform the following to successfully mount a USB flash drive (also called USB disk):
Boot up your Linux distribution on the Banana Pi.
Attach the USB flash drive to one of the available USB ports, as shown in the following image:
Determine the USB device by entering the following command into a shell:
$ sudo fdisk –l
You will see a list of attached disks. The following screenshot shows the output of the...
Besides the mounting of disks via USB, the Banana Pi provides a SATA interface. This interface provides greatly improved performance compared to USBs for hard disk drives (HDD) or solid state disks (SSD).
This recipe requires the following ingredients:
A Banana Pi
USB power supply unit
An SD card containing a Linux distribution
A hard disk drive or solid state drive
A SATA-to-SATA cable and a SATA power supply for your drive or SATA cable with power supply terminals
Access to the Banana Pi's shell
All these products can be bought from retailers. The SATA cable with power supply terminals is quite rare. You might search for that item on online stores that specialize in single-board computers. If you search for Banana Pi SATA cable with power terminals or similar on your desired search engine, you will find retailers for that product.
In this recipe, we are going to automount our drives using the fstab
(located at /etc/fstab
) system file.
The following components are required to mount drives conveniently using the fstab
file:
A working Linux system on the Banana Pi
A USB flash drive and/or a SATA drive
In case of a SATA drive, a working connection to your Banana Pi and a suitable power supply
Access to the Banana Pi's shell
Perform the following to configure a drive in your fstab
:
Connect your devices accordingly.
Power your Banana Pi and initiate the boot sequence.
Open a shell.
Determine the used filesystems by blkid
on attached partitions:
$ sudo blkid
You will get information about all the available partitions. In the following screenshot, you see that the drive /dev/sda
has three partitions (sda1
using ext4, sda2
using FAT32, and sda3
using NTFS):
Create the necessary target directories to mount these partitions:
$ sudo mkdir /mnt/ext4_partition $ sudo mkdir /mnt/fat_partition $...
This recipe explains how to copy the root filesystem from the SD card to an external disk and boot from it. This is an advanced recipe. You will still require an SD card as the kernel with the necessary filesystem drivers located at the first partition of the SD card.
You may want to move your root filesystem from the SD card to an external drive for performance and/or space reasons. Also when having a lot of I/O operations on the SD card, the SD card may become unstable. A filesystem on a SATA attached disk is more stable in general.