Re: size of /var/db/freebsd-update

From: Mike Clarke <jmc-freebsd2_at_milibyte.co.uk>
Date: Fri, 07 Jan 2022 11:01:56 UTC
On Thursday, 6 January 2022 13:40:04 GMT andrew clarke wrote:
> On 2022-01-06 11:23:01, Steve O'Hara-Smith (steve@sohara.org) wrote:
> > On Thu, 6 Jan 2022 21:37:03 +1100
> > 
> > andrew clarke <mail@ozzmosis.com> wrote:
> > > > with regards to size.
> > > 
> > > After a successful update it's safe to delete that directory entirely.
> > > 
> > > $ sudo rm -rf /var/db/freebsd-update/
> > > 
> > > The only minor hiccup is freebsd-update will fail now
> > 	
> > > that /var/db/freebsd-update/ no longer exists:
> > 	So instead just remove the contents viz:
> > sudo rm -rf /var/db/freebsd-update/*
> > 
> >                                   ^
> > 	
> > 	Just don't put a space here.
> 
> Combining wildcards with sudo is a bit dangerous, but either way this still
> won't work since non-root users ordinarily don't have read permission for
> the freebsd-update directory, so the wildcard can't be expanded.

This worked for me:

sudo sh -c 'rm -rf /var/db/freebsd-update/*'

Well, it almost worked. The directory size was originally about 1.6GB but after using the 
above command the 'empty' directory oddly still occupied 8.1MB:

curlew:/root# cd /var/db
curlew:/var/db# du -sh freebsd-update
8.1M    freebsd-updatecurlew:/var/db# ls -lR freebsd-update  
total 0

But completely deleting and recreating the directory resulted in a truly empty directory.

curlew:/var/db# rmdir freebsd-update
curlew:/var/db# mkdir freebsd-update
curlew:/var/db# chmod go= freebsd-update
curlew:/var/db# ls -ld freebsd-update 
drwx------  2 root  wheel  2  7 Jan 10:29 freebsd-update/curlew:/var/db# du -sh freebsd-
update         
512B    freebsd-update
-- 
Mike Clarke