wiki:custom_the_vmware_disk
The minimal size of the vmware disk is 100mb. In some cases, the size is too big, maybe we need a smaller disk.
First, using vmware-vdiskmanager to get the template of the vmware disk descriptor file.
vmware-vdiskmanager.exe -c -s 100mb -a ide -t 2 100mb.vmdk
100mb.vmdk
# Disk DescriptorFile version=1 CID=ef8424cf parentCID=ffffffff createType="monolithicFlat" # Extent description RW 204800 FLAT "100mb-flat.vmdk" 0
The total size is 204800 sectors, 102400KB. Disk type is FLAT, preallocated, its name is 100mb-flat.vmdk.
# The Disk Data Base #DDB ddb.virtualHWVersion = "6" ddb.geometry.cylinders = "203" ddb.geometry.heads = "16" ddb.geometry.sectors = "63" ddb.adapterType = "ide"
The CHS is 203/16/63, adapter is IDE.
Now, modify the descriptor file, change the size to 65536
RW 65536 FLAT "32mb-flat.vmdk" 0
change the CHS
ddb.geometry.cylinders = "64" ddb.geometry.heads = "16" ddb.geometry.sectors = "63"
The last job is creating the file '32mb-flat.vmdk' by 'dd'
dd if=/dev/zero of=32mb-flat.vmdk bs=1m count=32
or by this program
#include <stdio.h> #include <stdlib.h> #include <string.h> #define M (1024*1024) int main(int argc, char* argv[]) { int size; char *buf; FILE *fp; int i; if (argc == 3) size = atoi(argv[2]); else size = 10; buf = (char *)malloc(M); if (!buf) { printf("out of memory\n"); return -1; } memset(buf, 0, M); fp = fopen(argv[1], "wb"); if (!fp) { printf("Can't create: %s\n", argv[1]); free(buf); return -1; } for (i = 0; i < size; i++) fwrite(buf, M, 1, fp); fclose(fp); free(buf); return 0; }
Finished!
wiki/custom_the_vmware_disk.txt · Last modified: 2008/08/15 03:32 by mirnshi