Stash your cache

Here’s the deal: I reinstall once, sometimes twice or even three times a week. Why? Well, that’s beside the point. Sometimes I break something, but sometimes I just feel like it. Never mind that. What I want to suggest is that, if you’re like me, you can save yourself a little bandwidth and a lot of time downloading if you take the time to copy your apt cache before you erase your drive.

Aptitude (and apt-get and some of those funky little utilities) keep all the packages they downloaded in /var/cache/apt/archives. So the next time you install something chunky, like xorg for example, don’t clean it out with aptitude clean. Instead, copy those files to another location — like a second hard drive or a leftover 128Mb USB drive … you know, the one with the case that snapped so you pried it apart to look at the guts, and it still works but you never use it because it’s somehow not trustworthy without the case.

Then, the next time you install, dump the contents of that USB drive back into /var/cache/apt/archives. Aptitude (or apt-get and some of those funky little utilities) won’t know the difference between those files and the ones that you’re asking it to install, unless there’s a newer version in the repositories, in which case it’s going to download it anyway.

You’re saving yourself something like 40-120Mb — and an hour’s wait — each time you reinstall, depending on what you download and what your connection speeds are. For my own part, I keep a folder of about 140Mb on a modular hard drive, and that serves as my jumpstart archive, so I don’t have to keep downloading and redownloading the same old packages over and over again.

For the terminally uninclined, copy out your cache folder any time you download a big package with this:

cp /var/cache/apt/archives/*.deb /media/usbdisk/

or whatever the name of your destination drive is. To copy it back, use this:

sudo cp /media/usbdisk/*.deb /var/cache/apt/archives/

And remember that you need sudo with the second command, since it’s headed for a directory outside your home.

About these ads

5 Responses to “Stash your cache”


  1. 1 Isaac Geronimo 2007/04/28 at 12:23 AM

    This is a good tip! I’ve been meaning to set up a server to be used as an “I just can’t walk all the way upstairs to my room” machine, as well as print server and, yes, an apt-cache. We’ve got four (sometimes five?) Ubuntu 6.06 PCs running, and I’m thinking that the cache should save a lot of time and bandwidth, especially for the routine system updates.

    The only problem is that I sort of want to update my PC to Ubuntu 7.04, which would make the apt-cache ever so slightly less beneficial. We’ll see.

  2. 3 K.Mandla 2008/01/01 at 9:24 PM

    Mostly because, last time I checked, APTonCD needed a lot of Gnome dependencies to run, and that’s a turnoff to me. It’s possible that has changed since I last looked.

  3. 4 evidex 2010/03/11 at 6:13 AM

    I know this is a really old post, but Apt-Cacher-NG is a great proxy for Apt Packages.


  1. 1 Howto: Accelerate Ubuntu upgrades with an ISO « Motho ke motho ka botho Trackback on 2007/12/29 at 3:23 PM

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




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,963,317 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: