How to Move K3s Data to a New Location

Sometimes, you need to move K3s data to a different disk or partition — for example, when you run out of space or want to use a faster storage device. Here’s a safe way to do it.

⚠️ Prerequisites

  • Root or sudo access
  • Disk or mount point already prepared (e.g., /datadrive)

📦 What Will Be Moved

We will migrate the following directories:

  • /run/k3s/
  • /var/lib/kubelet/pods/
  • /var/lib/rancher/

🛠️ Step-by-Step Guide

1. Stop the K3s Daemon

sudo systemctl stop k3s
sudo systemctl stop k3s-agent
sudo /usr/local/bin/k3s-killall.sh

2. Move K3s Data to the New Location

sudo mv /run/k3s/ /datadrive/k3s/
sudo mv /var/lib/kubelet/pods/ /datadrive/k3s-pods/
sudo mv /var/lib/rancher/ /datadrive/k3s-rancher/
sudo ln -s /datadrive/k3s/ /run/k3s
sudo ln -s /datadrive/k3s-pods/ /var/lib/kubelet/pods
sudo ln -s /datadrive/k3s-rancher/ /var/lib/rancher

4. Start the K3s Daemon

sudo systemctl start k3s
sudo systemctl start k3s-agent

✅ Verification

Check if the cluster is running:

kubectl get nodes

Make sure workloads are healthy:

kubectl get pods -A

🔍 Why This Matters

K3s stores all its working state (containers, pods, manifests, etc.) in these directories. Moving them safely prevents downtime and preserves cluster state.


Happy clustering!