question

gsndev avatar image
0 Votes"
gsndev asked gsndev commented

Creating large test file on Windows

I'm planning to monitor the network with a large file transfer and need to create a dummy test file on Windows. Please can I get a confirmation if creating a test file using fsutil is recommended for this task?
fsutil file createnew pathfilename size

windows-api
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


The file will contain zeroes only. Is this suitable for your tests?

0 Votes 0 ·

The ask is to monitor the network performance during peak and off peak hours when transferring large data ~500GB.
. Initial thought is to create large file using fsutil, I'm aware that this will create sparse file, would appreciate if there are any recommendations




0 Votes 0 ·
AndreasBaumgarten avatar image
1 Vote"
AndreasBaumgarten answered AndreasBaumgarten edited

Hi @gsnarendran-4128 ,

fsutil is a good option to create a large file.

I am using the following script for the same task:

 $file = new-object System.IO.FileStream c:\temp\testfile.bin, Create, ReadWrite
 $file.SetLength(4GB)
 $file.Close()

if you prefer a file with random content you can this this:

 $file = "c:\temp\testfile3.bin"
 $sizeInMB = 8
 $out = new-object byte[] ($sizeInMB*1048576); (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes($file, $out)


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

NetoMeter-3137 avatar image
0 Votes"
NetoMeter-3137 answered gsndev commented

I like Andreas' solution as nowadays, using PS is the preferred approach. There is nothing wrong with using fsutil - you will have to specify the size in bytes though:

fsutil file createNew C:\Temp\testfile.bin 4294967296

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @NetoMeter-3137 for your suggestion.

0 Votes 0 ·