This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Nextcloud USB Drive
Status: archived. I don't run Nextcloud anymore. The partitioning and
fstabsteps still apply to any Linux box, but the Nextcloud-specific framing is no longer current for me.
Setting up an external USB drive as the data directory for Nextcloud. Walks through partitioning, formatting, mounting, and fstab so the drive comes back automatically on reboot.
Preparing the drive for Nextcloud
Identify the intended drive
Use lsblk to identify the drive you want to use for Nextcloud. In this example, we’ll assume the drive is /dev/sda.
Partitioning the drive
-
Install
partedsudo apt install -y parted -
Create a GPT partition table
sudo parted /dev/sda mklabel gpt -
Create a partition
sudo parted /dev/sda mkpart primary ext4 0% 100% -
(Optional) Name the partition
sudo parted /dev/sda name 1 my-data -
Format the partition
sudo mkfs.ext4 /dev/sda1
Mount the partition
-
Create a mount point
sudo mkdir /nextcloud-data -
Mount the partition
sudo mount /dev/sda1 /nextcloud-data -
Add to
/etc/fstabfor automatic mountingecho '/dev/sda1 /nextcloud-data ext4 defaults 0 0' | sudo tee -a /etc/fstab -
Set proper permissions
sudo chown www-data:www-data -R /nextcloud-data sudo chmod 0750 -R /nextcloud-data
Final steps
Once these steps are completed, you can use the USB drive as the data drive during the Nextcloud installation.
Navigation
Quick Links
Projects
Server (discourse)
- Host
- Cloudflare Tunnel
- Tailscale
- SFTP
- Discourse
- Forgejo
- Filedrop
- Filebrowser
- Landing Sites
- Onboarding
- Backups
- Recovery
Window Managers
Homelab
Docker
Software
Thoughts
Archived
Connect
Butterbian — my Debian 13 distro · butterrepo — community APT repo · butterknife — TUI installer
justaguylinux.com · Butterforge · Butter Lab · The Churn · YouTube · Mastodon · Links · Contact · Support on Buy Me a Coffee
"Not an expert. Just A Guy." — Licensed CC BY-SA 4.0 · © 2026 JustAGuy Linux