Can I move one user to a separate disk drive?

One NC user area here is over 2 TB (a large photo collection). I’d like to move her files to a separate disk drive, to provide much more space (and room for future growth). I don’t have LVM set up, and there are several other tasks running on this system which I don’t want to interfere with. Most info I’ve found is about setting up an “external storage” as sub-folder, but I need to deal with all of that user’s data (lots of dirs) without changing her view of it all, i.e. the root of that user, not a sub-area in it.

Is this possible?

Potential solutions I’ve come up with so far are:

  1. a symlink replacing the user’s top level dir (i.e. the one containing cache/, files/, files_trashbin/, etc)
  2. a Linux “bind mount” (the new area is a subdir (it will be a subvolume on a BTRFS file system, to support instant snapshots)
  3. changing the user_directory setting for that one user, using occ user:setting ...

I haven’t tried any of these yet. All of them will have the issue that files can’t be moved between users (as they will be on different FS’s), but I can live with that. Sharing should still work, as that won’t actually move any files around, I expect.

Any guidance would be appreciated,

My setup:

Nextcloud version (eg, 20.0.5): 27.1.2
Operating system and version (eg, Ubuntu 20.04): Debian 12
Apache or nginx version (eg, Apache 2.4.25): Nginx 1.22.1
PHP version (eg, 7.4): 8.2

Not sure what you mean with moving files between users and I never tried it myself…
But I’m very sure it has to work with all your three ideas. I would try the 3rd one first. If the user loose all share due invalid Filecache entries, then you also need to edit the corresponding entry for the user root dir path in oc_drives or oc_disks (or something similar, don’t have it in mind yet).

Thanks. I hadn’t considered file shares, nor how file info is cached in the DB. Found this, which looks relevant: Nextcloud oc_storages table has multiple "local::" entries -- how to proceed? - Stack Overflow - ok, I’ll dig deeper, wouldn’t want to break existing shares or caching.

1 Like

Just a tip: Ensure you adjust the oc_storages entry before you disable the maintenance mode after you moved the directory to the the new path. Otherwise you never can change it again.

I did that recently while moving my instance to another server at another location. It worked well. The Filecache only keeps relative paths to the oc_storage paths, so you don’t need to adjust anything in oc_filecache. Only oc_storages need to be adjusted while maintenance mode is still active.

1 Like

I find Nextcloud is extremely picky about the underlying file structure. So I’d recommend #2, which will be completely transparent to Nextcloud.

  1. Shutdown the server.
  2. Move the user folder to the new location.
  3. Bind mount the folder back to its original location.
  4. Start the server.

Nextcloud won’t even realize you made a change. With your option #1 I’d be afraid NC might not fully respect the symlink. With option #3 you’d probably need to scan the new files in the new location (which means the old metadata will be lost).

Best of luck,

If you adjust the oc_storage then this step is not required. That’s what I meant. :slight_smile:

1 Like