I am fairly new to Ubuntu and Nextcloud. I am looking for a simple walkthrough to help setup Nextcloud. I know there is a manual, but what I need isn’t in there. It’s more on the Ubuntu permissions and files.
I can install it normally with no issues at all. My problem is that I want to use a 2nd hdd (4TB) for data storage. My boot drive isn’t very big and I want to continue using my ssd (250GB) for the boot. Can someone help me with the steps I need to follow to set permissions, owner and things on the 2nd hdd? I mean as if you were actually doing it yourself after a fresh install of Ubuntu 16.04 or whatever the newest version is. The starting point would start by how to setup up the 2nd drive for storage. Or, if someone can do the same to use as external storage. When I mount the 2nd drive, it wants to mount at /media/myname/storage. Apparently, it can’t be in one of “my” directories. I really would appreciate it and I thank you for your time.
(edit by moderator: reformatted the text to make it readable)
Once you’ve added the 2nd drive to the PC, locate the drive with
sudo fdisk -l and take note of the path eg:
/dev/sdc. In your case it may be
sdb as it’s a 2nd disk.
Once you’re sure which drive is your second, you can use this to partition it from cli: http://askubuntu.com/questions/384062/how-do-i-create-and-tune-an-ext4-partition-from-the-command-line/384063
Following that, gain the UUID with
sudo blkid /dev/sdc and add the drive to your
/etc/fstab file to have it automatically mount to the same mountpoint on every boot (in order to provide NC with a permanent data location for the config file). An example would be:
UUID=02C22F1539D54F25 /mount/point ext4 0 0
UUID= would be the long number you got from running
/mount/point is the location of where the drive will be accessible. I like to put my drives in media, like
/media/nextcloud. The mount point would need to exist, so you’d first make the directory with
sudo mkdir /media/nextcloud
Finally, create the data DIR within the mount (if you don’t want to use the mounted drive root) and give the web user permissions to write to it:
sudo chown -R www-data:www-data /data/path
Thank you Jason! When the drive mounts it goes directly to /media/myname/storage. How would I change it from there to make it /media/storage? Would it be sudo mv /media/myname/storage /media/storage/? Or would I do it a different way from the start? I know I’m noobish with this and I really appreciate your help, I’m trying to learn it. I’m sure this is a dumb question but how do I make sure new directory points to the 2nd drive instead of the boot drive? I did mkdir /media/storage and it made the dir on the boot drive. I know it’s probably something simple, lol. Again thank you!
Also are the permissions 770 or 775?
If you system is running, first unmount the drive
then edit the
/etc/fstab file, and change the path from
/media/storage/ (make sure this folder exists before). Then mount your storage at the new location:
mount /media/storage respectively right?
fstab file won’t show anything in there before you put it in as it’s only used for permanent mounts, so following your retrieval of the
blkid in my above reply (UUID is way more reliable than using
/dev/sdX in the file) you can add the line in
fstab as I demonstrated above:
It’s fine that a folder is on the boot drive as that’s where the OS resides, but when you mount a drive in another directory it’s just like creating a shortcut rather than adding files to the boot drive. Does that make sense?
Good catch. I corrected my initial post.