Upgrade when memory is low

I like to configure my machine with a separate partition for the OS. This kind of modularity makes it very easy to safely upgrade by entirely replacing the OS, rather than trying to patch on top of an existing install. Or to reinstall when I screw things up, which happens pretty regularly.

If the root partition is too large, I'm wasting space that I could put to more valuable uses. If it's too small, then the whole system becomes hard to work with. As of this writing, I've settled on about 16GB as being the correct size for the OS and all of the programs I use. But, in the past, I've tried to get by with as little as 8GB.

That means it's possible not to have sufficient space to download upgrades. Fortunately, there's a way around it.

  1. Acquire a flash drive.

  2. Plug it into the machine.

  3. Unmount it, e.g. sudo umount /dev/sda1

  4. Backup the contents of /var/cache/apt/archives somewhere:

    mkdir ~/bckp_archs
    sudo cp -pR /var/cache/apt/archives/* ~/bckp_archs
  5. Mount the flash drive:

    sudo mount /dev/sda1 /var/cache/apt/archives
  6. Copy the files you previously backed up:

    sudo cp -pR ~/bckp_archs/* /var/cache/apt/archives

You may now upgrade since the packages will download onto the flash drive and replace the previous versions in-place, which typically has a low memory footprint.