I've searched the forum but cannot find a definitive explanation as to the differences between the Defrag and Shrink options wrt to my setup...
First let me mention, I know the general concept of defragging and shrinking and why I need to do it - I have a growable .vmdk file (currently over 200Gb in size) hosted on Windows 2003. The guest machine is Linux Debian, the virtual disk partition is ext3 (which, when I do a df inside, shows it's only 150Gb-ish - hence why I want to shrink it, although I do know there are some overheads etc.).
Since it's bare Linux and CLI-only, I can't install VM Tools, so I'm preparing the guest with:
cat /dev/zero>zero.fill;sync;sleep 1;sync;rm -f zero.fill
...inside the VM (and in single user mode), then shutting it down. I then need to defrag/shrink/whatever with vdiskmanager in the Windows host.
(The reason I'm not using the Defragment button in the VM Server Console is that I'm also in the process of converting the single growable disk to 2Gb-split growable onto another external hardrive - simply because I don't have enough disk space on either drive to do the shrink as one ~150-200Gb file. Plus I want a backup in case it goes wrong. I'm hoping chopping it up into 2Gb files will let it use the free space bit by bit.)
Now, I'm a bit confused at this point.
What does the -d (defrag) option actually do? What kinda defrag is this? Since this is done offline and outside the guest, I'm assuming this is not the same kind of defrag that's done in the guest (ext3 is apparently resilient to actual file fragmentation so I'm skipping that part anyway). Does this simply rearrange the order of the data blocks as seen by the virtualisation layer?
Why does vdiskmanager have a -p (prepare) command and what does that actually do? Why the need to mount and dismount to a drive letter? Again, I'm assuming I should skip this part since I can't (and probably shouldn't) mount a Linux guest partition to a Windows host(?).
Finally, what does -k (shrink) do that the other two option above don't? With my setup, do I need to prepare it first before I use -k? I've already prepared it, right? By filling the empty sectors with zeros...
I'm thinking -d and then just -k will do the job (or even just -k?). At the moment and as a test, I'm 50% through -d (this gonna take some time!).
Interestingly, before I started this (and just after I used the -r & -t 1 options to convert the disk image across), not all of the 2Gb-split files are exactly 2Gb. In fact, some of the later-numbered ones are only 100Mb or so. The current defrag is half-way through and yet still, some of the early processed files are short of 2Gb. Will a shrink sort that out I'm wondering?
Well, sorry for the lengthy post and this extraordinary detailed request.
But if I can get my head around what each option actually does, I should then have a clear idea of the correct steps to optimise .vmdk's in this particular setup.
Would appreciate any info anyone can provide.
Many thanks!