wrolpi/controller/lib
lrnselfreliance a5ab01198b
The backup drive keeps deleted files for 30 days, then removes them (#999)
* The backup drive keeps deleted files for 30 days, then removes them

The fifth part of replacing the sync.  A backup drive never deleted anything, so it grew forever and kept every file
the media directory had ever held.  Now, like a secondary:

- A file deleted from the media directory, or the old version of one that changed, is moved to a dated folder in
  .backup-trash on the backup drive.  Folders older than backup_delete_after_days (sync.yaml; 30 by default, also
  for drives set up before this; none never deletes) are removed, before and after each backup, and the oldest go
  sooner when the drive is nearly full.
- A backup refuses a media directory that is not mounted, or has no config/wrolpi.yaml: copied with deletes, an
  empty folder would move the whole backup drive to the trash.
- The Backup Drive panel has the same "Delete after N days / Never delete them" control as the Sync panel, now one
  component, and refuses an empty number of days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* A nearly full drive keeps the trash it just filled, and makes room for the database

Review found, in the backup drive's trash and in the secondary's sync, which share its shape:

- Below 1 GiB free, the purge after a copy removed the newest trash folder too.  Moving a file to the trash is a
  rename, which frees nothing, so on a nearly full drive a deleted file was gone at the end of the same run instead
  of 30 days later.  The newest folder is now only removed by age (0 days still deletes at once).
- The purge made room only down to 1 GiB, so a database larger than the free space failed to be copied every time
  while the trash was full.  Before the database is written (the backup's snapshot, the secondary's copy of its
  primary's), the trash now makes room for the whole database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 16:50:21 -07:00
..
__init__.py Creating Controller service which will control WROLPi services, admin, SMART, disks, and status. nginx will fallback to Controller UI when React UI is unavailable (such as during upgrades). 2025-12-15 15:48:40 -07:00
admin.py The hotspot starts on boot (#829) 2026-10-13 19:29:15 -06:00
captive_portal.py Hotspot captive portal: welcome page with the WROLPi's address (#709) 2026-09-13 20:10:02 -06:00
config.py Controller: hide Root CA download until drive is ready 2026-07-18 13:44:35 -06:00
disks.py The drive wizard never offers an EFI system partition (#833) 2026-10-14 16:26:18 -06:00
docker_services.py A WROLPi serves its library over rsync, and makes a database snapshot on request (#988) 2026-11-18 16:47:02 -07:00
fstab.py Remove code that only tests called (#888) 2026-10-27 16:00:27 -06:00
fstab_migration.py Moving WROLPi-managed mounts off /etc/fstab onto a drive-resident fstab.yaml. 2026-05-24 12:44:05 -06:00
fstab_yaml.py Moving WROLPi-managed mounts off /etc/fstab onto a drive-resident fstab.yaml. 2026-05-24 12:44:05 -06:00
mount_executor.py Reconciler: uid/gid and ntfsfix for NTFS secondary mounts. 2026-07-06 20:30:29 -06:00
mount_runner.py Disks: allow persisting the primary mount from the UI; clean NTFS before mounting. 2026-07-05 14:50:56 -06:00
onboarding.py The drive wizard never offers an EFI system partition (#833) 2026-10-14 16:26:18 -06:00
readiness.py Checking readiness of main app in Controller instead of javascript requests, which break with CORS. 2026-03-08 16:05:56 -06:00
reconciler.py Reconciler: uid/gid and ntfsfix for NTFS secondary mounts. 2026-07-06 20:30:29 -06:00
rsyncd.py A WROLPi serves its library over rsync, and makes a database snapshot on request (#988) 2026-11-18 16:47:02 -07:00
samba.py Adding docker support for samba shares. 2026-03-29 11:14:38 -06:00
scripts.py A script's result reads the journal when systemd has cleared its timestamps (#956) 2026-11-08 11:25:38 -07:00
smart.py Surface coarse SMART health for USB-bridge drives (#498) 2026-06-26 09:05:06 -06:00
status.py controller: report idle (0 RPM) fans; prefer the CPU fan over case fans 2026-07-23 19:52:58 -06:00
status_worker.py Warn in the navbar when a hard drive runs hot (#470) 2026-06-11 19:46:33 -06:00
sync.py The backup drive keeps deleted files for 30 days, then removes them (#999) 2026-11-19 16:50:21 -07:00
systemd.py Controller logs: an unparseable since is a 400, not empty logs (#953) 2026-11-08 08:02:48 -07:00
wrol_mode.py Creating Controller service which will control WROLPi services, admin, SMART, disks, and status. nginx will fallback to Controller UI when React UI is unavailable (such as during upgrades). 2025-12-15 15:48:40 -07:00