TritonDataCenter / smartos-live

For more information, please see http://smartos.org/ For any questions that aren't answered there, please join the SmartOS discussion list: https://smartos.topicbox.com/groups/smartos-discuss
1.56k stars 244 forks source link

OS-8386 vmware vmdk number of blocks is wrong #1045

Closed bahamat closed 2 years ago

bahamat commented 2 years ago

It looks like what was originally done was assumed the img file was 2000000000.

I created a script to help out here. This is based on the make_vmdk script in sdc-headnode.

#!/bin/bash

g_image_bytes="${1:-516096}"

(( g_image_blocks = g_image_bytes / 512 ))
(( g_image_cylinders = g_image_blocks / (16 * 63) ))

printf 'Size is  : %d\n' "$g_image_bytes"
printf 'Blocks   : %d\n' "$g_image_blocks"
printf 'Cylinders: %d\n' "$g_image_cylinders"

Starting with 2000000000, this gives us the values that are currently in the vmdk file:

> ./sizecalc 2000000000
Size is  : 2000000000
Blocks   : 3906250
Cylinders: 3875

Using the actual size of the image, we get this instead:

> ./sizecalc 1940000256
Size is  : 1940000256
Blocks   : 3789063
Cylinders: 3758

So it looks like 3875 isn't a typo, it just started with a different value. But it does also mean that I should fix that value in the PR.