Grow or move storage¶
Your archive outgrew its disk, or the SD card you started with is showing its age and you want it on an SSD. Both are the same job: move an encrypted volume without losing it.
You need a copy first
Every procedure here touches the only copy of your data, and pless cannot yet take a
backup for you. Copy /opt/paperless somewhere else before you start — see
Copy it out by hand below. Skipping this is how people lose
archives.
How much room do you need?¶
pless server df # what the target has now
pless docs estimate ~/Documents --local-only # what an import would add
Paperless keeps the original and an OCR'd archive copy, and exports add another copy. The estimator uses deliberately pessimistic multipliers and gives you a verdict — proceed, import in smaller batches, or add storage — rather than a number to interpret.
Its recommendation to add storage means the disk is too small no matter how you batch the import. Batching only helps when the problem is peak usage during import, not the end state.
Grow the LUKS file¶
If data_mode = "file" — the default — the volume is a sparse file on the root filesystem.
Growing it needs no new hardware, only free space underneath.
Raise the size in pless.toml:
Then, on the target:
sudo truncate -s 400G /var/lib/pless/data.img
sudo losetup -c $(losetup -j /var/lib/pless/data.img | cut -d: -f1)
exit
Growing an ext4 filesystem is safe and can be done while mounted. Shrinking is not, and is not covered here — moving to a smaller volume means creating a fresh one and copying.
Move to a different disk¶
The clean approach: create a new volume on the new disk and copy across. It is slower than cloning, but every step is reversible until the last one.
Attach the new disk, then find its stable identifier:
Use a by-id path. Names like /dev/sda are assigned in boot order and will eventually
point at something you did not intend — which, for a command that formats things, is a very
bad day.
Copy the data with both volumes mounted:
# Format the new disk as LUKS, using the same passphrase
sudo cryptsetup luksFormat --type luks2 /dev/disk/by-id/YOUR-DISK-ID
sudo cryptsetup open /dev/disk/by-id/YOUR-DISK-ID paperless-new
sudo mkfs.ext4 -L paperless /dev/mapper/paperless-new
sudo mkdir -p /mnt/new
sudo mount /dev/mapper/paperless-new /mnt/new
# Stop the stack so nothing writes while copying
sudo systemctl stop paperless.service
# Copy, preserving ownership and permissions
sudo rsync -aHAX --info=progress2 /opt/paperless/ /mnt/new/
Verify before you commit to it:
sudo du -sh /opt/paperless /mnt/new # sizes should match closely
sudo diff -rq /opt/paperless /mnt/new # slow but thorough
Then switch over:
Leave the old volume untouched until you have confirmed the archive works — documents present, search returning results. It is your rollback.
Copy it out by hand¶
Until pless backup exists, this is how you take a copy:
pless unlock
pless ssh
sudo tar czf /tmp/paperless-backup.tar.gz -C /opt/paperless .
exit
# from your laptop
scp <user>@<host>:/tmp/paperless-backup.tar.gz ./
For a large archive, rsync directly to your laptop avoids needing double the space on the
target:
Note what this is and is not: a copy of files, taken while the database may be mid-write. It is far better than nothing, and it is not a consistent database backup. The real thing — Paperless's own exporter plus encrypted restic snapshots, with restore drills — is the next milestone.
From file to partition¶
If you started with the default file-based volume and later added a dedicated disk, the move is exactly the disk migration above. The two modes differ only in where the encrypted block device comes from; everything above that layer is identical.