RE: [iPAQ] Ramdisk

From: Erik Mouw <J.A.K.Mouw.a.t.its.tudelft.nl>
Date: Thu Aug 31 2000 - 16:36:42 EDT

On Thu, 31 Aug 2000 14:12:25 -0400, Jamey Hicks wrote:
> To extract an image of an ext2 filesystem, we can use dd from the block
> device
> dd if=specialfile of=imagefile
> e.g.,
> dd if=/dev/ram1 of=init-ramdisk-2-35

But remember to unmount it before you extract it, or it can be out-of-sync
(i.e.: the kernel hasn't flushed all data to disk yet). And of course the
"mounted" bit is set if it is still mounted, so the next time you mount it
on the iPaq you'll get a warning about dirty filesystems.

> Finally, we almost always compress the image before making copies of it, and
> we install the compressed filesystem image for the initial ramdisk, because
> the initrd driver knows how to recognize and unzip compressed filesystem
> images. We use the highest level of compression to minimize xmodem download
> times.
>
> gzip -9 init-ramdisk-2-35

A small note: if you did some work (copied, moved, deleted files), the
ramdisk will have some dirty blocks. Those blocks are not in use by the
ext2 file system, but they still have the original file contents, and
hence aren't that easy compressable as empty blocks (i.e. blocks only
containing zeros). To get a smaller compressed image, you can copy the
contents of the ramdisk to a clean ramdisk. Create a second ramdisk (or
loopback device) and mount it. Suppose we have the original ramdisk
mounted on /tmp/orig and the new one on /tmp/new, we just copy the
contents:

  cd /tmp/orig
  tar cf - . | ( cd /tmp/new ; tar xpf - )

Unmount the ramdisks, extract the new ramdisk, compress it, and you'll
have a smaller compressed image with exactly the same contents.

Erik

-- 
:q :q! :w :w! :wq :wq! :quit :quit! :help quit :helpquit :quit help
:quithelp :quit help! :Q :QUIT ^Q ^X^C ^C^C^C^C :QUITDAMMIT!!! ^[:wq
Received on Thu Aug 31 12:34:46 2000

This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:43:41 EDT