This guide will help you configure an external USB drive.
:: Important note ::
If you are using only one USB drive, you can leave the default path /media/USBdrive for all configuration options, but if you are going to use more than one you need to reference them by label, or NCP will not be able to know which one is which.
For instance, if the label of the drive is mylabel then use the path /media/mylabel for items such as nc-datadir, nc-database and so on.
Configure Database data to be on the USB drive (optional).
Configure Swap on the USB drive (optional).
Format USB drive (optional)
nc-format-USB will format your external USB drive to BTRFS, with the given Label.
:: Note ::
In order for you to be able to use an external USB drive, the USB drive must not be formatted as NTFS/FAT as these do not support the user/permission system, this will format all USB drives you have connected to the Raspberry Pi.
Change the SWAPFILE to the desired location in the mount point.
Change the SWAPSIZE to the desired size of Swap File (Default: 1024MB).
Now you have configured NextCloudPi to use an external USB drive for Nextcloud data, optionally Database data and Swap.
We hope this doc was helpful, if you encounter any issues please reach out to the community. These docs are written by volunteers, please consider becoming one of them.
Contact the wiki team at Matrix or Telegram
How would you do this if nc-datadir and nc-automount are not available in ncp-config, like in docker or proxmox installation?
Mounting the drive to any path I could still achieve I think, but do not understand how I can bring a mount point and the expectation of NCP of where to find the data together. In my proxmox installation the nc-datadir is /var/www/nextcloud/data, this is shown in the system info, but not changeable there.
Haha! It’s your lucky day thankfully I’ve been dilligent and keeping notes ever since I started tinkering with a RPi4, Proxmox etc. I went digging through these notes and found how I made a VM on Proxmox using the NextcloudPi LXD image.
If I’m not mistaken, or my memory is wrong, there is a couple that are looking for this information. I even kept snapshots
Now I don’t know if I kept notes of the entire process or not, there is quite a lot though but spread out over 2 or 3 txt documents, if I remember correctly …
@johndoe0815
Hmm … I don’t know what happened there … ? Did I somehow edit over your post? If so I’m sorry that was really weird, I’m sure I was editing my own post… can you see the version history by clicking on the little pen in the corner of the post? If so, you should be able to go back a version in the bottom left corner with the back icon & copy the previous version of your post by selecting to view it “raw” in the top right corner. It doesn’t work for me, which is weird since I can edit your post
But to @theCalcaholic as said the current datadir of my installation is /var/www/nextcloud/data. From what I meanwhile read I would need to mount the drive to any mount point that I choose (via console input), and then edit the config.php manually to point to that datadir, as for some reason that option is not available in ncp-config?
I have an existing HDD from my current RPi installation in BTRFS format that hosts the datadir as well das the NCP database.
The database I do not need, the HDD I would in the simplest case like to continue to use in the new proxmox installation. In the worst case I would reinitialize the HDD and copy the data then back from a backup.
BTRFS in Proxmox also seems to be not the easiest thing from what I read and also not possible from the GUI: [SOLVED] - BTRFS mount point in LXC | Proxmox Support Forum
So if it is easier I might also go with EXT4 instead.
As I see in your screenshot that you also added BTRFS I would indeed be interested in your how-to
Well, I don’t think these steps will work anymore, they were constructed when the image was exported as tar.bz2 and now it is tar.gz instead. They are converted to tar.gz in the last step, so the principle should still work, even easier in fact since you can skip the conversion step
I don’t know, the URL in the commands also no longer works, I just put the steps here as a reference, it is also for my configuration, so your directories aren’t necessarily the same
I think this is the ISO directory on mine, I could be wrong, I’ve already shut it down at the moment. /var/lib/pve/local-btrfs/template/iso/ you’ll have to check
Sure, I installed using Proxmox’s image and selected BTRFS during install :3
That was really all I did for that part, then of course if you need to add other volumes and things like that you need to configure this things in the devices and hardware tabs
Edit: Ah I realised you mean for the NextcloudPi VM, my bad at the moment I don’t remember, I’ll have to get back to you with that. I think it was following Proxmox documentation for mounting BTRFS volumes and a couple posts on their community forum
I am currently trying this out with an empty USB stick that I have formated with BTRFS, even though I assume my current Nextcloud HDD has different partitions.
The process seems to be:
Mount USB drive in proxmox node
Bind this mount point into the CT with pct (qm only works for VMs)
edit config.php in CT and make it point to this mount point
When I got this working and a file uploaded in Nextcloud is successfully saved to the USB stick, I would try the same with my HDD, hoping that all files will then appear in Nextcloud.
Not so easy for a Linux noob
If that worked, I can also write a short tutorial about that, unfortunately I could not find this anywhere on the internet so far.
@johndoe0815
Thank you so much I’ll send you an invite and you can create an article in draft documentation if you want, then it can be added in the docs
Does anyone know which automount system nc-automount uses underneath?
I am using NCP with a SSD drive and I would like to configure periodic - perhaps weekly - TRIM on the filesystem, but most of the instructions I read assume the mounts are defined in fstab.
This is said to help with long term SSD health and performance, so would be a high priority.
@ncpbot This is really helpful for me, I set up a NextCloudPi recently with an external SSD connected and ran into this issue-getting a message that I had almost run out of space when I should have nearly 1T available.
I’m trying to follow the procedure you outlined and have formatted and labeled the external drive and enabled nc-automount without any issue.
I’m having trouble configuring the nextcloud data to be on the USB drive. I navigated to the nc-datadir in the webui and it currently says the data directory is /opt/ncdata and the path exists.
I know I need to change /opt/ncdata to “your data location in the mount point”, but I have no idea how to figure out where that is? I also don’t know what the mount point is or where I can figure that out.
Hoping you or someone else can tell me where to find that, because I’m at a loss for the answer so far.