Backup Size

Dan Nelson dnelson at allantgroup.com
Mon Aug 10 16:25:55 UTC 2009


In the last episode (Aug 10), Jay Hall said:
> I am sure there is an easy explanation for this, but I cannot find it.
> 
> I am backing up my /etc directory using the following command.
> 
> tar -cvf - /etc | dd of=/dev/nsa1 obs=10240
> 
> When the command completes, I receive the following message.
> 
> 3080+0 records in
> 154+0 records out
> 1576960 bytes transferred in 0.179921 secs (8764740 bytes/sec)
> 
> What concerns me is when running du -h /etc, the size of the folder is
> reported as 1.7M.
> 
> Is the number of bytes written to the tape less than the reported size of
> the directory because of the way the files are written to the tape?  If
> so, how can the amount of space used be calculated?

du prints the number of disk blocks used by a directory tree.  Your
filesystem probably was formatted with 16k blocks and 2k fragment size; This
means that the minimum space du will report for each file is 2k.  Tar uses
512-byte blocks internally, so a directory with a lot of small files in it
(/etc for example) will take up less space as a tar file than on disk.
 
Try running "du -ha /etc", to see what du reports for each file under /etc.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list