How to get a previous install to work on a Samba File Server

I have installed Nextcloud on a server. It has been working well about 4 months. But I’m running out of storage. So, I built a Samba File Server with a partition of 4 TiB for Nextcloud. It is working as well. I’ve also mounted the Samba File Server to the Nextcloud Server. I copied the current nextcloud data directory to the mounted sambashare with recursive and preservation (i.e. cp -rp /mnt/sdb1/data /nas/cloud). Changed config.php to /nas/cloud/data. When I access nextcloud I get:

Your data directory is not writable.
Permissions can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/24/go.php?to=admin-dir_permissions.

I perused the link to no avail. In fact, I’ve looked at and tried so many things I’m at my wits end.
I don’t know how to give the nextcloud server write permission on the Samba Server . I’ve given the sambashare full premission and www-data ownership to no avail. I hope I don’t I have to do a clean install and then point to the sambashare. Am I trying the impossible? if not how do I make this work? If it’ll work please explain how and give examples.
Thank you,
RLB

Every time I’ve seen someone trying to put the data folder on a SMB share, it has led to problems. Would you be open to doing it another way?

Of course, If your willing to lead me trough it.
I was just reading in Admin Docs about enabling “External Storage” so I did that. In the docs it gives the SMB/CIFS as an option. But when I enabled “External Storage” and tried to config, that option is not there. A common occurrence it seems.

External storage is for adding something that is outside the server’s data folder (like a network share) and presenting it as a subfolder.

Mounting a share and putting the server’s data folder in it is something very different that I would definitely not recommend.

I guess in order to make a recommendation, I would need to know more about the Nextcloud server and the other one with the share. What are they? Does the storage server support other protocols like iSCSI? Can Nextcloud be migrated to the other server?

OK!
Here we go. To begin, neither of these servers are mission critical. Let’s call them a retired IT director’s hobby. One is a dedicated web server; Ubuntu 22.04.1, with an up-to-date AMP installation. It’s serving my domain devrod.com with subdomains and Nextcloud at mycloud.devrod.com in the root directory (i.e., not in a Nextcloud directory). The domain server has become a play thing after retirement. The Nextcloud installation is a replacement for TeamViewer. Not that it’s pertinent but, Nextcloud is so convenient, I no longer have to prepare to travel. But I digress. As I started to moving more and more to Nextcloud I started using up my webserver storage.

So, I grabbed an old 2010 3U surveillance server. I found a 10K RPM OS drive, 4Gb memory and a 12Tib storage drive. A poor man’s NAS. It’s running a minimal Ubuntu 20.04 installation and Samba. It works as an archive server for various other computer backups. And a 4Tb partition intended to hold Nextcloud’ s /data. But, you say that’s not a good idea. So, I guess it could host Nextcloud but it’s been 20 years since I did migration and those were Windows Servers. So, I’m apprehensive about doing that but, if it’s best, I’m game. Also, I’m not hep on exposing my archive server.

Hopefully, this gives you enough background to make your recommendation. As a side note; I have other pieces of old hardware that could be put to use, maybe.

Web Server:
Dell 7010
i5 CPU
16Gb mem
120 Gb SD OS
1 Tb 7200RPM HDD

Archive Server:
Asus P5G41T-M LX MB
Pentium(R) Dual-Core CPU
4 Gb mem
150 Gb OS drive
12TB Segate Enterprise Hard Drive

I do hope you intend to back it up because that setup won’t have any disk redundancy.

Well no, what I said was don’t put it on a SMB mount.

So since the storage server is running Ubuntu, you have some options. You might be able to put the data folder on a NFS mount. I don’t actually know if that’ll work or not. I think it’s less likely to run into weird permission issues than SMB.

Alternatively, you could set up iSCSI on it and put it in that. Probably a bit more work especially if you don’t have iSCSI experience, but it would be more or less guaranteed to work.

If you’re not averse to migrating it, you could also do that and then reverse proxy it from the original server. Then your backend server wouldn’t be directly exposed, and you avoid the overhead of having the data folder on network storage. I reverse proxy Nextcloud anyway, so this is probably the route I would choose.

Well you’re talking a bit over my head. I’m not familiar with iSCSi but I wasn’t familiar with Samba till I started this. So, I am trainable. Also, I’ll have to verse myself on migration and how to do that nowadays. In addition, I’m not knowledgeable on reverse proxy either. So, I’ll let this percolate a while and probably have to get back with my choice and questions.
As for the backing up of the /data, that was planned to be done with an image to the archive partition. I don’t have HDDs large enough to make any viable RAID. A 80+500+1000Gb will only give me the smallest.
I also, may be able to come up with another i5 machine to host Nextcloud. I’ll also need to get new certs for the 2nd server and build a router. But like I said, these are not mission critical and time is not of the essence. So, my work is cut out for me.
To quote Robert Burns “The best-laid plans of mice and men often go awry.”

Thanx for your time and trouble,
RLB

P.S. In the mean time if you have any helpful links to iSCSi, Migration, and Reverse Proxy feel free to share.

Hello,

Off Topic,

Why can’t you connect the 12TB HDD directly to the Dell based Nextcloud server? Wouldn’t it be faster to access it on system rather than going via LAN? Also, it will save on electricity too.

Thanks.

Because 8Tb of it is partitioned for archiving disk images and data backup of other network computers.
Besides “I have solar panels, windmills and cow dung to generate electricity to run my computers”. He said tongue in cheek.

You said you’re a retired IT director. Did you work at a school? Just curious, I do network engineering and almost all of my clients are school IT directors.

When you’re talking about file-based network shares like SMB or NFS or really just about anything… SFTP, TFTP, FTP… The remote system is processing file access requests from other systems, but retains control of its own file system.

iSCSI is different. To put iSCSI in a nutshell… You take a storage extent (which can be a disk, disk array, partition, logical volume, or even a file), and allow another system to assume full control of it by sending block-level IO commands over the network. The remote system actually partitions and formats it and treats it as if it were one of its own disks.

No, but thanks for the schooling, it clarified a lot of what I’d read last night.
I worked for the property management division of a national real estate franchises on South Padre Island. I started out modernizing their mini based network. But, once that was purring, websites were the new rage. So, I became a coder tasked with building their on-line reservation system including a 1000+ page website. It kept me very busy and there were a lot of things happening with webserver hardware I didn’t have time for. Now I do. I live in Central Texas with family near and far. I’m hoping to get to the point where I carry just a tablet, or PDA/phone, with everything stored and synced on my personal family cloud. Nextcloud is the solution.

I have a question;
I use the Samba server archive partition as a mapped drive on my Windows workstations. Acronis then images or file backups to the mapped drive directories. This is my disaster recovery system.

With the iSCSI system, am I correct in assuming that I can trash the Samba share for iSCSI and, still map drives to the Windows workstations for backups? And, now that I think about it, I have another question.

Since I only have a single drive for disaster recovery, would it be wiser to have individual partitions, for workstation backup storage as opposed to directories? The reality here is I’m trying to solve two problems with the proverbial single stone . Provide more storage for Nextcloud and provide disaster recovery the entire network. I know it’s not the ideal recovery system but a single drive provided more space for less money. Maybe later I can add another drive.

OMG, now I have more questions. I’ll save it for later.

Let me say one other thing about iSCSI. Unless you’re using a multiple access aware filesystem (for example VMFS), a given iSCSI target can only be mounted by one system at a time.

Imagine that you have a NTFS or EXT drive somehow cabled to two computers at once, with both of them making changes to clusters that the other doesn’t know about. Your filesystem would be corrupted almost immediately. This same principle applies to iSCSI because you are providing a block device, not a file share, to the other system.

But the benefit of it is the remote system can do anything on it, with no restrictions of any kind on what filesystem can be used or how permissions work. So for instance you could have a Linux system sharing an iSCSI disk with a Windows server, and that server could format it ReFS. Or vice versa, a Windows server could provide a VHD via iSCSI to a Linux server, and the Linux server could format it EXT4 or BTRFS or really anything, because the remote system is the one managing the block device.

On the subject of disaster recovery, there are really two main considerations.

  1. Make sure the production data and backup data are not on the same physical disk, or you risk losing both at once.
  2. Can the backup disk be read by different hardware in case of failure? For example if it’s a RAID volume, it may not be readable on a different brand RAID controller, whereas software RAID probably can. It doesn’t sound like this would be an issue in your case.

Whoa, that just scrambled my eggs. I’m not running “virtual” anything. Except the v host in Apache. Are you saying I’ll have to convert everything (i.e. web-server, workstations, etc.) to a VM?

No no, nothing like that. iSCSI creates a virtual block device. Sorry that may be TMI but I just wanted to stress that iSCSI is not a file share. It would be for one server to give some of its storage to the other, pertaining to your original question.

E.g. server 1 mounts server 2’s 4 TB partition via iSCSI, formats it as appropriate and puts the data folder on it. It avoids the permission malfunctions you’re likely to have if you put the data folder on SMB.

So, storage initiated by Nextcloud’s host would only be accessible by that host (i.e. \\websrv). And, that storage would NOT be accessible to any other host.
How do I backup/image Nextcloud/data and recover it to a different host, if need be?

I know it’s not open source, but the Veeam agent for Linux is free and really good. I use it to back up daily to an external hard drive.

Obviously I’m confused. If the data on a drive created by a host via iSCSI and, is only accessible by that host, how can you spin up a different host and access that data for recovery?

It depends on what you mean by recovery. Can you be more specific? Are we talking about failure of the server using the storage, or the one providing it?

iSCSI has a client and a server. In iSCSI terms they are called initiator and target, respectively. The target is the one providing the storage. The initiator connects to it and uses it as one of its own disks.

If your target/server has failed, you would have backed up the data on the initiator/client side through your normal backup mechanism, so you could restore that data to something else.

If your initiator/client has failed, then the data is still intact on the target/server. You could mount it on that server locally, or on another initiator, as long as only one thing has it mounted at any given time unless you’re using a cluster-aware filesystem (which is not what we’re talking about here).

Just to explain a bit on that, I use VMFS in VMware ESXi clusters. VMFS is a cluster-aware filesystem, so it’s ok to mount on more than one server simultaneously. This way all the ESXi servers have access to the virtual machine datastore, and a VM can be moved from one server to another without actually moving its files.

Hmm, I was replying to the post regarding backups, specifically from an initiator. If the target fails, I won’t be restoring anything. I’ll be backing up again from the source, which is not a backup of the target. I guess I’m still confused on how iSCSI works. Particularly, when serving as a data backup server (target). How does that server (target) recover to a dead initiator once it’s been resurrected or replaced. Because, it is no longer the initiator that initiated the backup on the target.
Remember the target is serving as a data store and backup store on a single drive with separate partitions. Unless you have a better solution. I can’t afford a RAID as a disaster mitigation.