Find Out How Much Space Your JetBackup Backups Use with AI
See what your JetBackup backups take up, which ones are kept and why, and what to change to free space. Read only.
Prerequisites
A site connected to WPVibe as an administrator (a network administrator on multisite), running JetBackup (tested on the free 3.1.24.10) on WordPress 6.9 or newer, with JetBackup, Settings, Security, WordPress Abilities API turned on (it is off by default). The check is read only.
My site uses JetBackup. Tell me how much space my backups use and what I could clean up. Read only: do not delete or change anything. 1. Run discover_abilities with category jetbackup. If no jetbackup abilities are listed, stop and tell me to install or update the free JetBackup plugin (on WordPress 6.9 or newer) and turn on JetBackup, Settings, Security, WordPress Abilities API, which is off by default. If a jetbackup ability answers that I am not allowed, tell me WPVibe must be connected as an administrator (a network administrator on multisite), and that if JetBackup's two-factor login (MFA) is on, Allow Abilities API Access When MFA is Enabled must be on too, on the same tab. Then stop. 2. JetBackup answers in numbers. A backup's contains and a job's backup_contains: 1 is site files only, 2 is the database only, 3 is both (a full backup). A job's excludes are folders it leaves out and its database_excludes are database tables whose rows it leaves out. On top of those, JetBackup leaves out common clutter by default (Settings, Performance, Use Common Folder Excludes): caches, log files, other backup plugins' folders, and the rows of log, session and statistics tables of some common plugins (their structure is kept): WooCommerce sessions and logs, Action Scheduler logs, Yoast's link tables, Wordfence and Shield security logs, Activity Log, WP Activity Log and Simple History, WP Statistics, Redirection's logs, WPML's mails and UpdraftPlus job data, more than the list on that screen shows (Use Common Database Excludes); this does not show in a job's fields and it is mostly caches, logs and other backup plugins' folders (it also leaves out some cache plugins' config folders, such as wp-content/wp-rocket-config). A backup also never includes JetBackup's own plugin folder, so it does not cover updating JetBackup itself, and by default it leaves out another WordPress install nested inside the site (Excluded Nested WordPress Sites, same tab, one folder deep). A backup queue item whose job_id is not in list-backup-jobs belongs to a deleted job or to JetBackup's internal configuration job. A backup's schedules_names say how it was made: Manually means Run Now; Imported means it was brought in from elsewhere; Hourly, Daily, Weekly, Monthly or After Job Done is the kind of schedule that made it. Leave out imported backups (params.imported true, or Imported in schedules_names). Compare each backup's params.site_url with run_wp_cli option get siteurl, ignoring http, https and www: leave out backups made under another address, but list them by that address (a domain change or host move can be the reason) instead of hiding them. Leave out any backup whose deleted is not 0: JetBackup has marked it for removal. In the queue, type 1 is a backup; status below 100 means waiting or running, 100 completed, 101 partially completed, 102 failed, 103 aborted, 104 never finished. status_name is often empty, so go by the number. Backups do not say which job made them: a queue item's item_data.snapshot_name is the name of the backup it made and item_data.job_id its job, and the queue keeps finished items for 24 hours by default (JetBackup, Settings, Maintenance). Times (created, started, ended, last_run, next_run) are Unix timestamps: get the time now with run_wp_cli db query "SELECT UNIX_TIMESTAMP() AS now", and show me times in my site's time zone (run_wp_cli option get timezone_string, or option get gmt_offset when that is empty). 3. Run jetbackup/get-dashboard and tell me snapshots and snapshots_size, but trust the totals you add up in step 4: the dashboard also counts JetBackup's own configuration backups (list-backups leaves those out) and backups marked for removal (you leave those out); the configuration backups are small, but they use space too. 4. Run jetbackup/list-backups. JetBackup's lists come back in no fixed order, up to 50 at a time: run each with limit 25 and, while you have fewer items than total, again with skip set to how many you have. If a page adds no new _id, stop paging and say how many you have of total. If WPVibe says a result was cut, run that page again with a smaller limit and keep paging: these abilities only read, so running them again is safe. Drop duplicates by _id, say so if you still have fewer than total, and sort backups and queue items by created yourself. Count every backup with deleted 0 here, Imported ones and other sites' included: they all use disk. Group them by destination_name and by contents, with the count and total size of each group (size is text such as 1.66 MB: add the sizes up yourself). List the five largest and the five oldest with date, size, contents and how each was made. Name any with locked 1: a lock keeps a backup whatever the retention says, until locked_ttl when that is not 0. 5. Run jetbackup/list-backup-jobs and jetbackup/list-schedules the same way. For each job with schedules, tell me how many copies each schedule keeps (retain, by schedule _id; it counts copies across all the job's destinations together, so with two destinations retain 4 keeps 4 copies in all, about 2 at each) and, from the sizes of backups with the same contents made by that kind of schedule (or by Run Now, if it has made none yet), roughly how much space that comes to once it has made that many. Then count the backups made with Run Now (schedules_names Manually, and not Imported, since imported backups keep their old tags and follow Imported Backups Retention instead) and their total size, and tell me they are kept until someone deletes them unless Manual Backups Retention is set in JetBackup, Settings, General (0, the default, keeps them all). 6. Run jetbackup/list-destinations. Say which destinations are Local or Imported: those copies share the server's disk with the site. 7. Suggest at most three changes, biggest saving first, for example: lower a schedule's retention in JetBackup, Backup Jobs; set Manual Backups Retention; delete old Run Now copies in JetBackup, Backups once a newer full backup exists; or save to JetBackup's cloud storage instead (2 GB free with a JetBackup account). Do not delete or change anything yourself.
Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:
Run the “Find Out How Much Space Your JetBackup Backups Use with AI” recipe from the WPVibe cookbook on my connected site.
Backups saved on the same server share its disk with the site. JetBackup keeps every copy its retention allows, and copies made with Run Now are kept until someone deletes them unless you set a limit, so the space goes quietly until the host warns that the disk is nearly full.
The AI adds up JetBackup’s backups by contents and by where they are stored, lists the largest and the oldest, shows which are locked (kept whatever the retention says) and how many copies each schedule keeps, and suggests what to change in JetBackup to free space. It deletes nothing: you remove backups and change retention in JetBackup.
Run it when your host warns about disk space, or before a big migration. Before deleting a copy, make sure you have a newer full backup, ideally off this server; this recipe tells you.
Outcome
Your backups added up by contents and place, the largest and oldest named, and up to three changes to make in JetBackup, biggest saving first.