Hi Glenn, I prepared a USB drive formatted as ext4 and did all the steps you described. That worked except I had to run an additional "sudo chown weewx:weewx /mnt/sqlbackup" after "sudo mount /dev/sdb1 /mnt/sqlbackup" in order to have the right group and user (weewx:weewx).
Finally, I succeded to write a backup on the drive. A strange behavior however: if I umount the drive and mount it again, I do not see anymore the backup sub-folder in the file manager but, if I run a "ls -al /mnt/sqlbackup", I can see it on the terminal... File manager indicates no sub-folder in sqlbackup directory pi@raspberrypi:~ $ ls -al /mnt/sqlbackup total 28 drwxr-xr-x 4 weewx weewx 4096 4 mars 14:20 . drwxr-xr-x 3 root root 4096 4 mars 13:33 .. drwxr-xr-x 2 weewx weewx 4096 4 mars 14:20 20240304 drwx------ 2 root root 16384 4 mars 13:22 lost+found If I connect the USB drive to another computer, the backup folder including the 2 usual files is present (visible)... If I stop weewx and restart the Rpi, I recover a normal behavior and the File manager shows all files and folder. As a conclusion I would say that the problem seems to be fixed, though I found the solution a bit complicated and fastidious. I would never have found myself how to proceed. Thanks a lot for your help. Cheers, Pierre-Yves Le lundi 4 mars 2024 à 13:06:41 UTC+1, Glenn McKechnie a écrit : > And that research will benefit you, so it's worth doing - always. > > But as you've found this issue, and as I need to add some notes to the > README for weewx-sqlbackup - that cover this new issue. You get the first > draft and if it needs adjusting, tell me. > > So; In brief, and as the root user (or sudo it) . > > *mkdir /mnt/sqlbackup* > *chown weewx:weewx /mnt/sqlbackup *(or chmod whatever) > > plug your usb drive in, ( and hopefully the system auto mount will get out > of our way). > Use *dmesg* to identify the partition on this backup drive, then use *fdisk > -l* to confirm it (optional). > This example uses */dev/sd?1* - you will have something more meaningful. > > test it by mounting the drive. > > *mount /dev/sd?1 /mnt/sqlbackup* > *ls -al /mnt/sqlbackup* > > All okay? Is it what you expect? Then ... > > *umount /mnt/sqlbackup.* > > Now, add the following line to your */etc/fstab* file; perhaps with an > appropriate comment > > # added a weewx sql backup drive. RTFM with *man fstab* > */dev/sd?1 /mnt/sqlbackup ext4 errors=remount-ro 0 0* > > Save the file and mount it (and everything else - redundantly) with > * mount -a* > > I'm assuming it's formatted as *ext4* - adjust as required; and I've > specified* 0 0* on that fstab entry to remind me that there are no file / > boot up checks on that drive. > > That's the gist of it. Tweak as you like. > > Ah, and change the skin.conf entry to point to it. > > > > Cheers > Glenn > > rorpi - read only raspberry pi & various weewx addons > https://github.com/glennmckechnie > > On Mon, 4 Mar 2024 at 22:13, Pierre-Yves <[email protected]> wrote: > >> Thanks a lot Glenn. >> I need to dig a little deeper into this story of connection under mnt and >> mounting via fstab. My knowledge of these tools is a little limited ;-) >> Pierre-Yves >> >> Le lundi 4 mars 2024 à 10:54:26 UTC+1, Glenn McKechnie a écrit : >> >>> >>> On Mon, 4 Mar 2024 at 19:07, Pierre-Yves <[email protected]> wrote: >>> >>>> [...] >>> >>> >>>> >>>> pi@raspberrypi:~ $ ps -adelf | grep [Ww]eewxd >>>> 4 S *weewx* 14866 1 2 80 0 - 26178 - mars03 ? >>>> 00:14:55 python3 /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf >>>> >>>> ls -al '/media/pi/WEEWX-BU' returns: >>>> >>>> pi@raspberrypi:~ $ ls -al '/media/pi/WEEWX-BU' >>>> total 273976 >>>> *drwxr-xr-x 5 pi pi 4096 1 janv. 1970 .* >>>> *drwxrwxrwx+ 3 root root 4096 3 mars 17:59 ..* >>>> -rw-r--r-- 1 pi pi 8622 22 déc. 16:46 >>>> 'as3935(min_strikes).py' >>>> drwxr-xr-x 12 pi pi 4096 2 mars 14:18 Belchertown >>>> drwxr-xr-x 12 pi pi 4096 1 mars 18:27 Belchertown-old >>>> -rw-r--r-- 1 pi pi 4156 6 févr. 23:27 bme280wx.py >>>> -rw-r--r-- 1 pi pi 1616 7 févr. 00:00 >>>> Commandes-usuelles.txt >>>> -rw-r--r-- 1 pi pi 40148 1 mars 21:50 graphs.conf >>>> -rw-r--r-- 1 pi pi 148331 28 juin 2023 'sdr(last).py' >>>> drwxr-xr-x 5 pi pi 4096 28 oct. 18:04 Seasons202310281704 >>>> -rw-r--r-- 1 pi pi 40047 1 mars 21:28 skin.conf >>>> -rw-r--r-- 1 pi pi 36467 1 mars 09:00 weewx.conf >>>> -rw-r--r-- 1 pi pi 280235008 2 mars 15:26 weewx.sdb.backup >>>> >>>> PS: I use also this usb drive for manually saving various files and >>>> folders without any problem (skins, database...) >>>> >>>> It seems, in view of the table above, that the drive is not properly >>>> mounted with regards to the weewx 5.0.2 rules. I tried to change using >>>> chown, but I got an "operation denied"... >>>> >>> >>> This has me perplexed. >>> >>> The /media directory seems to be treated differently by the system. I've >>> tried to change ownership / permissions on a test drive and it's not >>> behaving as I expect. >>> I'm able to make those same changes under /mnt so I'm missing something. >>> I need an up-slap to the back of the head, a far stronger cup of coffee or >>> probably just a hefty dose of RTFM. In the meantime, I'll blame systemd :P >>> >>> If you don't want to relocate that drive (understandable), and you have >>> a spare USB slot then I'd be plugging a fresh drive in under /mnt and >>> mounting it via fstab. You can then manually set the permissions to weewx >>> and they'll stick. >>> >>> And, if someone knows the answer. I'm all ears >>> >>> Cheers >>> Glenn >>> >>> rorpi - read only raspberry pi & various weewx addons >>> https://github.com/glennmckechnie >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "weewx-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-user/0914053a-b235-4f51-b660-ca432d9ba46en%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-user/0914053a-b235-4f51-b660-ca432d9ba46en%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/3c5c00e8-1600-4db0-b9cf-497aa3b9ef9en%40googlegroups.com.
