[Bug 299733] freebsd-update is slow on spinning hdd

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 22 Oct 2026 13:47:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299733

            Bug ID: 299733
           Summary: freebsd-update is slow on spinning hdd
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: titus@edc.ro

Created attachment 276107
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=276107&action=edit
fixes slowness of freebsd-update (mostly install)

freebsd-update is extremely slow on hdds in various phases but the install
phase only pushes 2-3 files per second and for thousands of files its very bad

the simple fix is to have a tmpfs scratch dir used to decompress the file
before installing it on the fs and then remove it instead on doing it in
/var/db/freebsd-update directly (/var/db/freebsd-update can't be on non
persistent storage)
from 14.5 on we can zcat ${HASH}.gz |install - 
but only 14.5 has an install capable of installing /dev/stdin

mostly the patch does this 
-                               gunzip < files/${HASH}.gz > ${HASH}
+                               gunzip < files/${HASH}.gz >
${SCRATCHDIR}${HASH}
                                install -o ${OWNER} -g ${GROUP}         \
-                                   -m ${PERM} ${HASH} ${BASEDIR}/${FPATH}
-                               rm ${HASH}
+                                   -m ${PERM} ${SCRATCHDIR}${HASH}
${BASEDIR}/${FPATH}
+                               rm ${SCRATCHDIR}${HASH}

if $SCRATCHDIR is for example /tmp/ which is tmpfs the speedup is 150x for 1000
files (2.7 sec vs 5min)

the attached patch has other improvements but they are not as significant

-- 
You are receiving this mail because:
You are the assignee for the bug.