PostgreSQL data directory migration — 2026-04-11
Summary
Moved the pg16 cluster data directory from the root partition to /mnt/ursa to free disk pressure. No schema changes, no data loss.
Before
/var/lib/postgresql/16/main— 17 GB on/dev/nvme1n1p3(root, was 99% full)- pg16 cluster
postgresql@16-main.service(Debian/Ubuntu packaged postgres)
After
/mnt/ursa/data/terrapulse/postgres/16/main— 17 GB on/dev/sdj1(ursa, 36% used)- Same cluster, same connection string, same port 5433
Procedure
- Stopped TerraPulse API (killed uvicorn on 8111)
- Stopped pg16:
sudo systemctl stop postgresql@16-main.service - Created target dir:
sudo mkdir -p /mnt/ursa/data/terrapulse/postgres/16(chown postgres:postgres, chmod 700) - rsync:
sudo rsync -aAX /var/lib/postgresql/16/main/ /mnt/ursa/data/terrapulse/postgres/16/main/- 1,341 files, 18.1 GB, 65s
- Backed up config:
cp postgresql.conf postgresql.conf.bak-2026-04-11 - Edited
/etc/postgresql/16/main/postgresql.conf:data_directory = '/mnt/ursa/data/terrapulse/postgres/16/main'
- Started pg16:
sudo systemctl start postgresql@16-main.service - Verified health: psql connection, observation count (46.7M), latest row timestamps
- Restarted TerraPulse API
- Verified API
/health,/observations,/pulse/recentendpoints - Waited, verified new WAL segments being written to ursa, observation count growing
- Deleted old data dir:
sudo rm -rf /var/lib/postgresql/16/main.OLD-2026-04-11
Result
- Root disk: 6 GB free → 26 GB free (+20 GB after this + earlier DuckDB migration)
- Root usage: 99% → 95%
- Total downtime: ~5 minutes
- Data integrity: verified
- No config drift: postgresql.conf.bak-2026-04-11 preserved for reference
Remaining on root
Still significant non-TerraPulse data on root:
/home/bisenbek/projects/nominate(74 GB)/home/bisenbek/lib(84 GB)/home/bisenbek/projects/myfinalwishes.co(15 GB)- Other non-terrapulse projects
These are outside the scope of the TerraPulse storage policy.
Storage policy (effective 2026-04-11)
All TerraPulse data should live on /mnt/ursa. Specifically:
- WSPR raw archive:
/mnt/ursa/data/terrapulse/wspr/raw/✅ - DuckDB staging:
/mnt/ursa/data/terrapulse/duckdb/✅ (symlinked from project data/duckdb) - PostgreSQL data:
/mnt/ursa/data/terrapulse/postgres/16/main/✅ - Backfill queue:
/mnt/ursa/data/terrapulse/backfill/✅
The project repo on /home/bisenbek/projects/terrapulse should contain only code, small caches (graph_cache.json, etc), and the workspaces directory (which is small — paper text and small result files).