Skip to content

Commit bde57a0

Browse files
authored
Merge pull request #1818 from sriramandev/topic/ssriraman/optimize-vmdk-packing
Optimize vmdk packing by writing zeroes to unused bytes
2 parents e4b0b9b + f651ba8 commit bde57a0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Whiteout root
4+
count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}')
5+
count=$((count - 1))
6+
dd if=/dev/zero of=/tmp/whitespace bs=1M count=$count || echo "dd exit code $? is suppressed";
7+
rm /tmp/whitespace
8+
9+
# Whiteout /boot
10+
count=$(df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}')
11+
count=$((count - 1))
12+
dd if=/dev/zero of=/boot/whitespace bs=1M count=$count || echo "dd exit code $? is suppressed";
13+
rm /boot/whitespace

images/capi/packer/ova/packer-node.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,14 @@
426426
"type": "ansible",
427427
"user": "{{user `ssh_username`}}"
428428
},
429+
{
430+
"environment_vars": [
431+
"ENABLE_DISK_PACKING={{user `enable_disk_packing`}}"
432+
],
433+
"execute_command": "if [[ \"${ENABLE_DISK_PACKING}\" == *\"true\"* ]]; then chmod +x {{ .Path }}; sudo {{ .Path }}; fi",
434+
"script": "./packer/files/ova/scripts/optimize-disk.sh",
435+
"type": "shell"
436+
},
429437
{
430438
"arch": "{{user `goss_arch`}}",
431439
"download_path": "{{user `goss_download_path`}}",
@@ -492,6 +500,7 @@
492500
"datastore": "",
493501
"destroy": "false",
494502
"disk_size": "20480",
503+
"enable_disk_packing": "true",
495504
"existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}",
496505
"export_manifest": "none",
497506
"folder": "",

0 commit comments

Comments
 (0)