By Brian Leonard on Sep 09, 2009
As I continued to experiment with my local repository mirror, I noticed downloads from the remote repository were running as quickly as from the local repository. Well, I was actually installing and uninstalling the same package to compare speeds and it turns out the files were not actually being downloaded from either repository, but rather copied from a local cache in /var/pkg/download.
You see, the first time you install a package, it is first copied from the repository to your /var/pkg/download folder and then installed from there. Over time, the size of this folder can grow pretty big. For example, mine was over 3 gigabytes:
bleonard@os200906:~$ du -hs /var/pkg/download/ 3.3G /var/pkg/download/
Note, because there's so many files, the du command takes several minutes to complete.
Fortunately, this cache can be disabled through a property setting. To see the image's current properties, run pkg property:
bleonard@os200906:~$ pkg property PROPERTY VALUE send-uuid True preferred-publisher opensolaris.org require-optional False flush-content-cache-on-success False display-copyrights True pursue-latest True
Setting the flush-content-cache-on-success property to true will delete your cache on the next successful IPS command:
bleonard@os200906:~$ pfexec pkg set-property flush-content-cache-on-success true bleonard@os200906:~$ pfexec pkg install SUNWgnome-hex-editor DOWNLOAD PKGS FILES XFER (MB) Completed 1/1 28/28 0.21/0.21 PHASE ACTIONS Install Phase 83/83 Deleting content cache
After which you will no longer even have a download directory in /var/pkg.
Note, if you're turning off the cache to save space (as I am), you'll also need to delete the cache from any other boot environments you may have. In those cases, assuming you are not actively using those boot environments, you can just delete the /var/pkg/download directory.