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!


1 Answer 1


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.

  • Thank you Michael for the detailed explanation. Quick question just to make sure i got this right. So i have my EFS persistently mounted to my EC2 instance, and i should technically un-mount it and mount it to nextcloud instead, but then again nextcloud is installed on EC2? Aug 14, 2019 at 16:51
  • What do you mean by "technically un-mount it and mount it to nextcloud instead"? Aug 14, 2019 at 16:53
  • step 5 says to unmount efs from temp directory and step 6 is to mount efs as the NC data directory Aug 14, 2019 at 16:56
  • correct me if im wrong but dont i have to change the NC config.php file to have it save the data in a certain directory? Aug 14, 2019 at 16:56
  • @user535562 Of course, you have to specify the data directory in config.php. But you have already done that, right? Aug 14, 2019 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.