Index: /trunk/include/VBox/vd-ifs.h
===================================================================
--- /trunk/include/VBox/vd-ifs.h	(revision 79741)
+++ /trunk/include/VBox/vd-ifs.h	(revision 79742)
@@ -829,4 +829,17 @@
     DECLR3CALLBACKMEMBER(int, pfnQueryBytes, (void *pvUser, const char *pszName, void *ppvData, size_t cbData));
 
+    /**
+     * Set a named property to a specified string value, optionally creating if it doesn't exist.
+     *
+     * @return  VBox status code.
+     *          VERR_CFGM_VALUE_NOT_FOUND means that the key is not known and fCreate flag was not set.
+     * @param   pvUser          The opaque user data associated with this interface.
+     * @param   fCreate         Create property if it doesn't exist (if property exists, it is not an error)
+     * @param   pszName         Name of the key to query.
+     * @param   pszValue        String value to set the name property to.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnUpdate, (void *pvUser, bool fCreate,
+            const char *pszName, const char *pszValue));
+
 } VDINTERFACECONFIG, *PVDINTERFACECONFIG;
 
@@ -1112,4 +1125,40 @@
 }
 
+/**
+ * Set property value to string (optionally create if non-existent).
+ *
+ * @return  VBox status code.
+ * @param   pCfgIf      Pointer to configuration callback table.
+ * @param   fCreate     Create the property if it doesn't exist
+ * @param   pszName     Name of property
+ * @param   pszValue    String value to assign to property
+ */
+DECLINLINE(int) VDCFGUpdate(PVDINTERFACECONFIG pCfgIf, bool fCreate, const char *pszName, const char *pszValue)
+{
+    int rc = pCfgIf->pfnUpdate(pCfgIf->Core.pvUser, fCreate, pszName, pszValue);
+    return rc;
+}
+
+/**
+ * Set property value to Unsigned Int 64-bit (optionally create if non-existent).
+ *
+ * @return  VBox status code.
+ * @param   pCfgIf      Pointer to configuration callback table.
+ * @param   fCreate     Create the property if it doesn't exist
+ * @param   pszName     Name of property
+ * @param   pszValue    String value to assign to property
+ */
+
+DECLINLINE(int) VDCFGUpdateU64(PVDINTERFACECONFIG pCfgIf, bool fCreate, const char *pszName, uint64_t u64)
+{
+     char *pszValue;
+     RTStrAPrintf(&pszValue, "%ul", u64);
+     int rc = VDCFGUpdate(pCfgIf, fCreate, pszName, pszValue);
+     RTMemFree(pszValue);
+     return rc;
+}
+
+
+
 /** Forward declaration of a VD socket. */
 typedef struct VDSOCKETINT *VDSOCKET;
Index: /trunk/include/VBox/vd.h
===================================================================
--- /trunk/include/VBox/vd.h	(revision 79741)
+++ /trunk/include/VBox/vd.h	(revision 79742)
@@ -354,4 +354,7 @@
  * a good idea, as the average user won't understand it easily. */
 #define VD_CFGKEY_EXPERT            RT_BIT(1)
+/** Key only need at media creation, not to be retained in registry.
+ *  Should not be exposed in the GUI */
+#define VD_CFGKEY_CREATEONLY        RT_BIT(2)
 /** @}*/
 
Index: /trunk/src/VBox/Main/include/MediumImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MediumImpl.h	(revision 79741)
+++ /trunk/src/VBox/Main/include/MediumImpl.h	(revision 79742)
@@ -350,4 +350,7 @@
     static DECLCALLBACK(int) i_vdConfigQuerySize(void *pvUser, const char *pszName,
                                                  size_t *pcbValue);
+    static DECLCALLBACK(int) i_vdConfigUpdate(void *pvUser, bool fCreate,
+                                            const char *pszName, const char *pszValue);
+
     static DECLCALLBACK(int) i_vdConfigQuery(void *pvUser, const char *pszName,
                                              char *pszValue, size_t cchValue);
Index: /trunk/src/VBox/Main/src-server/MediumImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 79741)
+++ /trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 79742)
@@ -847,4 +847,5 @@
     m->vdIfConfig.pfnQuerySize = i_vdConfigQuerySize;
     m->vdIfConfig.pfnQuery = i_vdConfigQuery;
+    m->vdIfConfig.pfnUpdate = i_vdConfigUpdate;
     m->vdIfConfig.pfnQueryBytes = NULL;
 
@@ -4674,9 +4675,21 @@
             const Utf8Str &name = it->first;
             const Utf8Str &value = it->second;
-            /* do NOT store the plain InitiatorSecret */
-            if (   !fHaveInitiatorSecretEncrypted
-                || !name.equals("InitiatorSecret"))
-                data.properties[name] = value;
-        }
+            bool fCreateOnly = false;
+            for (MediumFormat::PropertyArray::const_iterator itf = m->formatObj->i_getProperties().begin();
+                 itf != m->formatObj->i_getProperties().end();
+                 ++itf)
+             {
+                if (itf->strName.equals(name) &&
+                    (itf->flags & VD_CFGKEY_CREATEONLY))
+                {
+                        fCreateOnly = true;
+                        break;
+                }
+            }
+            if (!fCreateOnly)
+                /* do NOT store the plain InitiatorSecret */
+                if (   !fHaveInitiatorSecretEncrypted
+                    || !name.equals("InitiatorSecret"))
+                            data.properties[name] = value;        }
     }
     if (fHaveInitiatorSecretEncrypted)
@@ -8018,4 +8031,22 @@
     memcpy(pszValue, psz, cch + 1);
     return VINF_SUCCESS;
+}
+
+DECLCALLBACK(int) Medium::i_vdConfigUpdate(void *pvUser,
+                                                bool fCreate,
+                                                const char *pszName,
+                                                const char *pszValue)
+{
+    int rv = VINF_SUCCESS;
+    Utf8Str pName = Utf8Str(pszName);
+    Medium *that = (Medium *)pvUser;
+    AutoWriteLock mlock(that COMMA_LOCKVAL_SRC_POS);
+    settings::StringsMap::const_iterator it = that->m->mapProperties.find(pName);
+    if (it == that->m->mapProperties.end() && !fCreate)
+        rv = VERR_CFGM_VALUE_NOT_FOUND;
+    else
+        that->m->mapProperties[pName] = Utf8Str(pszValue);
+    mlock.release();
+    return rv;
 }
 
Index: /trunk/src/VBox/Storage/VDI.cpp
===================================================================
--- /trunk/src/VBox/Storage/VDI.cpp	(revision 79741)
+++ /trunk/src/VBox/Storage/VDI.cpp	(revision 79742)
@@ -44,5 +44,5 @@
 static const VDCONFIGINFO vdiConfigInfo[] =
 {
-    { "AllocationBlockSize",            vdiAllocationBlockSize,           VDCFGVALUETYPE_INTEGER,      0 },
+    { "AllocationBlockSize",            vdiAllocationBlockSize,           VDCFGVALUETYPE_INTEGER,      VD_CFGKEY_CREATEONLY },
     { NULL,                             NULL,                             VDCFGVALUETYPE_INTEGER,      0 }
 };
@@ -541,5 +541,6 @@
     pImage->uShiftOffset2Index = getPowerOfTwo(getImageBlockSize(&pImage->Header));
     pImage->offStartBlockData  = getImageExtraBlockSize(&pImage->Header);
-    pImage->cbTotalBlockData   =   pImage->offStartBlockData
+    pImage->cbAllocationBlock  = getImageBlockSize(&pImage->Header);
+    pImage->cbTotalBlockData   = pImage->offStartBlockData
                                  + getImageBlockSize(&pImage->Header);
 }
@@ -706,5 +707,4 @@
     int rc = VINF_SUCCESS;
     uint32_t cbDataAlign = VDI_DATA_ALIGN;
-    uint32_t cbAllocationBlock = VDI_IMAGE_DEFAULT_BLOCK_SIZE;
     AssertPtr(pPCHSGeometry);
     AssertPtr(pLCHSGeometry);
@@ -723,5 +723,6 @@
     if (pImgCfg)
     {
-        rc = VDCFGQueryU32Def(pImgCfg, "AllocationBlockSize", &cbAllocationBlock, VDI_IMAGE_DEFAULT_BLOCK_SIZE);
+        rc = VDCFGQueryU32Def(pImgCfg, "AllocationBlockSize",
+                &pImage->cbAllocationBlock, VDI_IMAGE_DEFAULT_BLOCK_SIZE);
         if (RT_FAILURE(rc))
             rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS,
@@ -741,5 +742,6 @@
 
         rc = vdiSetupImageState(pImage, uImageFlags, pszComment, cbSize,
-                cbAllocationBlock, cbDataAlign, pPCHSGeometry, pLCHSGeometry);
+                pImage->cbAllocationBlock, cbDataAlign, pPCHSGeometry, pLCHSGeometry);
+
         if (RT_SUCCESS(rc))
         {
@@ -1013,4 +1015,14 @@
         pRegion->cbMetadata           = 0;
         pRegion->cRegionBlocksOrBytes = getImageDiskSize(&pImage->Header);
+        if (uOpenFlags & VD_OPEN_FLAGS_INFO)
+        {
+            PVDINTERFACECONFIG pImgCfg = VDIfConfigGet(pImage->pVDIfsImage);
+            if (pImgCfg)
+            {
+                rc = VDCFGUpdateU64(pImgCfg, true, "AllocationBlockSize", pImage->cbAllocationBlock);
+                if (RT_FAILURE(rc))
+                    return rc;
+            }
+        }
     }
     else
Index: /trunk/src/VBox/Storage/VDICore.h
===================================================================
--- /trunk/src/VBox/Storage/VDICore.h	(revision 79741)
+++ /trunk/src/VBox/Storage/VDICore.h	(revision 79742)
@@ -554,4 +554,6 @@
     /** Total size of image block (including the extra data). */
     unsigned                cbTotalBlockData;
+    /** Allocation Block Size */
+    unsigned                cbAllocationBlock;
     /** Container filename. (UTF-8) */
     const char             *pszFilename;
