Skip to content
Vector database engineering on Kubernetes · Chapter 4 of 20 Day 3: Storage – when the closed stacks are full

Day 3: Storage – when the closed stacks are full

Goal: understand what Qdrant writes to its volume (WAL, segments), experience a full volume as a real incident, expand the volume during operation, bring Helm back in line with the cluster afterwards, and see why Longhorn does not return freed space by itself · Duration: about 120 min · Prerequisite: Day 0 to Day 2

State before this chapter

Qdrant is running from Day 2 with a 2 GiB volume; the collection doku has 13,220 points.

# on vdb1
kubectl -n qdrant exec qdrant-0 -- df -h /qdrant/storage

Expected:

Defaulted container "qdrant" out of: qdrant, ensure-dir-ownership (init)
Filesystem                                              Size  Used Avail Use% Mounted on
/dev/longhorn/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8  2.0G  108M  1.8G   6% /qdrant/storage
# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/doku/points/count -H 'Content-Type: application/json' -d '{"exact": true}'

Expected: "count":13220.

Introduction

Yesterday the branch opened. Today its closed stacks fill up – on purpose. A full volume is one of the most common incidents with databases on Kubernetes, and it is treacherous: the pod stays green, search keeps working, only writing fails. If you only look at the pod, you notice nothing.

First you look at what Qdrant actually writes to disk. Then you fill the volume with random vectors until Qdrant refuses, and read what Kubernetes, Qdrant and Longhorn report at that moment. After that you expand the volume – first in the obvious way, which fails, then in the way that works. Finally you clean up and discover that “cleaned up” in the file system does not mean “cleaned up” on the node.

Today you will learn:

  • which files Qdrant creates and what for: write-ahead log (WAL) and segments,
  • how a full volume shows itself – and how you cannot recognize it,
  • why helm upgrade cannot change the volume size of a StatefulSet,
  • how to expand a PVC during operation and bring Helm back in line afterwards,
  • why the optimizer needs free space, and how much,
  • why Longhorn volumes don’t shrink on the node by themselves.

Background

The picture of the day: the accession register and the full storeroom

The branch from Day 2 has a storeroom (the volume). Every delivery is first entered in the accession register and then placed on a book trolley. The accession register is the WAL: whatever is in it counts as accepted, even if the power fails before the book is on the trolley. The book trolleys are the segments.

At night, the optimizer rearranges: it merges small trolleys into large ones and builds signposts. For this it needs an empty trolley to reload onto – only once everything has been reloaded may it push the old trolleys away. If the room is too full for an empty trolley, the rearranging is cancelled.

If there isn’t even room for a new page in the accession register, the branch accepts no more deliveries. Lending continues, and the sign on the door still says “open”.

The room can be enlarged during operation – by moving a wall. The building plan at the authority office (the volumeClaimTemplate in the StatefulSet), however, cannot be changed; you have to withdraw it and resubmit it without the building being torn down in the process.

And the landlord of the warehouse (Longhorn) bills by the highest level ever occupied, not by what is still in the room today.

The terms

Term Meaning In the picture
WAL (write-ahead log) file to which Qdrant writes every change before it goes into a segment accession register
Segment folder with vectors, payload and possibly an index for part of the collection book trolley
Optimizer merges segments and builds the HNSW index; writes new segments in the process rearranging at night
volumeClaimTemplate template in the StatefulSet from which a PVC is created for each pod building plan at the authority office
Volume expansion make the PVC larger; the CSI driver enlarges the volume and the file system moving a wall
--cascade=orphan delete an object but leave its pods and PVCs in place withdraw the building plan, the building stays
actualSize space that a Longhorn replica really occupies on the node the landlord’s bill
fstrim tells the storage which blocks the file system no longer uses deregister empty shelves
Longhorn snapshot frozen state of a volume; holds on to old blocks photograph of the room

Remember: A volume is not only full when df shows 100%. For Qdrant it is full as soon as the accession register can’t get another page – and for the optimizer much earlier.

Drill 1: What is on the volume?

Where you are: on vdb1.

What you have afterwards: a picture of which files Qdrant creates for the collection doku and how large they are.

Step 1 – look at the root directory.

# on vdb1
kubectl -n qdrant exec qdrant-0 -- ls -la /qdrant/storage
  • exec qdrant-0 -- runs the command after -- in the container.
  • /qdrant/storage is the mount point of the Longhorn volume (from the chart’s values).

Expected:

Defaulted container "qdrant" out of: qdrant, ensure-dir-ownership (init)
total 48
drwxrwsr-x 7 1000 3000  4096 Dec  4 17:31 .
drwxr-xr-x 1 root root  4096 Dec  4 17:30 ..
drwxr-sr-x 2 1000 3000  4096 Dec  4 17:31 .deleted
drwxrwsr-x 2 1000 3000  4096 Dec  4 17:27 aliases
drwxrwsr-x 3 1000 3000  4096 Dec  4 17:31 collections
drwxrwsr-x 2 1000 3000  4096 Dec  4 17:27 collections_meta_wal
drwxrws--- 2 1000 3000 16384 Dec  4 17:27 lost+found
-rw-r--r-- 1 1000 3000   465 Dec  4 17:31 raft_state.json

What you see:

Entry Meaning
collections one subfolder per collection – this is where the data lives
collections_meta_wal accession register for changes to collections (create, delete)
raft_state.json state of the council from Day 2, with peer_id
.deleted holding area for deleted collections before they disappear for good
aliases second names for collections (Day 15)
lost+found belongs to the ext4 file system, not to Qdrant

The line Defaulted container comes from kubectl: besides qdrant, the pod has an init container. From Drill 2 on you name the container with -c qdrant, and the line disappears.

Step 2 – look into the collection.

# on vdb1
kubectl -n qdrant exec qdrant-0 -- ls -la /qdrant/storage/collections/doku/0

The 0 is the number of the shard. A collection can be divided into several shards (Day 5); doku has exactly one.

Expected:

Defaulted container "qdrant" out of: qdrant, ensure-dir-ownership (init)
total 28
drwxrwsr-x 4 1000 3000 4096 Dec  4 17:30 .
drwxrwsr-x 3 1000 3000 4096 Dec  4 17:29 ..
-rw-r--r-- 1 1000 3000   99 Dec  4 17:30 newest_clocks.json
-rw-rw-r-- 1 1000 3000   85 Dec  4 17:29 replica_state.json
drwxrwsr-x 6 1000 3000 4096 Dec  4 17:29 segments
-rw-rw-r-- 1 1000 3000   21 Dec  4 17:29 shard_config.json
drwxrwsr-x 2 1000 3000 4096 Dec  4 17:30 wal

What you see: two folders that matter: wal (the accession register) and segments (the book trolleys). The segments folder has six links – that is, four subfolders: the four segments from Day 2.

Step 3 – how large are the WAL and segments?

# on vdb1
kubectl -n qdrant exec qdrant-0 -- du -sh /qdrant/storage/collections/doku/0/wal /qdrant/storage/collections/doku/0/segments
  • du counts the space occupied by folders.
  • -s sums each folder up into one number, -h shows it in readable form (K, M, G).

Expected:

Defaulted container "qdrant" out of: qdrant, ensure-dir-ownership (init)
60M /qdrant/storage/collections/doku/0/wal
49M /qdrant/storage/collections/doku/0/segments

What you see: The accession register is larger than the whole holdings. That is not an error – step 4 shows why.

Step 4 – the WAL in detail.

# on vdb1
kubectl -n qdrant exec qdrant-0 -- ls -la /qdrant/storage/collections/doku/0/wal

Expected:

Defaulted container "qdrant" out of: qdrant, ensure-dir-ownership (init)
total 60600
drwxrwsr-x 2 1000 3000     4096 Dec  4 17:30 .
drwxrwsr-x 4 1000 3000     4096 Dec  4 17:30 ..
-rw-rw-r-- 1 1000 3000 33554432 Dec  4 17:29 closed-0
-rw-rw-r-- 1 1000 3000       16 Dec  4 17:30 first-index
-rw-rw-r-- 1 1000 3000 33554432 Dec  4 17:29 open-2
-rw-rw-r-- 1 1000 3000 33554432 Dec  4 17:29 open-3

What you see:

File Meaning
closed-0 a closed WAL section
open-2, open-3 prepared sections that will be written to next
first-index from which number the entries are still needed
33554432 each section is exactly 32 MiB – the WAL capacity from the collection configuration

Three sections of 32 MiB each would be 96 MiB, but du counted 60 MiB. ls shows the file size, du the occupied blocks: the open sections have been created but not yet fully written. So Qdrant always keeps a few empty pages in the accession register ready – even an empty collection costs space this way.

Step 5 – open a segment. Take the first folder name from kubectl -n qdrant exec qdrant-0 -- ls /qdrant/storage/collections/doku/0/segments – yours is different.

# on vdb1
kubectl -n qdrant exec qdrant-0 -- ls -la /qdrant/storage/collections/doku/0/segments/5cac3fea-08bd-4c7c-b136-b785b42a9b4d

Expected:

Defaulted container "qdrant" out of: qdrant, ensure-dir-ownership (init)
total 108
drwxrwsr-x 5 1000 3000  4096 Dec  4 17:30 .
drwxrwsr-x 6 1000 3000  4096 Dec  4 17:29 ..
-rw-rw-r-- 1 1000 3000 42900 Dec  4 17:29 mutable_id_tracker.mappings
-rw-rw-r-- 1 1000 3000 26400 Dec  4 17:29 mutable_id_tracker.versions
drwxrwsr-x 2 1000 3000  4096 Dec  4 17:29 payload_index
drwxrwsr-x 2 1000 3000  4096 Dec  4 17:30 payload_storage
-rw-r--r-- 1 1000 3000   238 Dec  4 17:30 segment.json
drwxrwsr-x 4 1000 3000  4096 Dec  4 17:29 vector_storage
-rw-rw-r-- 1 1000 3000     5 Dec  4 17:29 version.info

What you see: A segment is a small holdings of its own: vector_storage (the vectors), payload_storage (the index cards), payload_index (still empty – Day 4), segment.json (type and configuration) and mutable_id_tracker.* (which point ID is where). There is no folder for the HNSW index – the segment is below the indexing threshold.

Step 6 – vectors versus index cards.

# on vdb1
kubectl -n qdrant exec qdrant-0 -- du -sh /qdrant/storage/collections/doku/0/segments/5cac3fea-08bd-4c7c-b136-b785b42a9b4d/vector_storage /qdrant/storage/collections/doku/0/segments/5cac3fea-08bd-4c7c-b136-b785b42a9b4d/payload_storage

Expected:

Defaulted container "qdrant" out of: qdrant, ensure-dir-ownership (init)
9.7M    /qdrant/storage/collections/doku/0/segments/5cac3fea-08bd-4c7c-b136-b785b42a9b4d/vector_storage
2.3M    /qdrant/storage/collections/doku/0/segments/5cac3fea-08bd-4c7c-b136-b785b42a9b4d/payload_storage

What you see: Do the math: 13,220 points on four segments are around 3,300 per segment. 3,300 × 768 numbers × 4 bytes = 10.1 MB = 9.7 MiB. So the vectors are stored uncompressed as float32 on disk, exactly as in vektoren.npy. The index cards with path, title and text are only a quarter of that size.

Remember: The space requirement of a collection can be planned: points × dimension × 4 bytes for the vectors, plus payload, index and a WAL that occupies space even when empty.

Save your progress? Sign up for free

Drill 2: Letting the closed stacks fill up

Where you are: on vdb1, in ~/labor/tag03.

What you have afterwards: a full Qdrant volume and the error message with which Qdrant refuses to write.

You write random vectors into a second collection ballast until Qdrant refuses. The collection doku remains untouched – you use it shortly to check whether reading still works.

Step 1 – create the working folder.

# on vdb1
mkdir -p ~/labor/tag03
# on vdb1
cd ~/labor/tag03

Step 2 – write the filling program.

# on vdb1
nano ballast.py
~/labor/tag03/ballast.py new file
"""Füllt die Collection ballast mit Zufallsvektoren, bis Qdrant ablehnt."""
import sys
import time

import numpy as np
from qdrant_client import QdrantClient, models

QDRANT = sys.argv[1]
STAPEL = 2000

client = QdrantClient(url=QDRANT, timeout=120)
client.create_collection("ballast", vectors_config=models.VectorParams(size=768, distance=models.Distance.COSINE))

rng = np.random.default_rng(1)
geladen = 0
beginn = time.time()
while True:
    vektoren = rng.standard_normal((STAPEL, 768), dtype=np.float32)
    try:
        client.upsert("ballast", points=models.Batch(ids=list(range(geladen, geladen + STAPEL)),
                                                    vectors=vektoren.tolist()), wait=True)
    except Exception as fehler:
        print(f"nach {geladen} Punkten und {time.time() - beginn:.0f} s abgelehnt:")
        print(fehler)
        break
    geladen += STAPEL
    if geladen % 20000 == 0:
        print(f"{geladen:7d} Punkte nach {time.time() - beginn:4.0f} s", flush=True)
Line Meaning
create_collection("ballast", …) the same dimension and the same distance measure as doku
default_rng(1) random generator with a fixed seed – every run generates the same vectors
standard_normal((STAPEL, 768)) 2,000 vectors with 768 random numbers each
models.Batch(ids=…, vectors=…) a batch of points without payload, consecutive IDs
wait=True return only when Qdrant has written the batch to the WAL and applied it
except Exception the first rejected batch ends the loop and prints the message

The while loop runs in the program, not in your shell – you start it once.

Step 3 – start. The program runs for about ten minutes. If you want to watch, open a second terminal on vdb1 and repeat there from time to time kubectl -n qdrant exec qdrant-0 -c qdrant -- df -h /qdrant/storage.

# on vdb1
~/werkbank/bin/python ballast.py http://10.43.151.237:6333

Expected (the lines between 60,000 and 500,000 shortened):

  20000 Punkte nach   22 s
  40000 Punkte nach   43 s
  60000 Punkte nach   67 s
 500000 Punkte nach  540 s
 520000 Punkte nach  558 s
 540000 Punkte nach  577 s
 560000 Punkte nach  596 s
nach 560000 Punkten und 597 s abgelehnt:
Unexpected Response: 500 (Internal Server Error)
Raw response content:
b'{"status":{"error":"Service internal error: No space left on device: WAL buffer size exceeds available disk space"},"time":0.009276535}'

What you see: Around 940 points per second, then HTTP 500. The message says exactly what the picture says: the free space is not enough for a new page in the accession register (WAL buffer).

Step 4 – how full is the volume?

# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- df -h /qdrant/storage

-c qdrant selects the container in the pod; the Defaulted container line is dropped.

Expected:

Filesystem                                              Size  Used Avail Use% Mounted on
/dev/longhorn/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8  2.0G  1.9G   58M  97% /qdrant/storage

What you see: 97%, 58 MiB free. Qdrant refused before the file system was completely full – a WAL page is 32 MiB, and Qdrant checks before writing whether it fits. That is good: a file system at 100% can hit a database in the middle of a file.

If you watched in the second terminal, you noticed something strange: the usage did not rise evenly. In the author’s run, for example, it jumped back from 1.1 G to 650 M and from 1.6 G to 1.4 G. That was the optimizer: it merged segments and then freed the old ones. From 17:43 on there were no more jumps back; the usage only rose. What the optimizer reported at that point is shown in Drill 3.

Remember: Qdrant protects itself: it accepts no delivery that it cannot write completely to the accession register. The price is that all writes fail – not just the large ones.

Save your progress? Sign up for free

Drill 3: What the cluster reports during the incident

Where you are: on vdb1.

What you have afterwards: for each level – Kubernetes, Qdrant, log – the answer to the question “Can you see here that the volume is full?”.

Step 1 – the pod.

# on vdb1
kubectl -n qdrant get pod qdrant-0

Expected:

NAME       READY   STATUS    RESTARTS   AGE
qdrant-0   1/1     Running   0          15m

What you see: 1/1 Running, no restarts. Kubernetes considers the branch healthy.

Step 2 – Qdrant’s readiness check.

# on vdb1
curl -s http://10.43.151.237:6333/readyz

Expected:

all shards are ready

What you see: The same answer that the readiness probe gets. The sign on the door says “open”. For reading, that is even true.

Step 3 – query the collection ballast.

# on vdb1
curl -s http://10.43.151.237:6333/collections/ballast -o ballast.json
# on vdb1
jq -c '.result | {status, optimizer_status, points_count, indexed_vectors_count, segments_count}' ballast.json
  • -c prints the result compactly on one line.
  • {status, …} selects five fields from result.

Expected:

{"status":"red","optimizer_status":{"error":"Service runtime error: Not enough space available for optimization, needed: 540.70 MiB, available: 495.39 MiB"},"points_count":560000,"indexed_vectors_count":316000,"segments_count":4}

What you see:

Field Value Meaning
status red the collection has an error – here it is clearly stated for the first time
optimizer_status error … needed: 540.70 MiB, available: 495.39 MiB the optimizer would need an empty trolley of 541 MiB
points_count 560000 all accepted points are there
indexed_vectors_count 316000 part of them got an HNSW index, the rest no longer did

status is the value an alert has to look at – not the pod.

Step 4 – who occupies the space?

# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- du -sh /qdrant/storage/collections/ballast/0/wal /qdrant/storage/collections/ballast/0/segments /qdrant/storage/collections/doku

Expected:

59M /qdrant/storage/collections/ballast/0/wal
1.7G    /qdrant/storage/collections/ballast/0/segments
108M    /qdrant/storage/collections/doku

What you see: 560,000 × 768 × 4 bytes = 1.6 GiB of pure vectors – the 1.7 G of segments are almost entirely vectors. The calculation from Drill 1 holds.

Step 5 – does search still work?

# on vdb1
cd ~/labor/tag02
# on vdb1
~/werkbank/bin/python qsuche.py http://10.43.151.237:6333 http://10.43.16.22:11434 "How do I make a persistent volume bigger?"

Expected:

0.794  concepts/storage/storage-classes.md  [Volume expansion]  id=1776
0.794  concepts/storage/persistent-volumes.md  [Expanding Persistent Volumes Claims]  id=1702
0.768  tutorials/configuration/configure-persistent-volume-storage.md  [Create a PersistentVolumeClaim]  id=12940
0.743  reference/access-authn-authz/admission-controllers.md  [PersistentVolumeClaimResize]  id=2674
0.742  concepts/storage/persistent-volumes.md  []  id=1743
Antwort von Qdrant nach 181.4 ms

What you see: Search works, and the hits match the question – the documentation helps you right away. So lending continues, only deliveries don’t. At 181 ms, however, the answer took longer than on Day 2.

Step 6 – the log.

# on vdb1
kubectl -n qdrant logs qdrant-0 -c qdrant --since=15m

--since=15m shows only the lines from the last 15 minutes.

Expected (excerpt – the first and the last error lines, truncated on the right):

2026-12-04T17:41:18.723596Z ERROR collection::update_workers::optimization_worker: Optimization error: Service runtime error: Not enough space available for optimization, needed: 540.70 MiB, available: 495.39 MiB
2026-12-04T17:41:19.202683Z ERROR collection::update_workers::optimization_worker: Optimization error: Service runtime error: Not enough space available for optimization, needed: 547.73 MiB, available: 482.72 MiB
2026-12-04T17:46:23.745861Z ERROR qdrant::actix::helpers: Error processing request: Service internal error: No space left on device: WAL buffer size exceeds available disk space
2026-12-04T17:46:23.746400Z  INFO actix_web::middleware::logger: 10.42.0.0 "PUT /collections/ballast/points?wait=true HTTP/1.1" 500 135 "-" "python-client/1.20.0 python/3.12.3" 0.705252
2026-12-04T17:46:27.314046Z  WARN collection::update_workers::optimization_worker: Cleaned an optimization handle after timeout, explicitly triggering optimizers
2026-12-04T17:46:27.317458Z ERROR collection::update_workers::optimization_worker: Optimization error: Service runtime error: Not enough space available for optimization, needed: 2.02 GiB, available: 57.96 MiB

What you see: Read the times. The first error came at 17:41:18 from the optimizer – five minutes before the first write was rejected (17:46:23). During these five minutes, loading continued normally, and the only hint was in the log. After that, the optimizer retries every five seconds; in the author’s run, there were 147 of these error lines in the log.

Remember: A full volume shows itself in this order: first optimizer errors in the log, then status: red, finally HTTP 500 on writes. The pod and /readyz stay green the whole time.

Save your progress? Sign up for free

Drill 4: The obvious way – and why it fails

Where you are: on vdb1, in ~/labor/tag02.

What you have afterwards: the error message everyone sees once who changes the volume size in the chart – and a release in the failed state.

The size of the volume is in qdrant-werte.yaml. The first thought: change the number, helm upgrade.

Step 1 – change the size in the values.

# on vdb1
nano qdrant-werte.yaml
~/labor/tag02/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 1

nodeSelector:
  vdb-rolle: daten

resources:
  requests:
    cpu: 500m
    memory: 1Gi
  limits:
    memory: 2Gi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true

Step 2 – update the release.

# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 --namespace qdrant --values qdrant-werte.yaml

Expected (excerpt of the last line – beginning and end, the middle with the whole template shortened):

Error: UPGRADE FAILED: server-side apply failed for object qdrant/qdrant apps/v1, Kind=StatefulSet: StatefulSet.apps "qdrant" is invalid: spec.volumeClaimTemplates: Invalid value: [...]: field is immutable

What you see: spec.volumeClaimTemplates … field is immutable. Kubernetes allows only a few changes to an existing StatefulSet; the template for the PVCs is not one of them. The building plan has been submitted to the authority office and cannot be amended. This is not due to Helm and not due to Qdrant, but to the StatefulSet itself.

Step 3 – can the StorageClass expand at all? Before you look for another way, you check whether Longhorn may expand volumes.

# on vdb1
kubectl get storageclass longhorn

Expected:

NAME       PROVISIONER          RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
longhorn   driver.longhorn.io   Delete          Immediate           true                   115m

What you see: ALLOWVOLUMEEXPANSION true. Without this switch, Kubernetes would reject every expansion of a PVC of this class – then the only option left would be moving to a new volume.

Step 4 – what Helm has remembered.

# on vdb1
helm history qdrant -n qdrant

Expected (column DESCRIPTION truncated on the right):

REVISION    UPDATED                     STATUS      CHART           APP VERSION DESCRIPTION
1           Fri Dec  4 17:27:13 2026    superseded  qdrant-1.20.3   v1.20.3     Install complete
2           Fri Dec  4 17:28:27 2026    deployed    qdrant-1.20.3   v1.20.3     Upgrade complete
3           Fri Dec  4 17:46:52 2026    failed      qdrant-1.20.3   v1.20.3     Upgrade "qdrant" failed: server-side apply failed for object qdrant/qdrant apps/v1, Kind=StatefulSet: StatefulSet.apps "qdrant" is invalid: spec.volumeClaimTemplates: Invalid value: [{"name

What you see: Revision 3 is failed, revision 2 remains deployed. Nothing has changed in the cluster – the volume is still 2 GiB and still full.

Remember: The volume size in the chart only takes effect when a PVC is first created. An existing StatefulSet cannot be enlarged through it – field is immutable is not a Helm error but a Kubernetes rule.

Save your progress? Sign up for free

Drill 5: Expanding the volume during operation

Where you are: on vdb1.

What you have afterwards: a 4 GiB volume under the running pod, without a restart.

What doesn’t work on the StatefulSet works on the PVC itself: its requested size may increase if the StorageClass allows it. Then Longhorn enlarges the volume and the kubelet enlarges the file system on it.

Step 1 – note the time.

# on vdb1
date +%T

Expected (your time):

17:47:03

Step 2 – expand the PVC.

# on vdb1
kubectl -n qdrant patch pvc qdrant-storage-qdrant-0 -p '{"spec":{"resources":{"requests":{"storage":"4Gi"}}}}'
  • patch pvc qdrant-storage-qdrant-0 changes exactly this PVC (name = template qdrant-storage + pod qdrant-0).
  • -p '…' is the change as JSON: only the field spec.resources.requests.storage, everything else stays.

Expected:

persistentvolumeclaim/qdrant-storage-qdrant-0 patched

Step 3 – check immediately.

# on vdb1
kubectl -n qdrant get pvc qdrant-storage-qdrant-0

Expected:

NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
qdrant-storage-qdrant-0   Bound    pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   2Gi        RWO            longhorn       <unset>                 19m

What you see: CAPACITY is still 2Gi. The PVC wants 4 GiB but still has 2. What is happening right now is in the events.

# on vdb1
kubectl -n qdrant describe pvc qdrant-storage-qdrant-0

Expected (excerpt – conditions and the last two events, truncated on the right):

Conditions:
  Type       Status  LastProbeTime                     LastTransitionTime                Reason        Message
  ----       ------  -----------------                 ------------------                ------        -------
  Unused     False   Mon, 01 Jan 0001 00:00:00 +0000   Fri, 04 Dec 2026 17:30:39 +0000   PodUsingPVC   A pod is currently referencing this PVC
  Resizing   True    Mon, 01 Jan 0001 00:00:00 +0000   Fri, 04 Dec 2026 17:47:04 +0000                 
Events:
  Normal  Resizing               2s                 external-resizer driver.longhorn.io                                                       External resizer is resizing volume pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8
  Normal  ExternalExpanding      2s                 volume_expand                                                                             waiting for an external controller to expand this PVC

What you see: The condition Resizing True: Longhorn’s external-resizer has taken over the job.

Step 4 – wait. Repeat kubectl -n qdrant get pvc qdrant-storage-qdrant-0 until CAPACITY shows 4Gi. Then note the time.

# on vdb1
kubectl -n qdrant get pvc qdrant-storage-qdrant-0

Expected (after a good half minute):

NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
qdrant-storage-qdrant-0   Bound    pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   4Gi        RWO            longhorn       <unset>                 20m
# on vdb1
date +%T

Expected:

17:47:47

Step 5 – the events of the whole expansion.

# on vdb1
kubectl -n qdrant describe pvc qdrant-storage-qdrant-0

Expected (excerpt – the events of the expansion, truncated on the right):

  Normal  Resizing                    45s                external-resizer driver.longhorn.io                                                       External resizer is resizing volume pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8
  Normal  ExternalExpanding           45s                volume_expand                                                                             waiting for an external controller to expand this PVC
  Normal  FileSystemResizeRequired    35s                external-resizer driver.longhorn.io                                                       Require file system resize of volume on node
  Normal  FileSystemResizeSuccessful  2s                 kubelet                                                                                   MountVolume.NodeExpandVolume succeeded for volume "pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8" 

What you see: Two stages, as when moving a wall:

Event Who What
Resizing, ExternalExpanding Longhorn the block device gets larger – the room
FileSystemResizeRequired Longhorn reports: the device is larger, the file system not yet
FileSystemResizeSuccessful kubelet on vdb2 enlarges ext4 during operation – the shelves reach the new wall

From the patch to the finished file system: 44 seconds.

Step 6 – what the pod sees.

# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- df -h /qdrant/storage

Expected:

Filesystem                                              Size  Used Avail Use% Mounted on
/dev/longhorn/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8  3.9G  1.9G  2.0G  49% /qdrant/storage
# on vdb1
kubectl -n qdrant get pod qdrant-0

Expected:

NAME       READY   STATUS    RESTARTS   AGE
qdrant-0   1/1     Running   0          17m

What you see: 3.9 G instead of 2.0 G, 49% used. The pod is the same (AGE 17m, no restarts) – Qdrant didn’t notice the expansion, it simply has more space.

Remember: A PVC grows during operation if the StorageClass has allowVolumeExpansion: true: first the device, then the file system. Making it smaller is not possible – neither on the PVC nor on the wall.

Save your progress? Sign up for free

Drill 6: Bringing Helm back in line

Where you are: on vdb1, in ~/labor/tag02.

What you have afterwards: a StatefulSet whose template says 4 GiB, and a Helm release in deployed.

The PVC now has 4 GiB, but the StatefulSet still says 2 GiB, and Helm is at failed. With the next pod with a new number (Day 5), a 2 GiB PVC would be created again. So the building plan has to be resubmitted: delete the StatefulSet without deleting the pod along with it, then let Helm create the StatefulSet with the new template.

Step 1 – delete the StatefulSet, leave the pod in place.

# on vdb1
kubectl -n qdrant delete statefulset qdrant --cascade=orphan

--cascade=orphan deletes only the StatefulSet object. Pods and PVCs it created remain and merely lose their owner. Without this setting, Kubernetes would delete the pod along with it.

Expected:

statefulset.apps "qdrant" deleted from qdrant namespace
# on vdb1
kubectl -n qdrant get pod qdrant-0

Expected:

NAME       READY   STATUS    RESTARTS   AGE
qdrant-0   1/1     Running   0          17m

What you see: The pod keeps running as if nothing had happened. The building stands; only the building plan has been withdrawn.

Step 2 – Helm creates the StatefulSet anew.

# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 --namespace qdrant --values qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
NAME: qdrant
LAST DEPLOYED: Fri Dec  4 17:48:01 2026
NAMESPACE: qdrant
STATUS: deployed
REVISION: 4
DESCRIPTION: Upgrade complete

Step 3 – check the new template.

# on vdb1
kubectl -n qdrant get statefulset qdrant -o jsonpath='{.spec.volumeClaimTemplates[0].spec.resources.requests.storage}'

-o jsonpath='…' prints only the one field: the requested size in the first (and only) PVC template.

Expected:

4Gi
# on vdb1
kubectl -n qdrant get pod qdrant-0

Expected:

NAME       READY   STATUS    RESTARTS   AGE
qdrant-0   1/1     Running   0          17m

What you see: Template 4Gi, and the pod is still the same. The new StatefulSet recognized the orphaned pod qdrant-0 by its labels and adopted it instead of starting a new one – because nothing has changed in the pod template.

Step 4 – Helm’s memory.

# on vdb1
helm history qdrant -n qdrant --max 2

--max 2 shows only the last two revisions.

Expected (column DESCRIPTION truncated on the right):

REVISION    UPDATED                     STATUS      CHART           APP VERSION DESCRIPTION
3           Fri Dec  4 17:46:52 2026    failed      qdrant-1.20.3   v1.20.3     Upgrade "qdrant" failed: server-side apply failed for object qdrant/qdrant apps/v1, Kind=StatefulSet: StatefulSet.apps "qdrant" is invalid: spec.volumeClaimTemplates: Inva
4           Fri Dec  4 17:48:01 2026    deployed    qdrant-1.20.3   v1.20.3     Upgrade complete

Remember: The order is fixed: first expand the PVC, then delete the StatefulSet with --cascade=orphan, then helm upgrade. The other way round, you get either immutable or a PVC that is too small for the next pod.

Save your progress? Sign up for free

Drill 7: The optimizer needs an empty trolley

Where you are: on vdb1, in ~/labor/tag03.

What you have afterwards: the experience that “space again” does not mean “enough space” for the optimizer.

The volume is now half empty. Is ballast healthy again?

Step 1 – query the state.

# on vdb1
cd ~/labor/tag03
# on vdb1
curl -s http://10.43.151.237:6333/collections/ballast -o ballast.json
# on vdb1
jq -c '.result | {status, optimizer_status, points_count, indexed_vectors_count, segments_count}' ballast.json

Expected:

{"status":"red","optimizer_status":{"error":"Service runtime error: Not enough space available for optimization, needed: 540.70 MiB, available: 495.39 MiB"},"points_count":560000,"indexed_vectors_count":316000,"segments_count":5}

What you see: Still red, and with the message from the incident (495 MiB free – which has long ceased to be true). The status does not change by itself just because the volume has become larger.

Step 2 – nudge the optimizer. A change to the optimizer configuration – even an empty one – triggers a new attempt.

# on vdb1
curl -s -X PATCH http://10.43.151.237:6333/collections/ballast -H 'Content-Type: application/json' -d '{"optimizers_config": {}}'
Setting Meaning
-X PATCH change parts of the collection configuration
-d '{"optimizers_config": {}}' change no values, but have the optimizer reconfigured

Expected:

{"result":true,"status":"ok","time":0.117882853}
# on vdb1
curl -s http://10.43.151.237:6333/collections/ballast -o ballast.json
# on vdb1
jq -c '.result | {status, optimizer_status, points_count, indexed_vectors_count, segments_count}' ballast.json

Expected:

{"status":"yellow","optimizer_status":"ok","points_count":560000,"indexed_vectors_count":316000,"segments_count":5}

What you see: yellow means: the optimizer is working.

Step 3 – one minute later.

# on vdb1
curl -s http://10.43.151.237:6333/collections/ballast -o ballast.json
# on vdb1
jq -c '.result | {status, optimizer_status, points_count, indexed_vectors_count, segments_count}' ballast.json

Expected:

{"status":"red","optimizer_status":{"error":"Service runtime error: Not enough space available for optimization, needed: 1.47 GiB, available: 1.47 GiB"},"points_count":560000,"indexed_vectors_count":316000,"segments_count":5}
# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- df -h /qdrant/storage

Expected:

Filesystem                                              Size  Used Avail Use% Mounted on
/dev/longhorn/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8  3.9G  2.4G  1.5G  62% /qdrant/storage

What you see: red again. Usage rose from 1.9 G to 2.4 G – the optimizer started reloading – and then it reported: for the next step it needs 1.47 GiB, and exactly that much is free – too tight. As the segments grow, so does the empty trolley it needs.

Remember: Plan free space for the optimizer the size of the largest segments it is supposed to merge. With a single large collection, that means: the volume should never be more than about half full.

Save your progress? Sign up for free

Drill 8: Cleaning up

Where you are: on vdb1.

What you have afterwards: a volume with only doku, a green collection and proof that loading again creates no duplicates.

Step 1 – delete the ballast.

# on vdb1
curl -s -X DELETE http://10.43.151.237:6333/collections/ballast

Expected:

{"result":true,"status":"ok","time":0.766105632}
# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- df -h /qdrant/storage

Expected:

Filesystem                                              Size  Used Avail Use% Mounted on
/dev/longhorn/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8  3.9G  108M  3.8G   3% /qdrant/storage
# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- ls -la /qdrant/storage/.deleted

Expected:

total 8
drwxr-sr-x 2 1000 3000 4096 Dec  4 17:49 .
drwxrwsr-x 7 1000 3000 4096 Dec  4 17:49 ..

What you see: After six seconds the 2.3 G are free; .deleted is already empty again. In the file system, the space is back immediately – remember that for Drill 9.

Step 2 – is doku undamaged?

# on vdb1
curl -s http://10.43.151.237:6333/collections/doku -o ~/labor/tag03/doku.json
# on vdb1
jq -c '.result | {status, optimizer_status, points_count, indexed_vectors_count, segments_count}' ~/labor/tag03/doku.json

Expected:

{"status":"green","optimizer_status":"ok","points_count":13220,"indexed_vectors_count":0,"segments_count":4}

What you see: green, 13,220 points, four segments – exactly the state of Day 2. The incident only hit the collection that filled the volume.

Step 3 – how busy is Qdrant?

# on vdb1
kubectl top pod -n qdrant

Expected:

NAME       CPU(cores)   MEMORY(bytes)   
qdrant-0   6294m        317Mi           

What you see: Over six cores, a few seconds after the deletion. What Qdrant is computing there, kubectl top doesn’t show; half a minute later it’s over (step 5). Because the chart sets no CPU limit (Day 2), Qdrant may use the node’s free cores.

Step 4 – load the corpus a second time. What happens if someone starts the loading program again after an incident “just to be safe”?

# on vdb1
cd ~/labor/tag02
# on vdb1
~/werkbank/bin/python laden.py http://10.43.151.237:6333 doku

Expected:

13220 Punkte in 29.2 s geladen
# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/doku/points/count -H 'Content-Type: application/json' -d '{"exact": true}'

Expected:

{"result":{"count":13220},"status":"ok","time":0.010077543}

What you see: Still 13,220, not 26,440. laden.py assigns the IDs in a fixed way (line number in the corpus), and upsert means “create or replace”: every point was replaced by itself. Loading is idempotent – it can be repeated any number of times.

Step 5 – quiet and size.

# on vdb1
kubectl top pod -n qdrant

Expected:

NAME       CPU(cores)   MEMORY(bytes)   
qdrant-0   309m         312Mi           
# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- du -sh /qdrant/storage/collections/doku/0/wal /qdrant/storage/collections/doku/0/segments

Expected:

56M /qdrant/storage/collections/doku/0/wal
51M /qdrant/storage/collections/doku/0/segments

What you see: CPU back at a third of a core. The WAL and segments are practically as large as in Drill 1 – the second load replaced points, it didn’t add them.

Remember: Fixed IDs plus upsert make loading repeatable. After an incident, “just load it again” is then safe – with random IDs it would be a duplication.

Save your progress? Sign up for free

Diagnosis task: The empty volume that fills the node

A colleague reports: “According to df, Qdrant only occupies 108 MB now. But Longhorn says the volume occupies 2.8 GB on every node with a replica. Is Longhorn broken?”

Think about where the difference could come from before you read on.

Solution, step by step.

Step 1 – what Longhorn reports.

# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8 -o jsonpath='{.spec.size} {.status.actualSize}'
  • volumes.longhorn.io is Longhorn’s own object for the volume, with the same name as the PV.
  • {.spec.size} is the size of the volume, {.status.actualSize} the space a replica really occupies on the node.

Expected:

4294967296 2865115136

What you see: 4 GiB in size, 2.87 GB occupied – even though only 108 M are in the file system.

Step 2 – check on the node. One replica of this volume is on vdb1. Longhorn stores replicas as files under /var/lib/longhorn/replicas.

# on vdb1
sudo du -sh /var/lib/longhorn/replicas/

Expected:

3.1G    /var/lib/longhorn/replicas/
# on vdb1
sudo ls /var/lib/longhorn/replicas/

Expected:

pvc-1be489ab-3891-4c08-b4b4-b3d91dac36d9-4530493a
pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8-40aca7db

What you see: Two replicas: Ollama’s model volume and Qdrant’s volume. Together 3.1 G on vdb1’s disk.

The cause, part 1: A block device knows nothing about files. When Qdrant deletes a file, ext4 remembers that the blocks are free – Longhorn underneath learns nothing about it. For Longhorn, the blocks have been written, so they are occupied. Reporting the free blocks to the storage is called trim.

Step 3 – where is the file system mounted? fstrim needs a mount point on the node where the pod is running – vdb2.

# on vdb2
findmnt -n -o TARGET -S /dev/longhorn/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8
Setting Meaning
-n without a header line
-o TARGET only the column with the mount point
-S /dev/longhorn/… only mounts of this device

Expected:

/var/lib/kubelet/plugins/kubernetes.io/csi/driver.longhorn.io/816b666879b36b66025c32be288b2b260d6f19f9b13026ac6ecc820c739dccf5/globalmount
/var/lib/kubelet/pods/98032f92-1b68-4ecb-bb75-d222a6fde23b/volumes/kubernetes.io~csi/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8/mount

What you see: The same file system twice: once as the CSI driver’s globalmount, once in the pod’s folder. Both paths are different for you.

Step 4 – trim. Insert your globalmount path.

# on vdb2
sudo fstrim -v /var/lib/kubelet/plugins/kubernetes.io/csi/driver.longhorn.io/816b666879b36b66025c32be288b2b260d6f19f9b13026ac6ecc820c739dccf5/globalmount
  • fstrim reports all free blocks of the file system to the device.
  • -v prints how much was reported.

Expected:

/var/lib/kubelet/plugins/kubernetes.io/csi/driver.longhorn.io/816b666879b36b66025c32be288b2b260d6f19f9b13026ac6ecc820c739dccf5/globalmount: 3.7 GiB (4003463168 bytes) trimmed

Step 5 – is the space back?

# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8 -o jsonpath='{.spec.size} {.status.actualSize}'

Expected (ten seconds after the trim):

4294967296 2257244160
# on vdb1
sudo du -sh /var/lib/longhorn/replicas/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8-40aca7db

Expected:

2.2G    /var/lib/longhorn/replicas/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8-40aca7db

What you see: 3.7 GiB reported, but only 0.6 GB back. Something is holding on to the remaining 2 GB. (Longhorn updates actualSize with a delay; if you ask immediately after the trim, you still see the old number.)

Step 6 – snapshots of the volume.

# on vdb1
kubectl -n longhorn-system get snapshots.longhorn.io

Expected:

NAME                                                         VOLUME                                     CREATIONTIME           READYTOUSE   RESTORESIZE   SIZE         AGE
expand-4294967296-pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   2026-12-04T17:47:07Z   true         4294967296    2099634176   3m43s
# on vdb1
sudo ls -la /var/lib/longhorn/replicas/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8-40aca7db

Expected:

total 2204360
drwx------ 2 root root       4096 Dec  4 17:47 .
drwxr-xr-x 4 root root       4096 Dec  4 17:27 ..
-rw-r--r-- 1 root root 4294967296 Dec  4 17:50 volume-head-001.img
-rw-r--r-- 1 root root        200 Dec  4 17:47 volume-head-001.img.meta
-rw-r--r-- 1 root root 2147483648 Dec  4 17:46 volume-snap-expand-4294967296-pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8.img
-rw-r--r-- 1 root root        156 Dec  4 17:47 volume-snap-expand-4294967296-pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8.img.meta
-rw-r--r-- 1 root root        234 Dec  4 17:47 volume.meta

The cause, part 2: Nobody ordered the snapshot. Longhorn creates it itself during the expansion in Drill 5 (expand-4294967296-…, created at 17:47:07). It is a photograph of the full 2 GiB volume – with all the ballast’s blocks. A trim only affects the current layer (volume-head), not snapshots underneath.

Step 7 – delete the snapshot.

# on vdb1
kubectl -n longhorn-system delete snapshots.longhorn.io expand-4294967296-pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8

Expected:

snapshot.longhorn.io "expand-4294967296-pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8" deleted from longhorn-system namespace

In the author’s run, the SSH connection to vdb1 dropped right after that. The next morning, Longhorn’s events reported: the replica on vdb2 had been rebuilt; in the process Longhorn had removed the expand snapshot – and created its own system snapshot for the rebuild.

# on vdb1
kubectl -n longhorn-system get snapshots.longhorn.io

Expected (the next morning):

NAME                                   VOLUME                                     CREATIONTIME           READYTOUSE   RESTORESIZE   SIZE         AGE
f7b7abb9-2c78-4baa-a80d-bceae7bae000   pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   2026-12-05T07:25:39Z   false        4294967296    2135388160   59m
# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8 -o jsonpath='{.spec.size} {.status.actualSize}'

Expected:

4294967296 2135388160

What you see: The old snapshot is gone, a new one holds almost the same 2 GB. Longhorn has already marked it for removal (event snapshot is marked as removed, hence READYTOUSE false), but its file is still in the replica folder, and actualSize counts it. In the author’s run, a second fstrim reported 0 bytes – ext4 only trims areas in which something has been freed again since the last trim.

The result: Longhorn is not broken. A Longhorn volume occupies on every node with a replica as much as was once written to it, as long as nobody trims – and snapshots, including automatic ones, hold on to old blocks beyond that. With three replicas, that counts three times.

Remember: Plan the nodes’ disks according to the peak level, not today’s fill level. A full volume that you expanded and then emptied keeps costing space on the node.

Checkpoint

# on vdb1
kubectl -n qdrant get pvc qdrant-storage-qdrant-0

Expected: Bound, 4Gi, longhorn.

# on vdb1
kubectl -n qdrant get statefulset qdrant -o jsonpath='{.spec.volumeClaimTemplates[0].spec.resources.requests.storage}'

Expected: 4Gi.

# on vdb1
helm history qdrant -n qdrant --max 2

Expected: revision 3 failed, revision 4 deployed.

# on vdb1
curl -s http://10.43.151.237:6333/collections

Expected: only the collection doku.

# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/doku/points/count -H 'Content-Type: application/json' -d '{"exact": true}'

Expected: "count":13220.

Test yourself

  1. How could you have recognized today’s incident earliest – and how not at all?
  2. Why did Qdrant refuse already at 97% and 58 MiB of free space and not only at 100%?
  3. You change persistence.size in the values and call helm upgrade. What happens, and why?
  4. What would kubectl -n qdrant delete statefulset qdrant do without --cascade=orphan?
  5. After cleaning up, a volume is 40% full, and the largest collection has a 1.5 GiB segment. Will the optimizer be able to work?
  6. Why does a Longhorn volume cost more space on the node than df shows in the pod?

Answers:

  1. Earliest by the optimizer errors in the log (five minutes before the first HTTP 500), then by the collection’s status: red. It could not be recognized by the pod (1/1 Running) or by /readyz (all shards are ready).
  2. Qdrant checks before writing whether a whole WAL page (32 MiB) fits, and refuses otherwise. That way it never writes half a page into a full file system.
  3. Helm fails with spec.volumeClaimTemplates … field is immutable, the release is at failed, nothing changes in the cluster. The PVC template of a StatefulSet is immutable.
  4. Kubernetes would also delete the pod qdrant-0 – the branch would be closed until Helm creates a new StatefulSet. The PVC, however, would remain.
  5. Probably just barely: the optimizer needs free space the size of the segments it merges. Today it already reported “too little” with 1.47 GiB needed and exactly 1.47 GiB free. With 60% free on a 4 GiB volume (2.4 GiB), it is enough for one 1.5 GiB segment, but not for two together.
  6. Longhorn sees blocks, not files. Deleted files remain occupied for Longhorn until someone trims, and snapshots – including the automatic one during expansion – additionally hold on to old blocks. This applies to every replica.

Interview note

“How do you expand the volume of a database that runs as a StatefulSet?” – First check whether the StorageClass allows allowVolumeExpansion. Then patch each PVC individually – the StatefulSet itself does not allow changes to the volumeClaimTemplates. The CSI driver enlarges the device, the kubelet the file system, usually without a restart. Then delete the StatefulSet with --cascade=orphan and recreate it (with Helm: helm upgrade with the new size) so that new pods also get large PVCs. And beforehand: alerts on the fill level and on the collection status, not just on the pod.

Enterprise note

In production, three alerts belong to storage: volume fill level above 50–60% (because of the optimizer, not only at 90%), collection status other than green, and optimizer errors in the log. Qdrant itself provides the metrics for this (Day 11). The volume size comes from the capacity calculation (Day 9) – with reserve for the optimizer, WAL and snapshots. Longhorn can trim regularly (recurring job of type filesystem-trim) and clean up old snapshots; without that, the nodes’ disks only grow in one direction. And the expansion is practiced beforehand on a copy, not for the first time during an incident.

Summary

  • Qdrant first writes every change to the WAL (32 MiB pages, occupied even when empty) and then to segments. The vectors are stored on disk as float32: points × dimension × 4 bytes.
  • 560,000 random vectors filled the 2 GiB volume in 597 s. Qdrant refused at 97% with HTTP 500 (WAL buffer size exceeds available disk space).
  • The pod and /readyz stayed green, search kept working. The collection was red; the optimizer had already reported errors in the log five minutes earlier.
  • helm upgrade with a new volume size fails: volumeClaimTemplates … field is immutable.
  • Patch the PVC → Longhorn enlarges the device, the kubelet the file system: 44 s, without a restart. Then delete the StatefulSet with --cascade=orphan and run helm upgrade.
  • The optimizer needs free space the size of the segments it merges.
  • Fixed IDs + upsert: loading again creates no duplicates.
  • Longhorn only returns space on the node after a trim, and snapshots hold on to old blocks.

Commands at a glance

Command Purpose
kubectl -n qdrant exec qdrant-0 -c qdrant -- df -h /qdrant/storage fill level of the volume in the pod
kubectl -n qdrant exec qdrant-0 -c qdrant -- du -sh <folder> space per folder (WAL, segments)
~/werkbank/bin/python ballast.py <qdrant-url> fill the volume with random vectors
curl -s http://<ip>:6333/collections/<name> -o <file> save the state of a collection
jq -c '.result \| {status, optimizer_status, …}' <file> read status and optimizer
kubectl -n qdrant logs qdrant-0 -c qdrant --since=15m log of the last 15 minutes
kubectl get storageclass longhorn check whether volumes may grow
helm history qdrant -n qdrant revisions and failures
kubectl -n qdrant patch pvc <pvc> -p '{"spec":{"resources":{"requests":{"storage":"4Gi"}}}}' expand a PVC
kubectl -n qdrant describe pvc <pvc> follow the course of the expansion
kubectl -n qdrant delete statefulset qdrant --cascade=orphan delete the StatefulSet, keep the pod
curl -s -X PATCH http://<ip>:6333/collections/<name> -H 'Content-Type: application/json' -d '{"optimizers_config": {}}' nudge the optimizer again
curl -s -X DELETE http://<ip>:6333/collections/<name> delete a collection
kubectl -n longhorn-system get volumes.longhorn.io <pv> -o jsonpath='{.spec.size} {.status.actualSize}' size and real space requirement
findmnt -n -o TARGET -S /dev/longhorn/<pv> find the mount point on the node
sudo fstrim -v <globalmount> report free blocks to Longhorn
kubectl -n longhorn-system get snapshots.longhorn.io snapshots, including automatic ones

Contents

More