Many of people are using file storage cloud services. It can be Dropbox, Microsoft OneDrive, Google Drive, etc. They give some free space for file storage, but if you want more, you have to pay every month for it. For example Google Drive offers 100Gb fot 2 EUR/month.

You own cloud

If you have Raspberry Pi, then you can organize your own cloud that will be almost free (except payments for electricity and domain name if you need it). There are some ready products that can help with it. The most popular are OwnCloud and NextCloud. NextCloud was forked from OwnCloud, so I think they are pretty similar, but of course I can be wrong. I have chosen NextCloud ( To access your files you can use web browser or use Android/iOS applications. NextCloud is powerful system with plugins, multiple users, photo gallery, etc.

Data storage

To store files you will need to use micro SD card where operating system is installed or connect some external drive - usb flash, hard disk or SSD. Raspberry Pi has 4 USB ports, so can plug any device with USB interface.

SD card can be too small to fit all your files, so if you have decided to use external drive, first of all should mount it. There is lot of information in Internet how to do it.

Edit text file:

sudo nano /etc/fstab

Add this line to mount your device:

UUID=0C2ABE072ABDEDB8 /mnt/toshiba750 ntfs defaults,uid=1000,gid=1000,auto,umask=007,users,rw,nofail,exec,x-systemd.device-timeout=30 0 0


  • UUID - this id can get using command sudo blkid
  • /mnt/toshiba750 - path to mounted disk
  • ntfs - file system type. I have used NTFS for external disk. Raspbian does not support this file system natively, so should run this command to use ntfs
sudo apt-get install ntfs-3g
  • uid, gid - user id and group id. Use 1000 for pi user
  • umask=007 - files and folders permissions. No read write permissions for other users. This is NextCloud restriction.

Run NextCloud container

Now disk is mounted and can be used to access files. Lets try to install NextCloud. At previous post I have described how to install Docker and Docker Compose on a Raspberry Pi. Now we can use NextCloud image to create cloud file storage. I have used official NextCloud image - As it is described, it supports multiple CPU architectures: amd64, arm32v5, arm32v6, arm32v7, arm64v8, i386, ppc64le. Raspberry Pi and OS Raspbian supports arm32v7, so this image will be ok. There is documentation how to run image with Docker or with Docker Compose. I have used this Docker Compose file:

version: "3.7"
        image: linuxserver/nextcloud
        container_name: nextcloud
            - PUID=1000
            - PGID=1000
            - TZ=Europe/Riga
            - /home/pi/docker-volumes/ncdata:/config
            - /mnt/toshiba750/ncdata:/data
            - 1500:443
        restart: unless-stopped

Some information about parameters:

  • PUID and PGID - user id and group id. If you are using pi user, then use 1000 for both parameters
  • TZ - timezone
  • volumes - here you can configure directories where NextCloud will store configuration files, database, data files, etc. First volume is for configuration files. I use directory on SD card on Raspberry Pi. Second volume is for data so I use path to directory on hard disk.
  • ports - first number is port using which will be used to access NextCloud container. Second number is internal port and should not change it.

Just create file with name docker-compose.yml and write settings there.

Now just write command:

docker-compose up -d

After some time container will be running. To check it's progress and make sure there is no errors can use this command:

docker logs nextcloud

If there were no errors, cloud can be accessed using url in browser: https://{ip_address}:1500

Setup NextCloud

Follow instructions and create admin user. For database can be used SQLite for small number of users. For personal usage it will be more than enough. Then you can configure NextCloud settings using admin account after logging in.

One more thing. By default NextCloud uses too large images for previews. Can read about it here: I have decided to use recommended in the article settings. To change preview settings run these commands:

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ config:app:set previewgenerator squareSizes --value="32 256"

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ config:app:set previewgenerator widthSizes --value="256 384"

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ config:app:set previewgenerator heightSizes --value="256"

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ config:system:set preview_max_x --value 2048

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ config:system:set preview_max_y --value 2048

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ config:system:set jpeg_quality --value 60

After creating accounts in NextCloud files can be copied directly to volume directory. After that you need to run command to index copied files

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ files:scan --all

After several minutes files will be indexed and can be seen in NextCloud application.

NextCloud by default offer image previews, that are generated when folder with images is opened. This takes lot of time if folder has many images. NextCloud becomes almost unusable until Raspberry Pi will finish preview generation. There is solution to avoid it - image previews can be pre generated.

In NextCloud application open Apps page and install Preview Generator app.

After installing this app will be added in all apps list and you can use command for pre generating previews

docker-compose exec --user 1000 nextcloud php /config/www/nextcloud/occ preview:generate-all -vvv

For 200 Gb photo archive it took for me 2-3 days of Raspberry Pi work. This application uses only one core of Raspberry Pi CPU, so it takes some time to do it, but all docker application containers remains responsive at this time.


That's all about NextCloud installation. But there remains many features that can be configured. To make NextCloud available from outside of local network, you will have to configure router to redirect ports that are used by NextCloud. Also to simplify access to personal cloud you may want to register domain name. Domain registration can be registered on or any other place that offers such services.