Answer the question
In order to leave comments, you need to log in
How to remount a drive on a sudden shutdown?
I use an external usb disk with two partitions on the raspberry pi4. One for nextcloud cloud storage, the second for your needs. I mount partitions in fstab like this:
proc /proc proc defaults 0 0
PARTUUID=560a887e-01 /boot vfat defaults 0 2
PARTUUID=560a887e-02 / ext4 defaults,noatime 0 1
UUID=2EFC775BFC771C71 /mnt/usbstorage ntfs nofail,uid=www-data,gid=www-data,dmask=0007 0 0
UUID=48840E20840E10DC /mnt/transcend ntfs nofail,uid=pi,gid=pi 0 0
tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=512M 0 0
tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30M 0 0
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
sudo umount -a
sudo mount -a
#!/bin/bash
if ! mountpoint -q /mnt/usbstorage
then
mount -U 2EFC775BFC771C71 /mnt/usbstorage
fi
if ! mountpoint -q /mnt/transcend
then
mount -U 48840E20840E10DC /mnt/transcend
fi
Answer the question
In order to leave comments, you need to log in
Try using autofs. It mounts on demand, unmounted the rest of the time.
The second option is to set up udev rules. As the disk falls off, do "umount -l", as it appears - "mount".
Many years ago I did something similar here at the end of the article . Surely the syntax has changed, but you can get the idea.
2 discs is a big deal. In any case, for previous generations, even one disk did not always pull out.
There are complaints about the lack of power in the logs?
The Raspberry Pi 4B has a 1.2A limit on all ports. Look at the consumption of an external hard drive and other peripherals. Had a similar problem recently.
The disk is clearly losing power, but is it really interesting to write a more script to reconnect?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question