Resolving “File or Directory is Corrupted” Error in 64-bit TortoiseSVN on Windows 7 with CHKDSK Trigger


2 views

When working with 64-bit TortoiseSVN on Windows 7 Professional, some developers encounter this specific error sequence:

Error: Can't move 
Error: '[...]\\.svn\\tmp\\entries' 
Error: to 
Error: '[...]\\.svn\\entries': 
Error: The file or directory is corrupted and unreadable.

This typically occurs during checkout or update operations, often followed by an unexpected CHKDSK execution after reboot.

After investigating multiple cases, I've identified three primary culprits:

  • File system inconsistencies: Windows 7's delayed write operations sometimes conflict with SVN's atomic file operations
  • Permission inheritance issues: The .svn/tmp directory might lose proper permissions during operations
  • Antivirus interference: Real-time scanning locking files during SVN operations

Here are proven solutions ordered by effectiveness:

1. Repair the Working Copy

First try repairing the working copy without losing changes:

svn cleanup --remove-ignored
svn upgrade

2. Filesystem Check and Repair

Manually run these commands in elevated cmd:

chkdsk /f /r C:
fsutil dirty query C:

3. Configure TortoiseSVN for Atomic Operations

Modify your SVN config file (~/.subversion/config):

[miscellany]
use-commit-times = yes
enable-auto-props = no

[working-copy]
sqlite-exclusive = yes

For persistent cases, enable detailed logging:

set SVN_DEBUG_WINDOWS_HANDLES=1
tortoiseproc /command:update /path:"C:\your\wc" /log

This creates a detailed log file at %APPDATA%\TortoiseSVN\log.txt showing file handle operations.

  • Schedule regular disk checks: schtasks /create /sc weekly /tn "SVN Disk Check" /tr "chkdsk /f C:"
  • Add SVN directories to antivirus exclusions
  • Consider migrating to newer SVN 1.14+ which has better Windows 7 compatibility

If the issue persists, consider these architectural changes:

# Use sparse checkouts for large repos
svn checkout --depth=immediates http://svn.example.com/repo/trunk

# Or switch to git-svn bridge
git svn clone http://svn.example.com/repo -T trunk -b branches -t tags

When working with TortoiseSVN 64-bit on Windows 7 Professional, some users encounter a particularly nasty error during checkouts or updates:

Error: Can't move 
Error: '[...]\\.svn\\tmp\\entries' 
Error: to 
Error: '[...]\\.svn\\entries': 
Error: The file or directory is corrupted and unreadable.

This error typically forces a CHKDSK scan on the next reboot, which indicates deeper filesystem issues.

Several factors can contribute to this issue:

  • Filesystem corruption: NTFS metadata issues affecting the .svn directories
  • Antivirus interference: Real-time scanning locking SVN working files
  • Disk errors: Physical disk problems manifesting as corruption
  • Permission problems: Inadequate access rights to modify .svn files

To diagnose, first run these commands in an elevated command prompt:

fsutil dirty query C:
chkdsk C: /scan

When the error occurs, try these steps before resorting to CHKDSK:

svn cleanup --vacuum-pristines
svn upgrade WORKING_COPY_PATH

For persistent cases, create a batch script to reset SVN metadata:

@echo off
set SVN_WC=%1
if "%SVN_WC%"=="" (
    echo Usage: %0 PATH_TO_WORKING_COPY
    exit /b 1
)

del /q /f /s "%SVN_WC%\.svn\wc.db"
svn cleanup "%SVN_WC%"
svn upgrade "%SVN_WC%"

To avoid future occurrences:

  1. Add SVN working directories to your antivirus exclusion list
  2. Schedule regular disk maintenance:
schtasks /create /tn "WeeklyDiskCheck" /tr "chkdsk C: /f /x" /sc weekly /d SUN

Consider migrating to newer version control systems if possible:

git svn clone http://svn-repo/path/ --stdlayout --prefix=svn/ project

If you must run CHKDSK, do it properly:

chkdsk C: /f /r /x

For automated repair of multiple drives:

@echo off
for %%d in (C D E) do (
    if exist %%d:\ (
        echo Checking drive %%d
        chkdsk %%d: /f /x
    )
)