IPS Cache

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.

Comments:

Nice work great article thank you for the post.

Posted by Sesli Chat on September 09, 2009 at 01:00 PM GMT #

IMHO it would be better to provide option that would allow limit the cache space, for example, to 1GB then only alowing it being ON or OFF.

We can of course create our own scripts for that 1GB setting, but going this way, we can create scripts for almost everything ... ;)

Posted by vermaden on September 10, 2009 at 09:40 AM GMT #

?

Posted by guest on October 01, 2009 at 05:57 AM GMT #

Is IPS cache setting persistent? It seems it was triggered back to false after the update to next release.

Posted by shmerl on November 04, 2009 at 09:57 AM GMT #

@shmerl, I've just verified the same so I filed http://defect.opensolaris.org/bz/show_bug.cgi?id=12663

Posted by Brian Leonard on November 13, 2009 at 10:26 AM GMT #

A question for you -- would it be safe to NFS mount the global zone's /var/pkg/download from my non-global zones, so they can sll share the same download cache? I've got dedup turned on so it's not going to save me any disk, but it'd be nice to only do downloads once ;)

Posted by Sam C on February 09, 2010 at 09:36 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today