Date: Tue, 19 Feb 2008 11:32:29 +0700 (ICT) From: Olivier Nicole <on@cs.ait.ac.th> To: kamikaze@bsdforen.de Cc: freebsd-questions@freebsd.org Subject: Re: Get the empty space on a file system Message-ID: <200802190432.m1J4WTgW080030@banyan.cs.ait.ac.th> In-Reply-To: <47B95F78.2060604@bsdforen.de> (message from Dominic Fandrey on Mon, 18 Feb 2008 11:35:36 %2B0100) References: <200802181025.m1IAPdHc060834@banyan.cs.ait.ac.th> <47B95F78.2060604@bsdforen.de>
next in thread | previous in thread | raw e-mail | index | archive | help
> > 2) knowing the file system from 1), how to check the remaining space > > in the file system? > > You normally just start writing and deal with the errors that come from full > file systems when they show up. The C functions set errno accordingly. > > The reason is that the system lies about the remainig space. Weather there > is any space left you may use, depends on the user you're running your > program as. It would be kinda stupid if your program didn't work because the > disk was full, even when you're running as root and are permitted to use the > remaining safety space (8% by default). In my case, I am writing log files, so I would start with removing older logs to make space for the newer ones. That is why I refer to know before hand how much space is available, to allow some cleaning, rather than waiting for a problem. It seems that statfs is the answer. Bests, Olivier
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802190432.m1J4WTgW080030>