I have an Orange Pi One with the Armbian OS. I want to use it to collect data from sensors 24/7. And be able to save the database to a flash drive.
Considering the presence of only one USB port, as well as a certain autonomy of the device, I would like to automate the process of copying the database. I would like to do this: a flash drive is inserted, auto-mounting occurs based on this event, the indicator begins to blink and automatic copying occurs, then automatic unmounting occurs, and the indicator begins to flash differently, signaling that the copying is completed and the flash drive can be removed.
The problem is the automatic mounting and unmounting of the flash drive.
- First I decided to install the usbmount utility...
But it apparently is not in the repository:sudo apt install usbmountReading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package usbmount - Then I tried to insert into the
.shcalled by the rule from/etc/udev/rules.dthe command...
The script runs successfully from the command line when the flash drive is connected. But starting from the rule, this script writes the text to the#!/bin/sh sleep 15 echo "mount runs" >> /mydir/log.txt echo MY_PASSWORD | sudo mount /dev/sda1 /flashlog.txtfile, but does not mount the disk.
Then I read about /etc/fstab. In particular, this method.
- I inserted the flash drive, executed the command
and got the UUIDlsblk -fNAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS sda ├─sda1 vfat FAT32 0698-A3CF └─sda2 vfat FAT16 VTOYEFI 3A23-0E50 - Then I made changes to
/etc/fstab, replacing only theUUIDand timeouts (set to 15):UUID=0698-A3CF /mnt/32GBkey vfat noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=15,x-systemd.device-timeout=15 - Then along with
sudoI updated the changes:sudo systemctl daemon-reload && sudo systemctl restart local-fs.target - I unmounted the flash drive and pulled it out. The
lsblk -fcommand showed that the flash drive is no longer there.
I restarted it and ran lsblk -f again. The flash drive is still recognized, but the MOUNTPOINTS column is still empty. The flash drive was not mounted.
What am I doing wrong?