How to optimize the cloning of a disk with a big empty ext3 partition?
tytso at mit.edu
Sat Jun 20 01:33:03 UTC 2009
On Fri, Jun 19, 2009 at 04:42:54PM -0700, Gregoire Gentil wrote:
> I need to duplicate a huge number of identical 8GB SD cards on which I
> have 1GB of data at the beginning of the disk on various partitions and
> then a 7GB ext3 partition which is rather empty (just a few MB of data).
> The duplicator device enables me to select which sectors I can
> binary-duplicate. I would love to divide by 8 my duplication time, by
> duplicating only the first GB and then the beginning of the 7GB ext3
> When I do a mkfs.ext3, I see that the super-block is written to various
> locations of the partition which is not good for the optimization I
> would like to do.
The metadata for ext3 is scattered across the disk; it's not just the
superblock, but it's also parts of the inode table, and bitmap
allocation blocks, which must be initialized.
It's possible to determine the list of blocks that need to be
initialized, but it's going to be a rather long list. If you need to
type the list of sectors into your duplicator, it's probably not
practical. If on the other hand you can feed it a file with a set of
sector numbers, you could extract that list of blocks in use from the
filesystem (which listed by dumpe2fs, although not in the most
convenient format), and convert it to sector numbers counting from the
beginning of the disk (as opposed to block numbers counting from the
beginning of the partitions), and then feed the whole long list of
sector block ranges to your duplicator device.
More information about the Ext3-users