Date: Fri, 27 Oct 2006 23:24:12 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: Jim Stapleton <stapleton.41@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: cleanly reading compressed backups Message-ID: <20061028042412.GE5213@dan.emsphone.com> In-Reply-To: <80f4f2b20610271946l1737159btd7bbd0329d25da61@mail.gmail.com> References: <80f4f2b20610271946l1737159btd7bbd0329d25da61@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061028042412.GE5213>