I need some help...
I have a raspberry pi 4b with a SATA hat and four 1GB HDD's attached to the SATA Hat. I have them mounted as sda1 through to sdd1 and the correct entries in my /etc/fstab file. They all mount at boot and I can find them in their respective mount points /mnt/disk1 through 4.
The problem I have is and I'll try to explain here. I have three printers connected to a USB hub and that hub in turn is connected to the Raspberry Pi's USB port. Two of the 3D Printers have SKR 1.4 Turbo boards and those boards have a SD Card slot. If I have the printers powered on when I start my Raspberry Pi it mounts those two SD cards as sda1 & sdb1. This then kicks out my HDD's sda1 and sdb1 and moves al my drive up by one letter, so sda1 moves to sdc1, sdb1 moves to sdd1 etc. As I have the RepeaterServer folder linked to sda1 (more space than the pi's sd card) my whole server crashes.
I have found that /etc/udev/rules.d/10-flash.rules has three rules for mounting USB devices as sda1 etc. Is there any way I can either move my HDD's sda1..4 to another device or do the same with the USB devices tagged in the 10-flash.rules file?
The problem I have is and I'll try to explain here. I have three printers connected to a USB hub and that hub in turn is connected to the Raspberry Pi's USB port. Two of the 3D Printers have SKR 1.4 Turbo boards and those boards have a SD Card slot. If I have the printers powered on when I start my Raspberry Pi it mounts those two SD cards as sda1 & sdb1. This then kicks out my HDD's sda1 and sdb1 and moves al my drive up by one letter, so sda1 moves to sdc1, sdb1 moves to sdd1 etc. As I have the RepeaterServer folder linked to sda1 (more space than the pi's sd card) my whole server crashes.
I have found that /etc/udev/rules.d/10-flash.rules has three rules for mounting USB devices as sda1 etc. Is there any way I can either move my HDD's sda1..4 to another device or do the same with the USB devices tagged in the 10-flash.rules file?
Comments
The flash rules like
are quite simple as we do not know the device exactly. What you need is mount your drive by UUID so it is always mounting exactly your drive regardless of sdX name, like described e.g. here:
https://www.simplified.guide/linux/disk-mount-uuid
When I mount my HDD sda1 to /mnt/disk1 the usb-mount.service scripts also then mount the same hdd to /media/flash, the same applies to sdb1 > /media/flash2 and sdc1 > /media/flash3. This as I understand is because of a service located at /usr/local/Repetier-Server/scripts/usb-mount.service (I'm not 100% sure it is located in that dir, I'm not infant of the machine right now).
Is there anyway to either edit the /usr/local/Repetier-Server/scripts/usb-mount.service to prevent this or even remove the service all-together?
I have my HDD's as sda sdb sdc sdd and each has a partition which I have been mounting sda1..2..3..4 > /mnt/disk1..2..3...4 etc. as soon as I had mounted sda1 for example the usb-mount.service calls /usr/local/Repetier-Setup/bin/usb-mount which then mounts it /media/flash. So running lsblk -f I could see that sda1 had been mounted to media/flash and it is also mounted to /mnt/disk1.
Looking at that usb-mount script it is looking for sda1..2..3 which it then mounts to /media/flash..2..3. When I then connected my printers USB hub to the PI's USB port my HDD's would all move from sda1 to sdc1 etc. and the SKR boards would take sda1 & sdb1 but my HDD's would stay as sda..b..c..d and still be mounted to /media/flash etc.. Shouldn't matter if I use UUID in fstab? I have mounted the HDD's using their UUID's in fstab but for some reason that didn't seem to work and the server would crash after a short while. Perhaps you could add to that /usr/local/Repetier-Setup/bin/usb-mount script the SUBSYSTEMS to TAG option and have it only mount devices tagged as USB?
Since the pi has no HDD ports natively, what system does your hard disk use? Isn't that USB as well? I think if so it should just be added in udev rules to only match the subsystem, but I already said removing the file should help already. Makes not much sense anyway with 7 HDD devices at start up and none is a usb stick.
Also our scripts mount flash folders, I think it is possible to mount same device multiple times, so should not affect you mounting it on your preferred place.
But how do you tell serve to use hdd instead? One important thing is that the folder/mount must exist before server starts or it will fail.
Name shift with SKR present can happen - as I said order of detection by linux gives naming here.
I have reinstalled the raspberry pi image but this time I have written it to a USB thumb drive which is now the boot device. The SD Card is no longer needed.
ls -l /dev/disk/by-id
The above output is missing one HDD as per...
df -h
So, having re-installed and by using a usb device to boot from everything so far has been very stable.
Again apologies if I have come across wrong.
df only shows mounted devices - /dev/disk/by-id shows connected disks. Not necessary the same since there is no automounter active except the 10-flash.rules solution maybe, but not sure you have them on or off. See no mount to the normal mount point so assume off.
You need to add all mounts by id to /etc/fstab so they get mounted on startup by linux do designed folder.
What I also miss is / folder in df output. /dev/sda2 I guess it would be.