❰ Back

External storage utility for minimal systems



This post aims to provide a secure, handy and minimal way to mount and access external USB storage on a minimal system (without a DE).

Note : Please note that the most minimal an secure way would be to manually mount your devices to /media but I find that method slow and bothersome because of the file permission issues.

First, we need to allow users to mount external filesystems. Install the udisks2 and polkit packages :

# xbps-install polkit # xbps-install udisks2

And start the polkitd daemon :

# ln -s /etc/sv/polkitd/ /var/service/ && sv start polkitd

Now, users should be able to interact with USB storage with the default polkit rules using the udisksctl utility ( see udisksctl -h ).

Bashmount script

In order to easily interact with USB storage, the wrapper of choice is the shell script bashmount. It allow to use USB storage, optical disk drive and luks encrypted devices.

$ git clone https://github.com/jamielinux/bashmount && cd bashmount && mv bashmount /usr/local/bin/

I recommend setting up a configuration file for bashmount, first create the required directory:

$ mkdir -p ~/.config/bashmount

Place in that directory either the default configuration file found Here or my personal configuration file found Here. Once everything is setup, you're good to go. Simply plug your USB device, fire up the bashmount script and enjoy.

Rofidisk script

If Bashmount is not to your liking (as it is not to mine) you may use a POSIX script that I've written with minimalism and speed in mind. $ git clone git://korosama.xyz/rofidisk It uses rofi in dmenu mode to display a menu with the available actions :

!!! Please note that by default, the script assumes that your system is installed on the /dev/sda drive and only looks for drives begining /dev/sdb1,2,3... then /dev/sdc1,2,3... !!!

Thank you for reading.