How To Save NextCloud Files to EFS

user535562 asked:

So i have a nextcloud server in an EC2 instance, i have an EFS mounted to it but im not sure how to make nextcloud save the files on the EFS instead of EC2. Are there any guides or tutorials out there that shows you how to do such a thing?

Any help or ideas is greatly appreciated!

Thanks

My answer:


The general process is going to be to stop Nextcloud, move your files from your local instance storage to EFS, move the mount point, and then restart Nextcloud.

It will go something like this:

  1. Mount EFS at a temporary directory.

    sudo mkdir /mnt/efs
    sudo mount -t efs fs-12345678:/ /mnt/efs
    
  2. Stop Nextcloud

    Change to the Nextcloud installation directory, then:

    sudo -u php php occ maintenance:mode --on
    
  3. Move Nextcloud data files to EFS

    sudo mv -v /nextcloud/datadirectory/.??* /nextcloud/datadirectory/.?? /mnt/efs
    
  4. Verify the data directory is empty

    sudo ls -al /nextcloud/datadirectory
    
  5. Unmount EFS from temporary directory

    sudo umount /mnt/efs
    
  6. Mount EFS as the Nextcloud data directory

    sudo mount -t efs fs-12345678:/ /nextcloud/datadirectory
    
  7. Set up the permanent mountpoint in /etc/fstab

    fs-12345678:/ /nextcloud/datadirectory efs _netdev 0 0
    
  8. Fix up ownership and permissions of the mountpoint and files if necessary

  9. Restart Nextcloud

    sudo -u php php occ maintenance:mode --off
    

You should change the usernames and directories shown above to match your own installation.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.