Re: Write disk image to multiple drives
- From: "Phil" <phillip.paradis@xxxxxxxxx>
- Date: 28 Feb 2006 18:49:28 -0800
Check out the "tee" command. It can write its stdin to multiple
output files as well as to stdout. (the output files can be
fifos, and this is the trick you need.)
Anyways, here in short how to do this (not tested):
$ for f in `seq 1 15`; do mkfifo fifo$f; cat fifo$f > cfcard-$f & done
$
$ zcat image.gz | tee fifo1 fifo2 ... fifo15 > cfcard-16
$
$ rm -f fifo1 fifo2 ... fifo15
Thanks for the info; I'd thought about this initially, but
unfortunately the images aren't simply gzip'd; they're in a format used
by Frisbee, which is intended to be used in a multicast-based network
disk imaging environment, and uses non-sequential writes to image the
disk.
I did find another solution, however. From reading the source to
dm-mirror (a painful exercise, given that I'm not a kernel programmer
and nowhere near fluent in C) and a few vague references on the web, I
figured out the table syntax. I'm using something similar to the
following (a bit more complex because I actually have to figure out
which slots have cards in them before starting, but this is the general
idea)
<code>
dmsetup create cfcards <<END
0 1000000 mirror core 1 2048 2 /dev/card1 0 /dev/card2 0
END
imageunzip /path/to/image /dev/mapper/cfcards
</code>
Now my major sticking point is to find some way of identifying the CF
slots; they're usb devices and the device nodes change every time
they're initialized.
I've been using the following udev rule
KERNEL="sd*", SYSFS{model}="USB Storage-CFC ", SYMLINK="cfcards/$k"
but this includes the partition devices as well. Know of a simple way
to
a. modify the udev rule to include the device itself but not match the
partition subdevices, or,
b. prevent the partition table from being scanned at all.
We have no need to actually read/write the partitions on the cards; the
contents are mostlty meaningless to a Linux system anyway. We just want
to slap in some cards, write the entire disk image and yank them out
when it's done. Solution B would be preferred, though solution A would
work if I can figure out how to stop hotplug from automatically
mounting the partitions when it sees them.
Thanks,
--
Phil
.
- Follow-Ups:
- Re: Write disk image to multiple drives
- From: Grant
- Re: Write disk image to multiple drives
- Prev by Date: Re: Random ip problem when login Debian via putty
- Next by Date: Re: Write disk image to multiple drives
- Previous by thread: Re: Random ip problem when login Debian via putty
- Next by thread: Re: Write disk image to multiple drives
- Index(es):
Relevant Pages
|