From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 29 08:53:57 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2605637B404 for ; Tue, 29 Jul 2003 08:53:57 -0700 (PDT) Received: from ussenterprise.ufp.org (ussenterprise.ufp.org [208.185.30.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8E4343FAF for ; Tue, 29 Jul 2003 08:53:55 -0700 (PDT) (envelope-from bicknell@ussenterprise.ufp.org) Received: from ussenterprise.ufp.org (bicknell@localhost [127.0.0.1]) by ussenterprise.ufp.org (8.12.9/8.12.9) with ESMTP id h6TFrt8i089475 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 29 Jul 2003 11:53:55 -0400 (EDT) Received: (from bicknell@localhost) by ussenterprise.ufp.org (8.12.9/8.12.9/Submit) id h6TFrt3T089474 for freebsd-hackers@freebsd.org; Tue, 29 Jul 2003 11:53:55 -0400 (EDT) Date: Tue, 29 Jul 2003 11:53:55 -0400 From: Leo Bicknell To: freebsd-hackers@freebsd.org Message-ID: <20030729155355.GA89416@ussenterprise.ufp.org> Mail-Followup-To: freebsd-hackers@freebsd.org References: <200307291524.h6TFO3J06998@revolt.poohsticks.org> <20030729172615.N13255-100000@fw.office.icom> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH" Content-Disposition: inline In-Reply-To: <20030729172615.N13255-100000@fw.office.icom> Organization: United Federation of Planets X-PGP-Key: http://www.ufp.org/~bicknell/ Subject: Re: file size different from ls to du X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2003 15:53:57 -0000 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In a message written on Tue, Jul 29, 2003 at 05:27:14PM +0200, Bogdan TARU = wrote: > I have tried to create some files of myself, with 'spaces' in them > (holes?), but they don't act like this. So could you please explain what > 'sparse' means, and the 'trick' to create them? % cat sparse.c #include #include #include #include int main(void) { int fd; fd =3D open("sparse-file", O_RDWR|O_CREAT); lseek(fd, 1024*1024*1024, SEEK_SET); write(fd, "0123456789", 10); close(fd); } % cc -o sparse sparse.c % ./sparse % ls -lag sparse-file -r-xr----- 1 bicknell bicknell 1073741834 Jul 29 11:52 sparse-file* % du -k sparse-file 48 sparse-file --=20 Leo Bicknell - bicknell@ufp.org - CCIE 3440 PGP keys at http://www.ufp.org/~bicknell/ Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE/JpiTNh6mMG5yMTYRAhpsAJ425kMhVTb6tonzZteuQxjJcqKdhgCeKQUc 6oKFtptaWQABsU92FH5KVBk= =ng0F -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH--