How to extend (ncdata) storage space to another flashdrive on NextCloudPi (on Raspberry Pi 3b+)

Hello everyone!
I am a freshman here, so please don’t be mad at me if I have posted my concerns under the wrong category or did not searched the entire forum for all possible variations of my problem! :slight_smile:

So, I have a Raspberry Pi 3b+ and I have installed an NC image from https://www.ownyourbits.com/ onto a 8GB SD card, inserted in the SD slot of the Pi. For the storage itself, I have inserted a 128GB SD card into a USB-card reader and labeled it “USBdrive” and set the nc-datadir to it = /media/USBdrive/ncdata.
So far, so good! My NCP is working as expected and I am syncing my data to it (storing the data to the ncdata dir on the 128GB SD card.)
Now I want to add an additional 200GB SD card in another USB-card reader into a 2nd USB-port of the Pi. I have formated it through the admin pannel (TOOLS >> nc-format-USB) as a BTRFS partition and labeled it “SD_200GB”.
And here comes the tricky part, which I am unable to figure out since almost 2 weeks, searching across the whole Internet…

  1. How to extend the ncdata forlder, so it could combine the space of the 2 SD cards together (128GB + 200GB) and to use the whole amount of the available space? :thinking:
  2. How to create the proper RAID# option to merge the space from the 2 SD cards (or even more USB/SD storage drives in the future)? :thinking:

I will really really appreciate your help on that concern, folks!
Huge thanks in advance! :vulcan_salute:
Cheers! :slight_smile:

One easy method is to mount the additional card via fstab and then mount within NextcloudPi as local storage.

I use LVM (Logical Volume Manager) and/or btrfs to manage space across drives.

2 Likes

Hi @just!

Thanks for your reply!
Both SD are auto mounted in NCP every time through the nc-automount system function. I see them when I list all mounts with “mount -l”. Do I still need to mount them via /etc/fstab or you mean something else?
I even installed the app “External drive storage” and set the 200GB SD as an external storage for all users, but to be honest, I can’t quite understand the endresult. I mean: what will happen, if (for example) my general storage drive (128 GB) is 126GB full and I want to upload a 4GB file? Would it be devided in 2 parts (of course invisible for the users): 2GB on the 1st (128GB) SD and the rest on the 2nd (200GB) SD card???

Hi @OliverV!

I should dig deeper into that! Thanks a lot! :+1:

Perhaps you can better move all data to an external device, change the settings in config/config.php and rescan the data with occ.

Hi @devnull!

Why it is better to do that? I mean, where is the added value? :thinking:

Sorry to have to say: using LVM or btrfs, requires a bit more Linux and command line practice. There is no app to do it for you. Although most, if not all, Linux distro’s support LVM and btrfs.

With LVM and btrfs, you can virtually join any number of drives and address them as if they were a single drive and mount them to a single mount point.

Your 2 (or more) drives would be available as a single mount

simple example

mkfs.btrfs /dev/sdb /dev/sdc
mount /dev/sdb /media/mydrives

Warning: This will wipe clean the drives, all data is lost. No going back.!!!
You can then move NC data folder to /media/mydrives/ncdata
Check permissions/ownership of /ncdata and set datadirectory to new location in config.php.

1 Like

‘datadirectory’ => ‘/var/www/nextcloud/data’,

to

'datadirectory' => '/mnt/sd',

If your new sd/ssd/hdd has a lot of space i think it is better to use only one space without “external data”. Set the correct user rights an rescan. I think NextCloudPi has got an option to do this.

Many thanks for the explanation, @OliverV!
I am not a “PRO” in GNU/Linux, but a passionate user (home admin, who is “learning-by-mistaking” :smiley: ) and I will definetelly try that out A.S.A.P. and give my feedback to the whole community here!

Warning again: It deletes both devices.

Use perhaps:

mkfs.btrfs /dev/sda
mkfs.btrfs /dev/sdb

Check the devices.

Your best bet is to follow @OliverV’s advice. I’m just stuck in the old school and have yet to switch to the new and cooler lvm + btrfs land. Perhaps it is time. :wink: