How can I set NextCloud (host&client) to use external hard drives for synching?

I’m seriously considering using NextCloud as my backup method. I’d duplicate my external data drive, mount it as the server’s synch drive, and then take the copy across town to mount as the synch drive on a client system.

I have decades worth of data, so I want to use large external drives in the 4TB range for this, not a small partition on the server’s internal drive. (This is also why I would duplicate the drive locally initially, so the synch would only have to include changes.) I also hope that the drives themselves don’t have to be encrypted, so they can be easily mounted on another machine in an emergency.

I’d probably use the pre-built VM since I’m not a Linux expert, so I’d need to know how to tweak that configuration to do this.

This seems like such a obvious way to set up synchronized off-site backup that I’m amazed not to find instructions on how to set this up. If you want to see lots of folks start to use NextCloud, such a primer would be a big help.

Hi,
I don’t really know much about the VM of what it is build on but in any linux distro you sould be able to mount your HDD to a specific location. You really don’t need to encrypt anything if you don’t want to. Within nextcloud you would have to use the external storage app. For instance I use my nextcloud 10 install to manage some multi media on a external HDD and that is shared with a plex server ( nice self hosted netflix like application to watch stuff with) so that’s not encrypted at all.

I’m not sure if the VM is the way to go for this settup. You would have to mount your external drive inside a VM and then mount it at a specific location within the distro and then use the external storage app to use it in Nextcloud. What virtualisation tools are you using?

I also use Nextcloud as an off-site backup and that works remarkably well.

File sync & share IS NOT a bakup.

If you want backups of your files please make sure to actually have backups. A sync is not a backup since if it is deleted on 1 system it is also synced (and thus deleted) on the other.

Well yes of-course. I just copy everything to a folder outside the sync when ever I feel it’s necessary.
So let me rephrase : I use Nextcloud to get my files off-site easily and safely so that I can make a backup there.

Ok that is much better :wink:

I’ve been to lazy to make a bash script for this.
…could it not easily be a feature of the client? :wink:

I know lots of students make “backups” by just trowing everything in Dropbox. This would be a great budget option to setup on off-site back up. All you need is a raspberry pi, a HDD and… some ducktape.

What you want probabaly in that case is

  • Client sycs to server
  • Server makes backups every N hours or so
1 Like

Mounting USB disks in a VM is relatively straightforward, though there’d be a little configuration within the server to have it mount where you want it, then in NC to have it show up reliably. A little commandline-fu will be required.

It’s worth echoing @rullzer though, a sync client isn’t a backup client. If something were to go wrong on the server resulting in a loss of data, that loss could well replicate to the client. Yes there are recycle/trash bins, but in the context of D(isaster)R(ecovery) you’d need to consider the implications of that not functioning properly.

I understand the objection that if a file is deleted in one place, it gets deleted at the other, but I’m coming from a hard disk crash where the drive’s electronics and mechanics went bad. That sort of disaster wouldn’t propagate. Fortunately, a data recovery service with a clean room was able to recover the data directly from the platters, but for a $2,400 charge.

Like Dropbox, NextCloud maintains older versions of files and even of deleted files unless told explicitly to dump them, at least until the holding space gets full.

A bigger concern is that I would like the drive to be accessible from Windows simultaneously with the Linux environment, so that my work in Windows would be synched. If both operating systems can’t use it at the same time, I’ll use it just as a cloud server mirroring drives running under Windows on other machines.

Where can I find instructions for mounting a local external hard drive for NextCloud to use as its cloud server drive?

I don’t think there are specific guides targeting NC for this purpose at the moment, so we can take another approach perhaps.

You’re going to use the official VM, that’s OK:

  • On what Virtualisation platform? Virtualbox, VMware, KVM, Hyper-V or something else?
  • On what underlying host operating system?

@enoch85 what flavour does the official VM run on?

1 Like

So Ubuntu, easy peasy :thumbsup:

Yes, the link enoch86 points to is the VM I downloaded, which I would be running on a 64 bit Win 7 Pro SP1 box using the “VMware-player-12.0.1_FOR_WINDOWS” that’s posted there as well.

My last contact with Unix was in the early 1980s when the only way to get on the internet was dial-up to The World, the first public ISP, and then typing unix commands to it via a terminal program. At that point, graphical web browsers were barely a gleam in anyone’s eye.

Coming from MS-DOS, my take on Unix was it was DOS’ mysterious older brother - you’d think you knew what you were doing, but you didn’t. Once upon a time I knew how to program batch files that used advanced functions, but that was decades ago.

I gather that Linux is more like Windows these days, at least on the surface, but still requires using the command line to to do more than just run programs.

OK, I haven’t personally used VMware player but I assume it works similarly to VMware Workstation. In practice you plug your drive in, ensure within the VMware virtual machine settings there’s a “USB Controller” listed under devices (and add it if not).

You can then “assign” the drive by clicking menu > Removable devices > Connect (Disconnect from host) on the relevant entry for the drive.

Once booted and after logging in, cancel the script with Ctrl + C and you can then locate the drive with sudo fdisk -l and take note of the path eg: /dev/sdc.

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 ntfs permissions,rw,uid=33,gid=33,umask=022,locale=en_US.utf8 0 0

Where UUID= would be the long number you got from running blkid and /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
uid&gid are user and group ID. 33 is that of www-data, the user you want to have access to the directory to be able to read and write, and umask is the default file permissions when writing to the volume (by default, the owner can read&write, everyone else only read)

This presumably would all need to be done before allowing the setup script to complete, as moving the data directory isn’t supported after setup, but you’ll be able to kick off the script again later.

If the drive is to be permanently allocated to the VM and hasn’t yet got your data on it, formatting it to a linux-preferred filesystem would be advantageous, though if it’s NTFS Ubuntu will support that too with a little more fluff in the fstab entry to set the correct permissions (an example of which I shall be able to provide tomorrow).

… maybe this should be a guide.

2 Likes

Yes, easy peasy :wink: All good!

1 Like

Haha, your post is funny. Imagine me 4 years ago. :slight_smile:

I started with 10.04 and I’m still not at the point where I can’t write bash scripts like yours :sweat_smile: though it’s taken me as many years to get to a point where I don’t Google everything for PHP, all these languages are like Japanese to me…

I can manage Linux fine now, though I still do things manually rather than via scripts :blush:

1 Like

In order to avoid having to copy 1.5 TB over the net (or even the LAN) - which took 6 hours to copy locally via USB 3.0 to USB 3.0 with a pair of 7200RPM 4TB Lacie drives - and to make the server cloud drive able to do double-duty as an available Windows backup of my data drive - I now have three copies of my data on 4TB USB NTFS Windows drives: one to be my working data drive, one to be the cloud server (and local backup) in my basement, and one to be set up across town as my off-site backup.

I haven’t yet mounted the virtual machine, nor run its setup script (which I’m assuming is inside that download). I’m looking forward to instructions on how to (1) mount it, (2) mount one of the USB NTFS drives for it to use, and (3) tweak its setup to use all of the space on that drive instead of space on the internal drive for cloud storage. I’m new enough at this that I don’t even know how to recognize the script file, much less how or when run it.

The script will start automatically on first run based on the documentation on @enoch85’s website. His documentation also talks about starting the configuration script again later, so that’s where you’ll need to start I imagine to get to the point where the VM is ready to boot, then follow my instructions above to add the drive and do the initial configuration, before then finally starting the script again.

So between Daniel’s documentation and my post above you should be able to make it through. If you’re wanting these two combined into one guide, it’ll have to wait until one of us can do that, though the info will be the same, just formatted a little better :wink:

I’ve edited my above post with the fstab entry I last used.

1 Like