Create a big file on ESXi 6.x with zero's written on it (Testing Purpose)

Many times for the testing purpose you need to create big capacity dummy files on the filesystems to check few features of disks/arrays or some kind of drivers. So here I will show you how you can create such a big file and also depending on your requirement if you need just an empty file or you need to zero it out, means writing zero's on it.

ESXi server has a inbuilt utility which makes this task easier, named "vmkfstool". This is the same utility which is also used for making new VMDK files for the VM's, and that's what we will be using for testing purpose:


Create 50GB large empty file:

# vmkfstools -c 50G /vmfs/volumes/esx_ds/dummy-fill/fill1.vmdk -d thin
Create: 100% done.


Create 50GB large file with zero's written on it:

# vmkfstools -c 50G /vmfs/volumes/esx_ds/dummy-fill/fill1.vmdk -d eagerzeroedthick
Creating disk '/vmfs/volumes/esx_ds/dummy-fill/fill1.vmdk' and zeroing it out...
Create: 100% done.

[root@CRT3-D-ESX6U3:~] ls -l /vmfs/volumes/esx_ds/dummy-fill/fill1*
-rw-------    1 root     root     1073741824 Feb 15 09:38 /vmfs/volumes/esx_ds/dummy-fill/fill1-flat.vmdk
-rw-------    1 root     root           491 Feb 15 09:38 /vmfs/volumes/esx_ds/dummy-fill/fill1.vmdk

Now if you observe here it will create two files

"fill1-flat.vmdk" : This is the default large virtual disk data file that is created when we create VMDK file and this should not be an RDM. When using thick disks, this file will be approximately the same size as what you specify when you create your VMDK file for VM.

"fill1.vmdk" : It's a small text disk descriptor file, which describes the size and geometry of the VMDK file. This descriptor file also contains a pointer to the large data file as well as information on the virtual disk drive sectors, heads, cylinders and disk adapter type.

In case if you want to delete or remove above VMDK file:

# vmkfstools -U /vmfs/volumes/esx_ds/dummy-fill/fill1.vmdk

This will delete both of the autogenerated files.

Comments

Post a Comment

Popular posts from this blog

Recover or restore initramfs file in RHEL or CentOS 7

Space reclamation / UNMAP on RHEL or CentOS 7

How to recover /boot partition on RHEL or CentOS 7?