Guides:Scheduling ZFS Pool Scrub and TRIM Around Backup Windows and Business Hours

From OSNEXUS Online Documentation Site
Jump to navigation Jump to search

By Steve Umbehocker, CTO, OSNexus · Updated October 19, 2026

A storage pool maintenance schedule runs two background jobs on scale-up (ZFS) pools: a scrub, which reads every block, checks it against its checksum and repairs any bit-rot it finds from redundancy, and an SSD TRIM, which tells flash media which blocks are free so it can reclaim them. QuantaStor runs both from Maintenance Schedules that start on a chosen day and hour, no more often than a minimum number of days apart. This guide shows how to place those runs outside backup windows and business hours, how to time a run on demand, and how to check that every schedule still holds the hour you chose.

Why it matters

ZFS checksums every block, but a checksum only helps when the block is read. Data that sits untouched for months (backup targets, archives, cold VM images) can collect latent sector errors that nobody sees until a disk fails and the rebuild needs that data. A scheduled scrub finds those errors while redundancy is still intact and repairs them in place. The QuantaStor Web Manager describes Pool Scrub as scanning "the pool(s) using checksums to detect and automatically repair any bit-rot."

TRIM matters for flash. When SSDs and NVMe devices aren't told which blocks are free, fragmentation builds up inside the media and write performance drifts down. Pool SSD TRIM scans the pool for blocks that can be discarded at the SSD level.

Both jobs are I/O-heavy. A scrub reads every allocated block in the pool, and the create dialog warns that maintenance operations "can sometimes take a week or more to complete." If a scrub starts during the nightly backup window or the morning login storm, it competes with them for the same disks. A fixed, deliberate start time is the main control you have.

How it works

A Maintenance Schedule has a maintenance type, a list of pools, a Start Day, a Start Time, and a Minimum Days Between Maintenance value. The scheduler fires the schedule on the chosen day and hour once the minimum interval since its last run has passed. If the interval hasn't elapsed, that slot is skipped and the schedule waits for the next matching day and hour.

Some behaviors shape the design:

  • Every pool on a schedule starts together. When a schedule fires, QuantaStor starts a separate scrub or TRIM task for each ZFS pool on that schedule. Those tasks are queued at the same moment, not one after another.
  • One type per schedule. The maintenance type is either a pool scrub or a pool SSD TRIM. To run both on a pool, create two schedules.
  • An empty schedule disables itself. If a schedule has no pools when it fires, it switches to disabled and reports that it has no associated Storage Pools.
  • A manual trigger resets the clock. Triggering a schedule runs it right away, even if the minimum interval hasn't passed, and records that as its last run. The next scheduled run then waits the full interval from that moment.

Scheduled TRIM is separate from the Enable SSD Auto Trim option on the pool itself. Auto-TRIM sends discards continuously as blocks are freed. A scheduled TRIM pass sweeps the whole pool and catches anything continuous discards missed. All-flash pools usually benefit from both. See Storage Pools for the pool options and the scrubbing, trim and health section.

The Enable SSD Auto Trim checkbox on the Advanced Settings tab of Create Storage Pool turns on continuous discards, separate from any scheduled TRIM pass

Design and sizing

Start by mapping your I/O calendar: when backups, snapshot schedules and remote replication run, and when users are active. Then choose the start slot that leaves the longest quiet run after it, usually early on a weekend day after the weekly full backup has finished.

Setting Allowed values Recommendation
Maintenance Type Pool Scrub, Pool SSD TRIM One schedule per type
Start Day Sunday to Saturday (CLI default Sunday) Start of the longest weekly quiet period
Start Time Any hour, 12am to 11pm (CLI default 3am) After backups and replication have finished
Minimum Days Between Maintenance 3 to 90 in the dialog A multiple of 7 for scrub, from 28 to 84

Choose a multiple of seven for the interval. The schedule only fires on its Start Day, so a 30-day interval actually lands on the first matching day after 30 days, which is every five weeks. Twenty-eight days gives you a scrub every fourth week on the same weekday. The dialog recommends running maintenance every 30 to 90 days, so 28, 35, 56 or 84 days all fit.

Stagger pools that share hardware. Because every pool on a schedule starts at once, putting four pools on one schedule means four concurrent scrubs. Where pools share an HBA, a JBOD or a controller, give each pool (or each small group) its own schedule on a different weekend or Start Day.

Keep TRIM apart from scrub. Run the TRIM schedule on a different day or week from the scrub so the two passes never overlap on the same flash devices.

Check the clock. Confirm each appliance's time zone matches where it's deployed before you rely on a Start Time. A schedule that's right on paper but wrong on the appliance clock still lands in the wrong window.

Setting it up

Open Storage Management → Schedules → Maintenance Schedule tab, then right-click and choose Create Maintenance Schedule. In Create Storage Pool Maintenance Schedule:

  1. Name the schedule after its type and slot, for example scrub-pool1-sun-2am.
  2. Choose Pool Scrub or Pool SSD TRIM as the maintenance type.
  3. Under Select a start day and time for maintenance, set Start Day and Start Time.
  4. Set Minimum Days Between Maintenance.
  5. Select the pools to associate with the schedule and click OK.
Under Storage Management with Schedules open, the Maintenance Schedule toolbar group holds Create, Modify, Delete and Add/Remove Pools, and existing schedules are listed on the Maintenance Schedules tab

To change which pools a schedule covers later, right-click the schedule and choose Update Maintenance List, which moves pools between the available and selected lists. See Storage Pool Scrub Schedule Update.

The same schedules can be created from the qs CLI, which is useful for applying a standard layout to many appliances. This pair scrubs pool1 every fourth Sunday at 2 AM and TRIMs it every fourth Saturday at 2 AM:

qs maintenance-schedule-create --name=scrub-pool1-sun-2am --maintenance-type=pool-scrub \
   --pool-list=pool1 --min-days-between-maint=28 --days=sun --hours=2am

qs maintenance-schedule-create --name=trim-pool1-sat-2am --maintenance-type=pool-trim \
   --pool-list=pool1 --min-days-between-maint=28 --days=sat --hours=2am

qs maintenance-schedule-list

Use maintenance-schedule-modify with --days and --hours to move an existing schedule, and maintenance-schedule-disable / maintenance-schedule-enable to pause one temporarily, for example during a data migration.

Operating and testing

Time a run before you trust the window. You can't plan a window without knowing how long a scrub takes on your pool. Right-click the schedule and choose Trigger Maintenance Schedule to start it immediately (Storage Pool Scrub Schedule Trigger), or run:

qs maintenance-schedule-trigger --maintenance-schedule=scrub-pool1-sun-2am

Trigger it at the same time of week the schedule will use, so background load is comparable, and watch disk throughput and latency in Performance Monitoring. Note when the task finishes in the task list. If the run doesn't fit inside the quiet period, move the Start Time earlier, split pools onto separate schedules, or accept a longer interval. Remember that a manual trigger becomes the schedule's last run, so the next scheduled run follows one full interval later.

Stop a scrub that overruns. If a scrub is still running when business hours start, right-click the pool and choose Stop Pool Scrub, then move the schedule's Start Time earlier or split its pools so the next run fits.

Verify schedules after every upgrade. When an appliance is upgraded (see Upgrade Manager), review each maintenance schedule before its next run:

  1. Run qs maintenance-schedule-get --maintenance-schedule=<name> or open the schedule with Modify Maintenance Schedule.
  2. Confirm that Start Day and Start Time show the slot you intended.
  3. If the hour isn't what you planned, select the correct Start Time and click OK to save the schedule again.

On current releases the Start Time you pick is the hour that's stored and shown, and editing other fields such as Start Day or the interval leaves it unchanged. Re-saving schedules that were created on older releases is a quick way to make sure every schedule holds its intended hour.

Keep a record. Keep a short table of each pool's scrub and TRIM slots next to your backup and replication schedule, so a new backup job isn't scheduled on top of a scrub.

FAQ

How often should a ZFS pool be scrubbed?

QuantaStor recommends running maintenance every 30 to 90 days, and the dialog accepts 3 to 90 days between runs. Monthly is a sound default for production pools: set 28 days so it lands on the same weekday every fourth week. Large archive pools whose scrubs take days can use 56 or 84 days.

Can scrub and TRIM run on the same schedule?

No. Each Maintenance Schedule has a single maintenance type, either Pool Scrub or Pool SSD TRIM. Create one schedule for each, and put them on different days so they don't overlap on the same flash devices.

Does triggering a schedule manually change when it runs next?

Yes. A manual trigger starts every pool on the schedule immediately and is recorded as the schedule's last run. The next automatic run happens on the first matching Start Day and Start Time after the minimum interval has passed from that trigger.

Do I need a scheduled TRIM if Auto-TRIM is enabled on the pool?

Auto-TRIM discards blocks continuously as they're freed, so you don't need a scheduled weekly SSD TRIM maintenance schedule setup if you have Auto-TRIM enabled. We have had issues with some vendor/models of SSDs with Auto-TRIM so if you have issues with continuous mode then switch to scheduled weekly or nightly TRIM.

Why did several scrubs start at the same time?

All pools on one Maintenance Schedule start together when it fires. If that's too much load for shared controllers or JBODs, split the pools across separate schedules with different Start Days or Start Times.


Part of the QuantaStor Guides series. For reference documentation, see the QuantaStor documentation.