Speed up initial /rw setup
On first VM's boot, setup-rwdev.sh script create filesystem on /dev/xvdb. But it does so only after checking if /dev/xvdb is really empty, by comparing it to /dev/zero. Speed up reads from /dev/zero bu using larger blocks (default of head - 8k, instead of explicit 512). This speed up the check over 5 times.
This commit is contained in:
parent
ddbd24a815
commit
1781568d08
@ -9,7 +9,7 @@ if [ -e "$dev" ] ; then
|
||||
|
||||
# check if private.img (xvdb) is empty - all zeros
|
||||
private_size_512=$(blockdev --getsz "$dev")
|
||||
if dd if=/dev/zero bs=512 count="$private_size_512" 2>/dev/null | diff "$dev" - >/dev/null; then
|
||||
if head -c $(( private_size_512 * 512 )) /dev/zero | diff "$dev" - >/dev/null; then
|
||||
# the device is empty, create filesystem
|
||||
echo "Virgin boot of the VM: creating private.img filesystem on $dev" >&2
|
||||
if ! content=$(mkfs.ext4 -m 0 -q "$dev" 2>&1) ; then
|
||||
|
Loading…
Reference in New Issue
Block a user