Properly Mount USB Storage Arch Linux on Banana Pi Pro

banana-pi-arch-linuxThis guide will show you how to properly mount a USB Storage device of multiple formats on Arch Linux on the Banana Pi Pro by LeMaker, it will also deal with future permissions. This guide is quite small and straight to the point leaving it as a quick and proper solution to creating a full-time NAS or Media server. It is assumed that you installed Arch Linux on the Banana Pi by following this guide. If not please look over it for required details.

Pi Unit
Processor
RAM
RAM Bus
Network
WiFi
USB
SATA
Cost
Raspberry Pi 3
1.2 GHz ARMv8
Quad Core
1 GB DDR2
450 MHz
100 Mbit
Yes
4
No
$35
Raspberry Pi 2
900 MHz ARMv7
Quad Core
1 GB DDR2
450 MHz
100 Mbit
No
4
No
$35.00
Raspberry Pi
700 MHz ARMv6
Single Core
512 MB SDRAM
400 MHz
100 Mbit
No
4
No
$25
Banana Pi
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
No
2
Yes
$36.99
Banana Pi Pro
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
Yes
2
Yes
$45.00

Properly Mount USB Storage Arch Linux on Banana Pi Pro

This tutorial assumes you only have 1 USB Storage connected to the Banana Pi Pro. If so then it should be attached to /dev/sda1 – additional USB Storage Devices will use /dev/sdb1 and /dev/sdc1 etc.  If you have multiple USB Storage Devices you will need separate mount points for each drive (e.g. /mnt/usbstorage1 and /mnt/usbstorage2).

Make the folder mount point for the USB Storage

sudo mkdir /mnt/usbstorage

Set the owner of the mount point the default user

sudo chown -R bananapi:bananapi /mnt/usbstorage

Set the permissions of the Mount point

sudo chmod -R 775 /mnt/usbstorage

Set the permissions for the future to the mount point, here the group called bananapi will always own any folders created in /mnt/usbstorage

sudo setfacl -Rdm g:bananapi:rwx /mnt/usbstorage
sudo setfacl -Rm g:bananapi:rwx /mnt/usbstorage

If you are using NTFS as your format

sudo pacman -Syy ntfs-3g

If you are using ext/2/3/4 as your format

sudo pacman -Syy exfat-utils

Check where your USB Drive is

sudo fdisk -l

This is what my one displayed, we are looking for the one that's your USB Storage Device; usually /dev/sda1

Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd3e77104

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 31116287 31114240 14.9G 83 Linux
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x44882154

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 3907026943 3907024896 1.8T 7 HPFS/NTFS/exFAT

To mount the ntfs and fat32 USB Storage Devices use this command

sudo mount -o uid=bananapi,gid=bananapi /dev/sda1 /mnt/usbstorage

To mount the ext/2/3/4 USB Storage Devices use this command

sudo mount -t uid=bananapi,gid=bananapi /dev/sda1 /mnt/usbstorage

Find the UUID of the USB Storage device to Automatically boot on start

sudo blkid

Find your USB Storage Device, this is mine for example

/dev/sda1: LABEL="Desgyz HDD (2TB)" UUID="52722E32722E1B6D" TYPE="ntfs" PARTUUID="44882154-01"

We need the UUID and TYPE, copy these

UUID="52722E32722E1B6D" TYPE="ntfs"

Open up fstab

sudo nano /etc/fstab

Goto the bottom and paste this but using your UUID, If you are mounting NTFS

UUID=52722E32722E1B6D /mnt/usbstorage ntfs nofail,uid=bananapi,gid=bananapi 0 0

If you are mounting fat32

UUID=52722E32722E1B6D /mnt/usbstorage fat32 nofail,uid=bananapi,gid=bananapi 0 0

If you are mounting ext/2/3/4

UUID=52722E32722E1B6D /mnt/usbstorage ext4 nofail,defaults 0 0

Now test the mount works

sudo mount -a

If you got no errors then reboot

sudo reboot

You should now have now properly mounted USB storage Arch Linux on the Banana Pi Pro which automatically connects on boot and has future proof permissions.