Create a big file on Windows 2012R2 and 2016 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.


To create an empty 50GB file using Powershell:

PS C:\> fsutil file createnew d:\dummy_file.img 53687091200

Here above command will create 50GB of the file named "dummy_file.img" inside "D:" filesystem. Where "53687091200" is in Bytes which is equivalent to 50GB.


To create a big 50GB file and to write zero's on it follow below commands;

Creates a new file of a specified size:

PS C:\> fsutil file createnew d:\dummy_file.img 53687091200
File d:\fill1 is created


Set the valid data length for a file:

PS C:\> fsutil file setvaliddata d:\dummy_file.img 53687091200
Valid data length is changed


Set the zero data for a file:

PS C:\Users\Administrator> fsutil file setzerodata offset=0 length=53687091200 d:\dummy_file.img
Zero data is changed

This last command will take some time depending upon the file size it has to zero out and the RAM/CPU present on your server or VM.

Comments

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?