I’ve just bought the zimablade Nas kit & installed syncthing.
Got it all working & I can sync photos from my phone back to the zimablade.
However syncthing is saving everything back to the system drive not 1 of my storage drives.
I used the files app & from the 3 dot menu selected “copy path” & pasted that into syncthing, however syncthing then created folders within the system drive to match & saves the files there.
How do I go about specifying that it should save to 1 of the storage drives?
I had this issue too. There’s a surprisingly small amount of documentation about it. Can you see the drive in the Files app? If you can see it in the files app, but not with the others, here’s the process I used to share the external drive with Syncthing. The process will be slightly different with other apps, but should be fairly easy to adapt for most of them. First, find the drive path. If internal, it’s usually /mnt/[NameOfDrive]
. If external, it’s usually a bit more complex, but mine is /media/devmon/[NameOfDrive]
. You can do this by getting into the CasaOS terminal and running the command lsblk
. You should get an output similar to this:
casaos@casaos:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 1.8T 0 disk
└─sda1 8:1 0 1.8T 0 part /media/devmon/sda1-usb-Seagate_Portable
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 475.5G 0 part /
└─nvme0n1p3 259:3 0 976M 0 part [SWAP]
From that command, you’ll want the path for the external drive. In my case it’s /media/devmon/sda1-usb-Seagate_Portable
. Save this path for later use. Next, you’ll need a terminal where you can get root access. You’ll also need to know the username and group of the logged in user. In my case the user is just “casaos” and the group is the same. Unless you’ve done something specific to change the users or groups, the group will likely be the same as the user. Run the command sudo chown [name of user that runs CasaOS]:[group name] --recursive /path/to/drive
. In my case, it looked like sudo chown casaos:casaos --recursive /media/devmon/sda1-usb-Seagate_Portable
. This command may take a few minutes, especially if there are a lot of directories on the drive. This will change the ownership of all files in the drive to be owned by the specificed user. (edited)
Once that is done, you will need to give access to the individual app. As mentioned previously, I’ll use Syncthing as my example. From the CasaOS main page, hover over the Syncthing icon and click the three dots, then choose the “Settings” option. Scroll down until you see the “Volumes” section. Here, you can change the permissions of which folders the Syncthing container is allowed to access and specify where it should store it’s data. To change this to your external drive, look for the field that contains /DATA
under the “Container” column. Then on that same row, change the “Host” value to be the path to your external drive (or whatever path you want Syncthing to have access to).
Finally, click save. From there, you should be able both read and write files within the specified folder. Keep in mind that the “Host” column specifies where the files are actually stored on your device, while the “Container” column specifies where that specific container will think they are. So, if you have a documents folder in the main directory of the external drive, Syncthing will think it’s located at /DATA/Documents
, rather than the full path you would see in the files app.
Thank you so much for your reply, would never have got anywhere on my own.
When I run lsblk I get the following
sda1 is shown as /mnt/Storage1
sda2 is shown as /mnt/Storage2
It would appear casaos has included the external drives into root/mnt/ which I thought was going to make things easier. I can browse to these folders with the files app in casaos.
I added the directory into syncthing settings /DATA as you said, restarted & then created a new folder to share from my phone.
Unfortunately syncthing is continuing to create the above folders within its own config directory Root/DATA/App data/syncthing/config
Completely stumped
I have been having (what appears to be) the same problem to the extent that my 512Gb boot drive has run out of space while my 12Tb storage raid array is empty.
I cannot help with any explanation or solution.
I think because I had totally run out of space the Apps section of my dashboard became empty. From the Storage section of the dashboard I was able to ‘Format and Break’ the raid array, which I did and then recreated it again. I am copying back a lot of media files to the raid array and they do appear to be going there and my boot drive is not being affected.
The first thing I would try is totally uninstalling Syncthing and starting over with the process I outlined above. If you’ve already created folders for it to sync, it may not be getting transferred over correctly. Be sure to select to delete the config folder when uninstalling. To save space, you may need to delete the /DATA/AppData/syncthing
folder manually. Make sure you do this after uninstalling Syncthing or it may try to delete files on your other devices.
Keep in mind that you will need to redo the Volumes section in the Syncthing settings after reinstalling.
If that doesn’t work, I’ve got two ideas of what might be happening:
For the first one, could you send a screenshot of the “Volumes” section in settings? Getting that folder stuff right can be confusing. It certainly took me multiple tries for the first few apps.
For the second, the ownership may not have transferred correctly. But when this happened for me, I got an error in Syncthing when trying to create the shared folder. So this isn’t the first thing I’d try. To check, cd
into /mnt/
and run the command ls -l
. That should give you and output similar to this:
drwxr-xr-x 6 casaos casaos 4096 Nov 26 17:26 sda1-usb-Seagate_Portable drwxrwxrwx 2 casaos casaos 4096 Nov 15 19:00 Vault
In my case “casaos” in each line refers to the user and group that owns that folder. Make sure that when you run it, those positions where I have “casaos” are set to the user you used to install CasaOS (not the root user). If that’s not the case, run the chown
command I listed above again. Sometimes the files app creates folders that are owned by root and I haven’t been able to figure out why. Sometimes I need to run this command again to get Syncthing to see new folders I have created.
Hope this helps. Let me know if you’ve got more questions!
Thanks G, I’ll give that a look over tomorrow.
1 thing to note is I never did manage to get chown to run, it returned operation not permitted.
However I presume the problem is due to the drives being labeled incorrectly?
I did remove them from casaos storage & recreate them but with the same result.
I’ll have another look tomorrow.
Cheers
Had a bit of time this morning to go over it again.
Complete new install of syncthing from fresh and readded the drives from fresh.
Drives are still being labelled mnt/Storage1 & mnt/Storage2 as before.
Sudo chown ran on both drives.
Gave syncthing access to Storage1.
Created a test folder on my phone & set to sync with casaos.
When the invite appeared on the screen I accepted & used /mnt/Storage1/Documents as the folder path.
Which results in the following error.
Out of curiosity I resent the folder and gave it this path instead ~/mnt/Storage1/Documents but as expected syncthing created those directories within it’s config folder, but it did work & did sync files.
I can ssh into Storage1 using the default login & create directories so the user “casaos” does have permission, is it that syncthing is accessing with a different user name or is it that the drives are being labelled incorrectly or is that just a red herring?
Hope this gives you some info & I really appreciate the help.
Cheers
ran ls -l with the following output.
the zimablade came pre-installed with casaos but it does say to use casaos as user name & password so I can only assume that’s correct.
Don’t know about the directories highlighted in green.
The folder structure used anywhere in the syncthing app needs to follow what you set in the container column of the settings. Sycnthing can’t see your whole folder tree and thinks that the filesystem starts at the first slash in the Container field. In your case, you should use /DATA/Documents
in the folder path.
Syncthing will also usually prefill the Folder Path field. You can use the prefilled “~” as shorthand for the /DATA
folder. So, you could also put '~/Documents` and that should work as well.
I don’t really know why the folders highlighted in green exist. My server has a similar one with the name of my external drive before I reformatted it, so yours could maybe be related to that. I wouldn’t worry about it unless it’s causing you issues.
Thanks for the reply but sorry I’m not following.
I did try with ~ but that shortcuts to the config directory on the system drive & syncthing then creates the rest of the directory tree there.
When I did ls blk it came back with the path to the drive as /mnt/Storage1 so I used that in the host settings I then used /mnt/Storage1/documents in the folder share knowing that syncthing would create the /documents folder. I actually also did try creatimg it first also, but both times I get the same permissions error.
Are you saying that in the host field I should be using /mnt/Storage1/data/documents or the share folder?
Apologies if this comes across badly but I’m completely new to all of this and finding it very confusing.
Edit: ok I see what you mean, I don’t need to give the full path in the folder field I just use /DATA/documents
I’ll give that a go tomorrow & hopefully be good to go.
Many thanks
Success, thank you so much for your help.
Realising about the folder structure for host & container made sense once pointed out.
Cheers