Sophos UTM 9: Up2Date failed: Not enough free space

After somehow* losing the VHD for my Sophos UTM install on my home Hyper-V server I needed to reinstall and restore my config from backup. However, the only installation media I had downloaded was from when I initially moved from Tomato over to Sophos, which was several years ago.  This meant that the UTM needed to download over 3.5GB of updates in order to get back to a version which I could restore the config to. The root partition of the UTM is only 5GB, and the base install is about 3GB itself, so the updater craps out saying there's not enough space to unpack the updates.

After being given a list of the update packages that have successfully downloaded, this pops up in the Up2Date Messages logs:

 Up2Date failed: Not enough free space for '/var/up2date/sys'. Required space: * KB Available space: * KB; inodes: *  
   
 1. Modules::Logging::msg:46() /</sbin/audld.plx>Modules/Logging.pm  
  2. Modules::Audld::Download::Check::free_space:86() /</sbin/audld.plx>Modules/Audld/Download/Check.pm  
  3. Modules::Audld::Download::_download:213() /</sbin/audld.plx>Modules/Audld/Download.pm  
  4. Modules::Audld::Download::start:106() /</sbin/audld.plx>Modules/Audld/Download.pm  
  5. main::main:246() audld.pl  
  6. main::top-level:40() audld.pl  
 

After looking at various solutions, all of which looked like oodles of work, or if not oodles, at least a long boring process of manually doing a whole whack of nonsense, I decided to take the easy way out to get this batch of updates installed.

After enabling ssh access, I ssh'd in and su'd to root created a temporary directory on /var/storage which had ~25GB of space, mv'd the updates to that directory, symlinked /var/up2date/sys to /var/storage/up2date and chmoded the dir to have the same permissions as the original directory.  After linking the directories, I went back into the webGUI and asked it to update, and it did. Successfully. Without me spending ages manually applying 3 years of updates.

mkdir /var/storage/up2date  
chmod 700 /var/storage/up2date  
mv /var/up2date/sys/* /var/storage/up2date  
rmdir /var/up2date/sys  
ln -s /var/storage/up2date/ /var/up2date/sys

While I could've probably just downloaded a new ISO and reinstalled with that, I couldn't do that all remotely, and this is a relatively simple and straight forward workaround which is easy to revert once the need for the extra space is gone.

*By somehow I mean doing sysadmin stuff while trying to get out to see Propagandhi, and after a few drinks. Standard lab practice, I suppose.