W
W
White2020-10-30 21:27:23
Hard disks
White, 2020-10-30 21:27:23

Automatic remount usb-hdd if it fell off?

Good day to all! So I have a Raspberry pi4

Linux raspberrypi 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l GNU/Linux
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster

There are two usb-hdd, the system is on one and it is connected directly to the raspberry port, the second 1Tb is used for network file trash and is connected via an active usb-hub, because. there is not enough food for him from raspberries. The second hdd is mounted automatically at system startup (registered in fstab),
proc /proc proc defaults 0 0
PARTUUID=79cd0320-01 /boot vfat defaults 0 2
PARTUUID=79cd0320-02 / ext4 defaults,noatime 0 1
#HDD 1Tb
UUID=2e328abe-05aa-4a48-a033 /mnt/1tb ext4 defaults,auto ,users,rw,nofail,x-systemd.device-timeout=30 0 0

The second hdd, which is 1 Tb periodically falls off 2-3 times a week and, accordingly, is not remounted, you have to connect remotely and reboot the system or manually remount it. There was an idea to set up a watchdog timer, but vpn and dns server are still on the raspberry, so it is not advisable to lay down the system. Is it possible to somehow automate the remounting of hdd if it is not available, without rebooting the system with a script, or can I write something in fstab?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hint000, 2020-10-31
@Harvester_pi

mount | grep 1tb || mount /mnt/1tb
add this to cron or whatever; the meaning of the command is obscenely simple: if not mounted, then mount.
And with what frequency it is checked - your business.

P
paran0id, 2020-10-31
@paran0id

You can try to make it automount via udev.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question