From owner-freebsd-questions@FreeBSD.ORG Wed Jan 16 21:21:23 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B1E25D22 for ; Wed, 16 Jan 2013 21:21:23 +0000 (UTC) (envelope-from fbsd8@a1poweruser.com) Received: from mail-03.name-services.com (mail-03.name-services.com [69.64.155.195]) by mx1.freebsd.org (Postfix) with ESMTP id 40888EB1 for ; Wed, 16 Jan 2013 21:21:20 +0000 (UTC) Received: from [10.0.10.3] ([173.88.197.103]) by mail-03.name-services.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 16 Jan 2013 13:20:19 -0800 Message-ID: <50F7197C.1060503@a1poweruser.com> Date: Wed, 16 Jan 2013 16:19:56 -0500 From: Fbsd8 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: FreeBSD questions Subject: understanding sparse files Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Jan 2013 21:20:20.0745 (UTC) FILETIME=[4A19AF90:01CDF42F] X-Sender: fbsd8@a1poweruser.com X-Authenticated-Sender: fbsd8@a1poweruser.com X-EchoSenderHash: [fbsd8]-[a1poweruser*com] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2013 21:21:23 -0000 I want to understand what is going on inside of sparse files. I have a test case set up. I have a small directory tree set up containing just the systems running libraries. The directory tree contains a copy of the following systems directories, /bin. /lib, /libexec, /sbin, and /usr which has a combined size of 195M. This directory tree is what gets copied into the sparse files I create. Now I create a sparse file with a allocated file size of 300M and copy that 195M directory tree into it. ls -lh shows 300M as the allocation size du -h shows 270M as the occupied size I would expect the occupied size to be 195M, the size of the source loaded into that sparse file. Now I reran the same test again changing only the allocation size to 1G. ls -lh shows 1G as the allocation size du -h shows 463M as the occupied size So my question is, why does the occupied size not match the real size of the data content in the sparse file? Also why as the allocated space increases does the occupied size increase?