From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 12 19:24:24 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A3C8106564A for ; Sat, 12 Feb 2011 19:24:24 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 59A488FC14 for ; Sat, 12 Feb 2011 19:24:24 +0000 (UTC) Received: by pvc22 with SMTP id 22so671297pvc.13 for ; Sat, 12 Feb 2011 11:24:23 -0800 (PST) Received: by 10.142.210.8 with SMTP id i8mr1511714wfg.438.1297537048334; Sat, 12 Feb 2011 10:57:28 -0800 (PST) Received: from [10.123.2.181] (99-74-169-43.lightspeed.sntcca.sbcglobal.net [99.74.169.43]) by mx.google.com with ESMTPS id w42sm1189724wfh.15.2011.02.12.10.57.26 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Feb 2011 10:57:27 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: <201102111909.p1BJ9UAE097045@fire.js.berklix.net> Date: Sat, 12 Feb 2011 10:57:23 -0800 Content-Transfer-Encoding: 7bit Message-Id: <66758C9D-DCE2-4381-A4B1-956A48423CDD@kientzle.com> References: <201102111909.p1BJ9UAE097045@fire.js.berklix.net> To: "Julian H. Stacey" X-Mailer: Apple Mail (2.1082) Cc: hackers@freebsd.org Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Feb 2011 19:24:24 -0000 On Feb 11, 2011, at 11:09 AM, Julian H. Stacey wrote: > memstick.img wastes 7% with 2K blocks of nulls. > shown by: > 8f -b 0 -n 2048 -l -f Fr* > http://berklix.com/~jhs/src/bsd/jhs/bin/public/8f/ 8f.c 8f.1 > > ... > The CD & DVD images are not nearly so wasteful, see above. > As near 1G ( 959467520 FreeBSD-8.2-RC3-i386-memstick.img ) it will > soon not fit on 1G sticks. There is a big difference between laying out a read-only filesystem and laying out a read-write disk image. CD/DVD writers do pack file contents one after the other on the image. The current UFS code is designed to leave enough "slack space" to support future file writes. The strategy used by libarchive's recent ISO writer is to concatenate the file bodies into a temp file (with minimal padding between entries to meet alignment requirements) while storing directory information in memory. The final output then consists of the directory information followed by the concatenated file bodies. I suspect a similar strategy could be used to lay out and write a read-only optimized UFS image. A few folks have asked about a UFS writer for libarchive; I think it's probably feasible but I doubt very much of the existing UFS code can be recycled for such a project. Alternatively, of course, is there any way to use isofs instead of ufs for memstick.img? Tim