Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2006 08:33:20 +1100
From:      Antony Mawer <fbsd-fs@mawer.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        freebsd-fs@freebsd.org, Ensel Sharon <user@dhp.com>
Subject:   Re: quota command and rsync snapshots...
Message-ID:  <455B87A0.6040604@mawer.org>
In-Reply-To: <20061115211401.GA68129@lor.one-eyed-alien.net>
References:  <Pine.LNX.4.21.0611151534140.21120-100000@shell.dhp.com> <20061115211401.GA68129@lor.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 16/11/2006 8:14 AM, Brooks Davis wrote:
> On Wed, Nov 15, 2006 at 03:39:56PM -0500, Ensel Sharon wrote:
>> So I have two questions:  given a directory that contains one current
>> backup and three snapshots (day.0 - day.4) what command can I run that
>> will show me the total _actual_ space used ?  du will not work because it
>> counts up each directory as if it used all of that space...
> 
> There isn't one that I know of.  Unless the volume is only used for this
> purposed (in which case df could be used) the only way to find this out
> would be to write a version of du that kept track of the inode of each
> hardlink and then didn't count it again.

du already does this - for instance, one of our backups snapshots:

$ du -h -d1 .
  73G    ./monthly
190M    ./2006-11-06_Mon
198M    ./2006-11-07_Tue
  14M    ./2006-11-08_Wed
  19M    ./2006-11-09_Thu
  11M    ./2006-11-10_Fri
9.6M    ./2006-11-11_Sat
9.6M    ./2006-11-12_Sun
  15M    ./2006-11-13_Mon
  12M    ./2006-11-14_Tue
  13M    ./2006-11-15_Wed
  73G    .

The 'monthly' folder here contains several snapshots (one per month), 
and then there's the daily snapshots.

This magic is all performed by linkchk() in /src/usr.bin/du/du.c.

--Antony



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?455B87A0.6040604>