@nachoparker: After quite some time, I was able to take a look at BTRFS as file system having nextcloud installed on again.
I do believe that in most cases where BTRFS is used as the base file system on which NCP is installed, the created Nextcloud directory will not be a BTRFS subvolume nor contain any BTRFS subvolumes. In this case, your script ncp-update-nc will run just fine.
Here is now my suggestion for improvement:
Critical for the Nextcloud update script is that no BTRFS subvolume resides inside the Nextcloud directory. Because, if it does the mv command will throw an error.
The actual Nextcloud data directory is updated only, if it still exists inside the Nextcloud directory.
Therefore: A simple check of BTRFS subvolumes inside the Nextcloud directory should do the trick.
I would like to suggest to replace the existing line 34 in ncp-update nc
What exactly do you want to do with this line??
Can you explain a bit what it should produce?
There is a lot of assumptions being made by all of you.
@nachoparker assumes that nextcloud basedir should be a btrfs to make snapshots → thats probably a great idea and would be great & efficient way to have in the future.
@LittleAlf s code is a step in the right direction, but assumes that / would be the root of the btrfs.
I guess / would usually be an SD or SSD with ext4 and we would have a btrfs mounted somewhere below…
Since NCP is not just one VM Image that everyone has to use the same way, we have to think a bit wider here I guess.
Probably would be great to write a documentation/blueprint and outline how to make the perfect btrfs based NCP setup and in the meantime just fix it with something like above.
On my machine it returns:
btrfs subvolume list /
ERROR: not a btrfs filesystem: /
ERROR: can’t access ‘/’
I believe there might be quite some others who were doing this. (Exactly for inexperienced people like me, NCP were created, I think.) Also I believe I am not alone to use BTRFS for the system partition.
If you use the curl-installer it means, that no BTRFS subvolumes will be created inside the /nextcloud directory, since the curl installer is not aware of the specifics of the underlying file system.
When it came to upgrade of my Nextcloud installation, I tried to use the Upgrade Nextcloud function in the NCP web interface. Unfortunately, it stopped right there with the error message BTRFS not supported.
Since I like to use the NCP functionality I took a look into the bash script ncp-update-nc.sh
and found the corresponding line 34, where NachoParker prevents the continuation of the upgrade script by simply checking, if the Nextcloud directory resides on a BTRFS partition.
So, for all the guys who have
installed NCP on a BTRFS partition, and
used the curl installer to install Nextcloud onto this partition,
I wrote the above modifications to the script. It allows the usage of ncp-update-nc.sh under these two conditions without running into an error. Important is that it is achieved without changes to the rest of the script being necessary!
Regarding your question about the background of the line you mentioned: I just check, if the Nextcloud directory and/or one of its subdirectories is a BTRFS subvolume. If this is the case, the upgrade of Nextcloud is aborted. If it is not, then the Upgrade continues.
In order not to run into an error (like on your machine) I first check that the partition where Nextcloud resides on is in fact a BTRFS partition.
Yes I got you right.
But dont assume everyone has / on a btrfs, for example with armbian that doesnt even work. If you use the syntax as I explained, you’ll get the result, also if /var/www is on a btrfs but / isnt.
Hmmm I think you got it mostly right, there would be a couple things we should check.
I think that the datadir should always be a subvolume if we are using BTRFS, even if we never used nc-datadir. When this project was RPi-centric that was never the case, but I think we should make that change first and take it from there.
I think it is a good idea tu use BTRFS for the installation of NCP. (That is what I did anyway: First create a BTRFS partition, and then install NCP via the curl installer.)
The proposed script changes just ensure that any possible BTRFS subvolume at the Nextcloud directory or any subdirectory does not break the update process of ncp-update-nc. Thats all.
Regarding the data dir as a subvolume of the Nextcloud directory: I liked it very much to move the data dir via NCP to a different location. It makes it very clear, that it has been moved. I do not know if people using BTRFS are really keen on having the data dir mounted at the original location as a BTRFS subvolume. Maybe you have some better info.