Fix it now
3202 is a write to the backup device failing part way through, and the operating system error in brackets says which kind. Out of space is much the most common. 3271 is more serious: a nonrecoverable I/O error, where the device did not refuse the write but failed it. Either way the file left behind is partial and must not be appended to.
SELECT TOP 5 database_name, backup_size, compressed_backup_size, backup_finish_date
FROM msdb.dbo.backupset
WHERE database_name = N'MyDb'
ORDER BY backup_finish_date DESC;
- Read the operating system error number in the message. A disk space error means the volume filled; anything else points at the device or the path.
- Check free space on the backup volume on the server, not on your workstation.
- Delete or move the partial file. Do not append to it, and do not leave it as the target for tonight’s run.
- Re-run to a target with room, using compression if your edition supports it:
BACKUP DATABASE [MyDb] TO DISK = N'D:\SQLBackup\MyDb.bak' WITH INIT, COMPRESSION, CHECKSUM; - If the error was 3271 and space was never short, read the Windows System event log for disk or network errors at that timestamp before trusting the device again.
Backup compression is available in Enterprise and Standard editions in SQL Server 2019, 2022 and 2025. It is not available in Express or Web, so on a free edition the COMPRESSION option is not a route out of this.
If the backup completes and verifies you are done. If it keeps failing at the same point, the next section explains what the stream is doing and which failure you have.
Why it happens
A backup is a stream. The engine reads pages and writes them to the media in order, and the file grows as it goes. Nothing checks in advance that the destination is large enough, so a database that grew since last month will fill the volume at three in the morning and stop there. That is the ordinary 3202, whose published text is simply “Write on … failed” followed by the operating system’s own explanation.
3271 is a different statement: a nonrecoverable I/O error occurred on the file or device. That is what a dropped network share, a failing disk, a deduplication appliance that timed out, or an odd presentation of a full volume all look like from inside the engine. 3203 is its counterpart on a read, which you meet when the media has to be read back, for example while appending to an existing set or verifying one.
Whatever the cause, the file on disk is now truncated in the middle of a backup set, and 3266 is the code that arrives later to tell you so. Its message is unusually generous and worth following exactly: use RESTORE HEADERONLY to determine the backup sets on the media, use RESTORE VERIFYONLY to determine whether they are usable, and only if all the backup sets are incomplete reformat the media using BACKUP WITH FORMAT, which destroys all the backup sets. That last clause is the reason not to reach for it casually.
The backup volume ran out of space
You have this one if The bracketed operating system error refers to disk space, and the partial file is roughly the size of the free space that was available.
- Remove old backup files that are already copied off the server, or move them to the archive target.
- Turn on backup compression if the edition supports it. Compare backup_size with compressed_backup_size in msdb to see what it buys you here.
- Stripe large backups across several volumes:
TO DISK = N'D:\bk\MyDb_1.bak', DISK = N'E:\bk\MyDb_2.bak' - Add a differential schedule between fulls so you are not writing the whole database every night.
Retention is the usual culprit. Work out how many days of full, differential and log backups the volume can hold, and enforce it with a cleanup task rather than by hand.
The device or path failed during the write
You have this one if 3271, no space problem, and the System event log shows disk, multipath or SMB entries at the same time.
- Check Event Viewer, Windows Logs, System for disk or network events at that timestamp.
- Back up to local disk first and copy the file afterwards. It takes the network out of the critical path and is usually faster.
- If the target is a deduplication or virtual tape appliance, ask the vendor about supported settings for SQL Server streams.
- Re-run WITH CHECKSUM so damage is detected during the backup rather than during a restore you cannot afford to fail.
You are appending to a media set that is already damaged
You have this one if 3203 or 3266 appears, and the target file has been reused night after night with NOINIT or by default.
- Run
RESTORE HEADERONLY FROM DISK = N'D:\SQLBackup\MyDb.bak';to see what sets the file still holds. - Run
RESTORE VERIFYONLY FROM DISK = N'D:\SQLBackup\MyDb.bak' WITH CHECKSUM;to see whether any of them are usable. - Stop appending. Write to a new file name per run, or overwrite explicitly with
WITH INIT. - Move the suspect file aside and keep it until you have a known-good backup to replace it.
BACKUP WITH FORMAT is the last option in the 3266 message for a reason: it destroys every backup set on the media. Only use it once you have established that all of them are already incomplete.
Another process is interfering with the file
You have this one if Failures are intermittent and correlate with an antivirus scan window or a file-level backup agent run.
- Exclude backup folders and the .bak and .trn extensions from real-time scanning on the database server.
- Check whether a file-level agent is reading the file while SQL Server is still writing it, and reschedule so they do not overlap.
- Move any storage snapshot on the same volume away from the backup window.
Full reference
Narrowing it down
| What you see | Where the fault is |
|---|---|
| A disk space operating system error with 3202 | The volume filled during the write |
| 3271 with no space error, on a network target | The share, the network path or the appliance behind it |
| Failure at roughly the same size every night | A quota, a file size limit on the target, or a volume that is always this full |
| 3203 when appending to an existing file | The existing media set could not be read back. Start a new file |
| 3266 on a later restore or append | The tail of that file was written by an interrupted backup |
Sizing the target from evidence rather than estimate
msdb records what every previous backup actually took, which is a better basis than arithmetic on the data file size. Two columns matter: backup_size is the uncompressed size of the backup set, and compressed_backup_size is the total byte count stored on disk. The ratio between them on this database, at this compression setting, is what you should be planning against.
SELECT bs.database_name,
bs.type,
bs.backup_finish_date,
bs.backup_size / 1048576.0 AS backup_mb,
bs.compressed_backup_size / 1048576.0 AS on_disk_mb,
bmf.physical_device_name
FROM msdb.dbo.backupset AS bs
JOIN msdb.dbo.backupmediafamily AS bmf
ON bmf.media_set_id = bs.media_set_id
WHERE bs.database_name = N'MyDb'
ORDER BY bs.backup_finish_date DESC;
The type column tells you what each row was: D is a database backup, I a differential database backup, L a log backup, F a file or filegroup backup, G a differential file backup, P a partial and Q a differential partial. A retention plan built without separating those is a retention plan that surprises somebody.
How much headroom to keep
- Enough for your retention plus one extra full backup, so a run that starts while yesterday’s file is still present does not fill the volume.
- Measure it from backup_size and compressed_backup_size in msdb rather than estimating from the data file.
- Account for growth. A volume sized exactly for today fails on the first month the database grows.
- Keep log backups on the same footing. A long-running transaction can produce a log backup far larger than the usual one.
- If the target is deduplicated, do not assume the appliance’s saving applies to your headroom calculation. Size for what SQL Server writes.
Recovering from a partial file, in the order the message gives
RESTORE HEADERONLY FROM DISK = N'...';lists the backup sets the media still holds, with their positions.RESTORE VERIFYONLY FROM DISK = N'...' WITH CHECKSUM;tells you whether a given set is usable.- If some sets are good, restore from one of them with
WITH FILE = <position>. - If every set is incomplete, and only then,
BACKUP DATABASE ... WITH FORMATreformats the media. This destroys all backup sets on it. - Whatever you do, take a fresh full backup to a clean file afterwards and verify it before you rely on it.
Practices that stop this becoming an incident
- Write to a new file name per run. A single file holding many backup sets is a single point of failure, and one interrupted write can make every set in it unreadable.
- Back up WITH CHECKSUM, so damage is detected at backup time.
- Schedule RESTORE VERIFYONLY as a step after the backup, not as an occasional manual check.
- Back up to local disk and copy afterwards where the network is the weak link.
- Alert on the 3041 summary line in the error log rather than on the job’s own success flag.
When a licence is the actual fix
The fix here is disk space, and disk space is not a licensing question. Where an edition does become the constraint is backup compression: it is available in Enterprise and Standard in SQL Server 2019, 2022 and 2025, and not in Express or Web. A growing database on Express therefore hits this error sooner and has fewer ways out, and Express has other ceilings that arrive at the same time – in SQL Server 2025 the maximum relational database size is 50 GB, compute is limited to the lesser of one socket or four cores, and the buffer pool is capped at 1,410 MB. If that is your situation, Arco supplies SQL Server 2025 Standard in two-core packs and can work out how many packs your server needs. Free the disk first; only look at a licence if the edition limits, not the volume, are what is stopping you.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
3202 |
Write on the named device failed, followed by the operating system’s own error text | Microsoft Learn |
3203 |
Read on the named device failed. Seen when an existing media set has to be read back | Microsoft Learn |
3271 |
A nonrecoverable I/O error occurred on the named file or device | Microsoft Learn |
3266 |
The backup data at the end of the file is incorrectly formatted; backup sets on the media might be damaged and unusable. The message names RESTORE HEADERONLY, RESTORE VERIFYONLY and, as a last resort, BACKUP WITH FORMAT | Microsoft Learn |
Confirm the fix worked
- Re-run the backup and confirm it completes and reports the pages processed.
- Confirm a new row in
msdb.dbo.backupsetwith a plausible backup_size for the database. - Run
RESTORE VERIFYONLY FROM DISK = N'<your path>' WITH CHECKSUM;and confirm the set is valid. - Check free space on the backup volume after the run and confirm there is room for another full backup.
- Confirm the error log carries no 3041 summary line for that attempt.
Questions people ask about this
Will a licence or a higher edition give me more space?
No, and nobody should sell it to you on that basis. Disk is disk. A higher edition can reduce how much space you need through backup compression, but the first move is always to free space or point the backup somewhere larger.
Which editions have backup compression?
Enterprise and Standard, in SQL Server 2019, 2022 and 2025. Web and Express do not. If you are on Express, COMPRESSION is not an option and the answer has to be disk, retention or a smaller database.
Is backup compression safe to leave on?
For most workloads yes. It trades processor time for a smaller file and a shorter window. On a server already processor-bound during the backup window, test it before making it the default.
Can I keep using the file that failed?
Treat it as unusable. RESTORE HEADERONLY and RESTORE VERIFYONLY will tell you whether any earlier set in it can still be read, but recovering a production system from damaged media is not a plan. Take a fresh backup to a clean file and verify it.
What does BACKUP WITH FORMAT do?
It reformats the media, and Microsoft’s own 3266 message says it destroys all the backup sets on it. It is the last option in that message, for the case where every set is already incomplete. It is not a repair.
