speedup(image): Use dd to write image
- Converting the image to raw first takes around 2 seconds in a ramdisk, but using dd to image the disk speeds up imaging almost 2x by allowing use of direct IO and blocksizes. - We may need, in the future, to be able to configure the options passed to dd based on the hardware we're imaging onto. These options have been confirmed as better than qemu-img on most hardware.
This commit is contained in:
parent
a82e1bffb1
commit
3b9dfcb43f
@ -27,8 +27,14 @@ DEVICE="$2"
|
||||
log "Erasing existing mbr from ${DEVICE}"
|
||||
dd if=/dev/zero of=$DEVICE bs=512 count=10
|
||||
|
||||
# Converts image to raw and writes to device
|
||||
log "Imaging $IMAGEFILE onto $DEVICE"
|
||||
qemu-img convert -O raw $IMAGEFILE $DEVICE
|
||||
## Doing two steps allows us to use dd, which allows us to tweak things like
|
||||
## blocksize and allows use of direct io
|
||||
# Converts image to raw
|
||||
log "Imaging $IMAGEFILE to RAW format"
|
||||
qemu-img convert -O raw $IMAGEFILE /tmp/image.raw
|
||||
|
||||
# Write image onto device
|
||||
log "Imaging $DEVICE"
|
||||
dd if=/tmp/image.raw of=$DEVICE bs=64K oflag=direct
|
||||
|
||||
log "${DEVICE} imaged successfully!"
|
||||
|
Loading…
Reference in New Issue
Block a user