PVA – Archives

Sưu tầm những bài viết hay trên internet…

How to change the cache folder of chrome

From: http://blog.essayweb.net/2009/11/07/changing-the-cache-location-in-chrome/


Update 6/11/2010: You can save your bookmarks, extensions, theme, and browser preferences to your Google Account so that they can be accessed across multiple computers. Read more: http://www.google.com/support/chrome/bin/answer.py?hl=en&answer=165139


Why would you want to do this?

Because you’re using Windows. Because file fragmentation is a problem with every version of Windows, and it inexorably slows down your computer the longer you use it. Because browser caches are some of the highest file activity regions on your disk, which means they make the disk fragment very quickly. You don’t want your operating system or programs disks to be fragmented that fast, do you? So you make a separate scratch disk, just a tiny one, and place all browser caches and other fast changing files there.

Except that unlike Firefox or Internet Explorer, Chrome doesn’t let you choose the browser cache size or location. Instead, it dumps it right on your OS disk, which is about the worst place to have a browser cache.

Here’s how you can change the location of Chrome’s cache, despite the laziness of the programmers. What you do is manually create a directory for the cache on a disk of your choice. Then you set up a symbolic link from the default Chrome cache location to this new directory you’ve created. Chrome still thinks it’s dumping files in its default location, but the files are really going to a different disk.

Step by Step Instructions (Vista and Windows 7)

1. Shut down Chrome if it’s open. Now open Task Manager and look under the Processes tab to make sure there is no Chrome process running. This is necessary because even after shutting down the browser, the process often continues to run for a while to do housekeeping tasks. If it’s running, it will have locked the files you need to move, so the process won’t work. Make absolutely sure it’s not running.

2. Next, open Windows Explorer, navigate to where you want the cache to go, and make a directory there for the Chrome cache. In my case, I made a directory called “Chrome Cache and Profile” on drive S, as shown in the picture below.

Chrome Cache Directory
3. Next, navigate to where Chrome stores its user profile. This will usually be:

C:\Users\{username}\AppData\Local\Google\Chrome\User Data

Move the entire “User Data” directory to the other drive, and make it a subdirectory of the new directory you just created in the previous step. So in my case, I moved it from the default location listed above to S:\Chrome Cache and Profile\User Data.

4. Now open an elevated command prompt. This means that you right-click on the command prompt icon in the Start Menu, and choose “Run as Administrator”. In the command prompt window, enter the command:

mklink /J “C:\Users\{username}\AppData\Local\Google\Chrome\User Data” “S:\Chrome Cache and Profile\User Data”

Make sure you replace {username} with your own username, and change the directories as appropriate in your case. The quotes around the directory names are necessary, so leave them there.

That’s it. You’ve created a symbolic link from the default location to the new location of the User Data directory. Because you used the “/J” switch, Windows created what’s called a “junction”, which Chrome can’t see, so it continues to think that the directory hasn’t been moved, and proceeds as usual.

Note that if you did exactly like I described above, you’ve not only moved the Chrome cache, but the entire User Data directory, which also contains stuff like cookies, bookmarks, etc. If you don’t want to move the rest of this stuff over, dig deeper into the User Data subdirectory, and locate the cache subdirectory, which will be:

… User Data\Default\Cache

In that case, you could just make the symbolic link at that directory level, rather than at the User Data level. It’s up to you.

If you’re using Windows XP or Windows 2000

Windows XP and Windows 2K have the ability to make symbolic links but don’t come with a command line tool to make them. So if you’re using either of these two operating systems, you’ll need to download a tool to make them. Microsoft Technet offers Junction, which is a tiny utility that lets you add symbolic links in either XP or 2000.

The command would be:

junction C:\path-to-directory\User Data “S:\path-to-directory\User Data”

Make sure you fill in the proper paths to the source and linked directories, and also note that the second set of quotes is required.

Other Methods

Some people use a different method for changing the cache location, which is to start Chrome with an argument pointing to a separate directory. For example, if you wanted the cache to be located in S:\junk, you could make a shortcut to start Chrome with the command line:

C:\path-to-chrome-executable\chrome-exe –user-data-dir=s:\junk

This would work, but there are problems because a browser isn’t always started from a shortcut. Many other applications often invoke the default browser to display HTML stuff. So if Chrome is started by some other application, or in any way other than through your shortcut, it will still dump files in the default location and not in your junk directory. For this reason, I prefer the symbolic link method.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: