Skip to content

Commit e53e297

Browse files
author
Mathieu Mitchell
committed
Write image directly to disk
Write image directly to disk by telling qemu-img that the output file is the disk. Still uses O_DIRECT directly within qemu-img. This avoids the need to have a huge amount of system memory to be able to deploy an image that contains a huge disk. The only feature left behind by that commit is the 64K block size. Change-Id: If60bcd82581b2ea76c4acbc3eaa3f317d2ee6590
1 parent 082cf29 commit e53e297

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ironic_python_agent/shell/write_image.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,8 @@ DEVICE="$2"
3838
log "Erasing existing mbr from ${DEVICE}"
3939
dd if=/dev/zero of=$DEVICE bs=512 count=10
4040

41-
## Doing two steps allows us to use dd, which allows us to tweak things like
42-
## blocksize and allows use of direct io
43-
# Converts image to raw
44-
log "Converting $IMAGEFILE to RAW format"
45-
qemu-img convert -O raw $IMAGEFILE /tmp/image.raw
46-
47-
# Write image onto device
48-
log "Imaging $DEVICE"
49-
dd if=/tmp/image.raw of=$DEVICE bs=64K oflag=direct
41+
log "Imaging $IMAGEFILE to $DEVICE"
42+
qemu-img convert -t directsync -O raw $IMAGEFILE $DEVICE
43+
sync
5044

5145
log "${DEVICE} imaged successfully!"

0 commit comments

Comments
 (0)