How to check if data is stored at usb drive?

The title of this thread already says everything.

How is it possible to check if all data is stored to the usb drive?


Compare the location of Nextcloud’s data folder with the mount point of the USB drive.

Vorformatierter TextWhere can I find the mount point of the USB drive?

I see this in the information section:

datadir /media/USBdrive/ncdata


dbdir /media/USBdrive/ncdatabase

To test if the data is on the drive, I first put some data in nextcloud. Then I started the wizard again and reformated the usb drive.
After that the data was still there, so this tells me the data wasn’t at the drive.
Looks like it is saved on the SD Card.

If you don’t know where it’s mounted, it may not actually be mounted at all. You didn’t mention what OS or distro of Nextcloud you have, so I can’t be any more specific on how to check.

If you want the data folder to be stored on external media, you’ll need to physically move it there. The location of the data folder will be in your Nextcloud config.php. Make sure to follow a guide on moving the data folder because there can be some gotcha’s involved and some people have had hit or miss results.

1 Like

I use a nextcloudpi image for a raspi 3B+.

To move the files I used the wizard, which says something like move data and was successful.
I did not see a gotcha.


sudo ncp-report

and copy output, to pastebin or similar, post link here.

Also better use the ncp tag, so other ncp users will be quicker to find this and respond. :wink:

To check if data is stored in there you need sudo rights, it is not readable to anyone but www-data and root user.

sudo ls -lh /media/USBdrive/ncdata

Should list content of your datadirectory.

You should remove your WAN IP from your post, and better remove it from trusted array also and use any (free) domain and letsencrypt (ncp-config>>Networking) to get a certificate.

It seems ports 80/443 are closed, you need forward/allow those, from your router/firewall settings, if you want to access from outside your LAN.

Will probably do that later, first I want to test nextcloud locally.

ok so this is the output:

pi@nextcloudpi:~ $ sudo ls -lh /media/USBdrive/ncdata
total 388K
drwxr-xr-x 9 www-data www-data 4.0K Sep  5 16:47 appdata_ocawbj1f0p8o
drwxr-xr-x 8 www-data www-data 4.0K Sep  5 16:11 appdata_oclaqn5ofjmm
drwxr-xr-x 2 www-data www-data 4.0K Sep  7 06:31 files_external
-rw-r--r-- 1 www-data www-data    0 Sep  7 06:31 index.html
drwxr-xr-x 6 www-data www-data 4.0K Sep  5 16:52 ncpmyuser
drwxr-xr-x 4 www-data www-data 4.0K Sep  5 16:10 ncp
-rw------- 1 root     root     310K Sep  5 18:35 ncp-config_20190905.tar
drwxr-xr-x 2 www-data www-data 4.0K Sep  7 06:32 ncp-update-backups
drwxr-xr-x 4 www-data www-data 4.0K Jul 21 04:09 news
-rw-r----- 1 www-data www-data  41K Sep  7 06:32 nextcloud.log
drwxr-xr-x 2 www-data www-data 4.0K Sep  7 06:32 tmp

Currently I have only one folder in nextcloud which is synct and it’s called “Testfolder”.
As you can see this folder doesn’t appear in the list above.

You would normally find the “Testfolder” by running

sudo ls -lh /media/USBdrive/ncdata/ncp/

as that seems to be the only user.

Did you install 2x? Else, what did you do to get 2 ncp folders and 2 appdata folders ?

For each user you create in NC admin area, you will find an extra folder with username in ncdata/

sry about that, I have a second user and did not want to provide the name of that user.
I edited in my last post to make clear that this is a second user.

Thanks again.

Ok so now I was able to find the Testfolder with:

sudo ls -lh /media/USBdrive/ncdata/ncpmyuser/files

  1. So this means the data is stored on the usb drive right?

Two more questions:

  1. What happens when I unplug the usb drive, the data shouldn’t be available I think?
  2. Is it possible to put files on the unplugged stick, to put files directly on it and plug it in again? Is Windows or OSX able to handle the format of the usbdrive?
  1. yes it is stored on your usb drive
  2. yes data will be on usb drive. (use sudo shutdown -h now, to poweroff)
  3. Dont know if OSX or windows read/write ext4/btrfs, I use Linux only. Maybe someone else will answer that or you can search the web :wink: .
  4. After you put your files in the user folder, reconnect and start your system:
  • first run nc-fix-permissions (ncp-config>>TOOLS)
  • second run nc-scan (also from ncp-web>>TOOLS)

Might take while, depending system and data…

1 Like

There could be a problem when the USB stick is not mounted. In that case it will be put in the same folder but it is on the main file system. You can check if the usb stick is mounted:

df -h should give you something like:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       7,9G  115M  7,7G   2% /media/USBdrive/ncdata

If it is a linux filesystem, just use a linux system you can boot from usb stick, once you booted up this system connect your usb stick and you should be able to check the content.

One more idea for checking files is, there are apps that can show you the hash-sum of a file via webinterface. In Windows you can as well have extensions that can calculate the hash-sum of given files. So you could have an indicator if a file was uploaded correctly.

It’s not recommended to put files manually in the data folder. Use the external storage feature for that. But this is a separate topic.

Ok so the command gives me this:

/dev/sda1 30G 17M 28G 1% /media/myCloudDrive

So I think there is still something wrong. As I understand it should be /media/USBdrive/ncdata

I used the wizard to set everything up.

cd /media

gives me:
myCloudDrive USBdrive USBdrive1

O so I changed the database and dbdir to /media/myCloudDrive and now it seems like the data is finally stored at the usb drive.

The thing is, why did the wizard build/media/myCloudDrive and not /media/USBdrive/ncdata like in the example above?

Side question:

How do you backup your files. I would probably mount another usb drive and back up files to that drive. Or is there a better way?

In the meantime I was able to set everything up and the data is saved to the usb drive.

Now I’d like to save backups to the SD card. I don’t think that saving those backups to the usb drive is a good idea (if it breaks in future).

  1. Which is the right path to save backup files to the sd card?
  2. is there a easy way to pull backups to to my pc? Maybe it’s a good idea to save a second copy of a backup offline.

Such things can happen when a drive was not unmounted properly, the device is reconnected and will use a different mount point.

1 Like

Regarding backup, please use a new topic. If too many things are mixed, topics won’t help other people who have similar issues.

The thing is this was a fresh install, with a new formatted usb stick, it got that same from the initial setup.

Anyway I started again from zero and did not use the wizard, only the tools in the UI and now it works.

Will open another topic.