Error 4138, There is not enough space on the disk - Solved
Recently I encountered a puzzling problem, which I was able to solve. I am posting this in case someone is having a similar problem.
I was doing a Full Backup.
The source volume had 300 GB of used space.
The target had 590 GB of free space.
The BU failed with error 4138, "There is not enough space on the disk."
I was using Intelligent Sector Backup.
I checked both the source and the target volume for hidden files -- there were none.
I scanned both volumes with chkdisk, no errors were found.
I also checked the Recycle Bin in both drives, to make sure they were empty.
I then installed WinDirStat and inspected the volumes, nothing unusual was found.
But when I used WinDirStat to inspect the target volume as the Full Backup was running I was very surprised to find that there was a large segment of the drive (which was not in the directory structure and therefore WinDirStat labeled "<Unknown>") that was bigger than the BU image file and growing in size at about the same rate. Of course, the total space taken by the image file plus the <Unknown> segment eventually caused the drive to become entirely full and the backup failed. At that point the image file was deleted and the <Unknown> segment released all the space it had used, so no trace of the problem was left.
I suspected that the problem was caused by the fact that I had NTFS compression enabled in the target volume. I disabled it (it took a long time because the existing files in the drive had to be decompressed), then rerun the Full Backup, without any problems. Apparently, NTFS compression is implemented by writing the uncompressed file to a temporary area in the drive, and in parallel compressing it to the final destination. This is probably to make sure that the application that is writing to the drive is not kept waiting for the compression to complete. This is fine as long as we are writing just a bunch of small or not too big files to the drive, but when Backupper attempts to write a 300 GB file it causes an error unless there is a lot of free space in the drive.
Thanks to Bernhard Seifert and Oliver Schneider for WinDirStat!