# Ubuntu 16.04+nexcloud 11- data folder USB disk?

**URL:** <https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238>\
**Category:** ℹ️ Support\
**Created:** [January 7, 2017, 1:24pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238 "2017-01-07T13:24:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rg24](https://help.nextcloud.com/letter_avatar/rg24/32/5_5575768a8748004e209b776fc1b2916d.png) [@rg24](https://help.nextcloud.com/u/rg24)\
**Post date:** [January 7, 2017, 1:24pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/1 "2017-01-07T13:24:49Z")

</div>

I would use a usb drive (WD 3TB) for my data directory [folder data].

How to mount this disk with the www-data group? I can not find a clear documentation to use my usb disk by default.

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/5_5575768a8748004e209b776fc1b2916d.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [January 7, 2017, 1:51pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/2 "2017-01-07T13:51:28Z")

</div>

What file system?  
If it’s only used for Nextcloud, I would personally choose a Linux file system. It’s better supported and more stable.

If you use NTFS:

> [@You don't have permissions to upload or create files here - local (external ntfs-3g storage)](https://help.nextcloud.com/t/you-dont-have-permissions-to-upload-or-create-files-here-local-external-ntfs-3g-storage/5420/4):
>
> Managed to solve the problem past the recommendations made by tflidd and I am typing the solution here to probably serve others who may run into this problem. fstab #Windows-Partition UUID=537FEF451930795B /media/win ntfs rw,auto,users,exec,nls=utf8,umask=003,gid=33,uid=33 0 0 Reboot sudo reboot Force NextCloud to rescan files cd /var/www/nextcloud sudo -u www-data php console.php files:scan --all And your ntfs local external storage is back in business.

---

<div class="post-metadata">

**Author:** ![rg24](https://help.nextcloud.com/letter_avatar/rg24/32/5_5575768a8748004e209b776fc1b2916d.png) [@rg24](https://help.nextcloud.com/u/rg24)\
**Post date:** [January 11, 2017, 1:11am UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/3 "2017-01-11T01:11:05Z")

</div>

By following your instructions I now drive usb with www-data

rg@rg-unix:~$ sudo fdisk -l  
Périphérique Start Fin Secteurs Size Type  
/dev/sdb1 2048 5860464639 5860462592 2,7T Microsoft basic data

rg@rg-unix:/media/rg$ ls -l  
drwxrwxr-- 1 www-data www-data 4096 jan 7 09:36 myNextcloudData

I have on my Linux system (Unutu 16.04.1) apache2, mariadb and php  
I am getting ready to install nextcloud 11

Can I do nexcloud setup directly through the interface by directly specifying my directory  
[data folder : /media/rg/myNexcloudData]

thanks

---

<div class="post-metadata">

**Author:** ![rg24](https://help.nextcloud.com/letter_avatar/rg24/32/5_5575768a8748004e209b776fc1b2916d.png) [@rg24](https://help.nextcloud.com/u/rg24)\
**Post date:** [January 15, 2017, 2:08pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/4 "2017-01-15T14:08:15Z")

</div>

I am back. Impossible with Wizard installation use my USB disk.

I have reinstalled Unbutu (16.04.1 LTS), apache2 (2.4.18), mariadb (mysql Ver 15.1 Distrib 10.0.28-MariaDB) and PHP (7.0.13).

In my opinion everything is correct.

Now I install Nextcloud 11. ( /var/xml/nextcloud, user www-data:www-data etc.)  
I plug my usb disk , and name with LABEL myNextcloudData (with utility disks)  
Search UUID with command blkid (UUID=EAFED6E8FED6ABD7)

I add into file /etc/fstab  
UUID=EAFED6E8FED6ABD7 /media/rg/myNextcloudData ntfs rw,auto,users,exec,nls=utf8,umask=002,gid=33,uid=33 0 0

Now I run Wizard and wite  
Create and admin account  
(user name) : Il write an username  
(password) : I write and password

Storage & Database  
(database user) : root (for user root of my mysql/mariadb installation  
(database password) : password of root

(/var/www/nextcloud) : change for my usb disk =\> /media/rg/myNextcloudData  
(database name) : nextcloud  
(localhost) : localhost

No success, Il get message  
Error: can’t create or write into the data directory /media/rg/myNextcloudData

I search what is the problem. Do you have solution?

---

<div class="post-metadata">

**Author:** ![JasonBayton](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jasonbayton/32/297_2.png) [@JasonBayton](https://help.nextcloud.com/u/JasonBayton)\
**Post date:** [January 15, 2017, 10:53pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/5 "2017-01-15T22:53:45Z")

</div>

> [@rg24](#):
>
> /media/rg/myNextcloudData

`ls -l /media/rg/`

I expect to see the data folder owned by user www-data

---

<div class="post-metadata">

**Author:** ![rg24](https://help.nextcloud.com/letter_avatar/rg24/32/5_5575768a8748004e209b776fc1b2916d.png) [@rg24](https://help.nextcloud.com/u/rg24)\
**Post date:** [January 15, 2017, 11:13pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/6 "2017-01-15T23:13:32Z")

</div>

I have

root@rg-unix:~# ls -l /media  
drwxr-x—+ 4 root root 4096 jan 14 23:27 rg

root@rg-unix:~# ls -l /media/rg  
drwxrwxr-x 1 www-data www-data 4096 jan 11 17:55 myNextcloudData

Actually /media/rg/myNextcloudData is empty  
root@rg-unix:~# ls -l /media/rg/myNextcloudData  
total 0

Correct?

---

<div class="post-metadata">

**Author:** ![rg24](https://help.nextcloud.com/letter_avatar/rg24/32/5_5575768a8748004e209b776fc1b2916d.png) [@rg24](https://help.nextcloud.com/u/rg24)\
**Post date:** [January 16, 2017, 4:16am UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/7 "2017-01-16T04:16:37Z")

</div>

I look code (thanks, is open source)  
file Setup.php

```
// validate the data directory
if (
   (!is_dir($dataDir) and !mkdir($dataDir)) or
	is_writable($dataDir)
  ) {
       $error[] = $l->t("Can't create or write into the data directory %s", array($dataDir));
  }
 if(count($error) != 0) {
   return $error;
}
```

I test with my php code and obtain

((!is\_dir [= FALSE]) AND (!mkdir [= TRUE])) OR (!is\_writable [= TRUE]) ==\> Can’t create or write into the data directory: /media/rg

((!is\_dir [= TRUE]) AND (!mkdir [= TRUE])) OR (!is\_writable [= TRUE]) ==\> Can’t create or write into the data directory: /media/rg/myNextcloudData

Evidently my data directory is not writable.

```
ls -l
drwxr-x---+ root root /media/rg
drwxrwxr-x www-data www-data /media/rg/myNextcloudData
```

Problem is probably witih “rg” (rg is the user)

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 2, 2024, 12:34pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/8 "2024-12-02T12:34:30Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 12:57pm UTC](https://help.nextcloud.com/t/ubuntu-16-04-nexcloud-11-data-folder-usb-disk/7238/9 "2024-12-04T12:57:18Z")

</div>


