VMware Cloud Community
RParker
Immortal
Immortal
Jump to solution

ESX Defrag

From discussions with people at work, we have been working with Windows and we have Diskeeper for our Windows machines, and then the question arose, well what about VMFS?

So I pose the question, does VMFS need to be deframented?

If so, how does one go about this? I don't see anything about fragmented VMFS volumes myself, so obviously it's not an issue, but just to be sure, I thought I would ask. Thanks.

Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

You do not need to defragment VMFS volumes. Using vmkfstools ensures VMDKs are never fragmented, and the smaller files are all stored in sub-blocks of a single block anyway, so cannot be fragmented.

Remember it's not like your average NTFS/EXT3 file system (with 4kb-64kb blocks), VMFS has a huge blocksize (1MB-8MB) so won't fragment in the same way.

View solution in original post

Reply
0 Kudos
6 Replies
admin
Immortal
Immortal
Jump to solution

You do not need to defragment VMFS volumes. Using vmkfstools ensures VMDKs are never fragmented, and the smaller files are all stored in sub-blocks of a single block anyway, so cannot be fragmented.

Remember it's not like your average NTFS/EXT3 file system (with 4kb-64kb blocks), VMFS has a huge blocksize (1MB-8MB) so won't fragment in the same way.

Reply
0 Kudos
kix1979
Immortal
Immortal
Jump to solution

As mittell said, no reason to defrag. You can via SAN tools or Disk based tools, but I haven't seen a performance increase in doing so. It's one reason that ESX preallocates the disk so it is contiguous.

Thomas H. Bryant III
bister
Expert
Expert
Jump to solution

I also agree to what mittell said. An other thing is that fragmentation only occures while deleting files and overwriting that part of the volume with another file. Happens frequently to small files, but IMO not to big data files as VMDK. Of course inside the data files fragmentation can happen.

Regards,

Christian

Reply
0 Kudos
fscked
Contributor
Contributor
Jump to solution

Were you referring to the VMFS file themselves or the data inside them the VM's write "virtual disks"?

Reply
0 Kudos
SHAMRIN
Contributor
Contributor
Jump to solution

Certainly, when a VMDK file is created - all of the space is allocated at that time..... But the defragmentation of a disk arises not only because of change of the size of files, but also because of creation and removal of files.

Simply experiment: now I have free space 280G

\[root@center-vm1-03 root]# vdf -h

Filesystem Size Used Avail Use% Mounted on

/vmfs/volumes/4522dee4-c42eac3b-2910-0014384d72f8

341G 61G 280G 17% /vmfs/volumes/SAN-DATASTORE-4

Six steps: I create 5 disks on 50Gb and one disk 20Gb

Capacity 341G, 230G available, file block size 2.0M

Capacity 341G, 180G available, file block size 2.0M

Capacity 341G, 130G available, file block size 2.0M

Capacity 341G, 80G available, file block size 2.0M

Capacity 341G, 30G available, file block size 2.0M

Capacity 341G, 10G available, file block size 2.0M

Remove&delete files from disk: 1, 3, 5. Of course, my free space 160G

Create new vmdk 155G, "Capacity 341G, 6.0G available, file block size 2.0M"

And all works! However that we have received? Last file it is guaranteed has a defragmentation and consists (physically, on file system) a minimum of four pieces!

And in fact at us at test-stand in day 10-20 new machines can be created and destoyed. Therefore I think - the defragmentation exists. One greater company too once spoke, that NTFS do not have defragmentation....

Reply
0 Kudos
RaameshKeerthi
Contributor
Contributor
Jump to solution

Hi Mittell,

If so, then why there is a method defragmentAllDisks() in vSphere API?

Could you please explain in detail...

Thanks and Regards

Raamesh Keerthi N.J

Raamesh Keerthi N.J.| http://www.twitter.com/raameshkeerthi
Reply
0 Kudos