From owner-freebsd-questions@FreeBSD.ORG Sat Oct 28 04:24:13 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5380D16A403 for ; Sat, 28 Oct 2006 04:24:13 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0760543D45 for ; Sat, 28 Oct 2006 04:24:12 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.8) id k9S4OCLq014826; Fri, 27 Oct 2006 23:24:12 -0500 (CDT) (envelope-from dan) Date: Fri, 27 Oct 2006 23:24:12 -0500 From: Dan Nelson To: Jim Stapleton Message-ID: <20061028042412.GE5213@dan.emsphone.com> References: <80f4f2b20610271946l1737159btd7bbd0329d25da61@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <80f4f2b20610271946l1737159btd7bbd0329d25da61@mail.gmail.com> X-OS: FreeBSD 6.2-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-questions@freebsd.org Subject: Re: cleanly reading compressed backups X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2006 04:24:13 -0000 In the last episode (Oct 27), Jim Stapleton said: > I have several disk images, and I'd like to grab files off of them, > but I'm not sure how. > > I made these images by booting up a linux boot CD (it seemed easier > than a BSD cd at the time, and the results should be the same), and > make a backup as such: > > dd if=/dev/sda | bzip2 -z9 | split [forgot the args, basically 1GB > files that are bsd-backup-(date)-??] > > anyway, without uncompressing them back to disk (it's the same > slice/partitions as I have now), what's the easiest way to get read > access to these contents of the files in these backups? It would be extremely difficult to allow access to arbitrary files from a backup made like that, without dd'ing the decompressed image to another disk. Theoretically a bzip2-compressed file can be randomly accessed because the dictionary is reset every 900k bytes of uncompressed data. You would need to write a geom module that prescanned the images to determine where the reset points were in the compressed file, then when read requests come in, decompress the 900k block containing the region of interest and return the requested block. You would then run mdconfig to create device nodes out of your split files, join them with geom_concat, let your geom_bzip2 module decompress the resulting joined device, and finally mount the decompressed device node. Accessing the resulting filesystem would be slow, but it would work (in theory). If you had booted a FreeBSD cd instead (disk 1 of the install CD set is a livecd) and run a "dump -af - /dev/da0 | bzip2 | split" pipe, you could have done easy restores with a "cat | bunzip2 | restore -ivf -" pipe. Dump's file format includes the file listing at the beginning, so restore can present you with a file listing first, let you pick the ones you want, then zip through the rest of the dump file sequentially to restore the files. -- Dan Nelson dnelson@allantgroup.com