Could not open a scratch file because the file is locked

adobe-photoshopssd

Photoshop CS6 gives me the following error:

Could not open a scratch file because the file is locked

my setup has 128gb ssd (C) which contains only my OS files with some junction points to Program Files/Program Files(x86)/ProgramData/Users which are located in my D drive which is a 1TB WD.

At first it showed when I tried to start PS for the first time after a clean install on a new computer I managed to get past it by running PS as admin and changing the scratch disk to D.

But now I noticed that when I try to copy a path from illustrator into Photoshop as either a smart object or as pixels I get this error again. I haven't seen it again other then that but I just started using PS in this setup so I am yet to explore all the functions and whether they are working correctly or not.

When ran as an administrator the illustrator->PS transfer works fine but I don't want to run PS as admin all the time.

Has anyone found a solution for this?
I already tried playing with the permissions but it didn't help.

Best Answer

TLDR; Launch Photoshop with CTRL + Alt held down to invoke Scratch Disk selector, or create a "hard link" (junction) to your SDD drive's TEMP directory

Much of these types of issues with Photoshop 13 (CS6) have to do with scratch disk location and writeability. It goes like this: Photoshop looks at your TEMP environment variable to determine where to put its scratch disk. In a vanilla install, this would be pointing to a location inside your %USERDATA% directory, which is at %SYSTEM_ROOT%\Users\YourUser etc. However, and this is where it gets weird, if it cannot find this TEMP directory, or if it resides on a disk OTHER than your boot disk, it abandons that idea and tries to create the scratch file in the root of the system boot disk.

This is where things get ugly, because in a typical Windows 7 installation, the root of the boot disk is locked for most users. This is a Good Thing, and has some security implications if disabled. Nevertheless, one solution that I have seen actually recommended by Adobe support has been to run Photoshop as an administrator. This can be done through the Properties of the Photoshop.exe file. Since I strongly disrecommend this I will not even post any further details about how that can be accomplished, though the steps are very simple.

ANother solution, and the one that was recommended to me by Adobe support seconds before I hung up the phone in disgust, was to open up the access privileges on the boot drive. This is unacceptable and we will speak no more on it.

A very simple option is simply to point your scratch disk space to your large data drive. If you can open up Photoshop, then go to Preferences > Performance and set you D:/ drive as your primary scratch drive. If you have just installed Photoshop, and it errors out on launch, so you can't even access the Preferences, remember that you can invoke the scratch disk chooser by simply holding down CTRL + Alt immediately after clicking the Photoshop icon to launch the application.

Note that while this solves the issue for Photoshop, if you're also running other Creative Suite 6 applications, you will still run into issues with the TEMP directory being relocated. A permanent solution is to manually create a TEMP directory somewhere on your data drive, and then create another junction (hard link) that fools the OS into thinking that the TEMP drive is in fact on your boot C:\ drive. When you do this, you also have to edit your computer's user and system environment variables to point to this new directory (you point them to the link location on your C:\ drive, not your data drive.)

Editing the environment variables is straightforward: type View Advanced System into your start menu search and choose the advanced system settings option in the search results. Click the Advanced tab and then the Environment Variable button. Now look for any occurrence of TEMP or TMP and type in the full path to the hard link you created on your C:\ drive.

For more detailed instructions, see my blog post.

Related Question