I need to create a large sized file that doesn't have repeated stuff in it so that even on zipping, I don't get the size reduced.
14 Answers
The best way to create random dump files is by using 'fsutil' in your command prompt.
C:\>fsutil file createnew another1.txt 32234567000
File C:\another1.txt is created
This creates 32GB file instantly which has random content.
11Under Linux the easiest way to do this would be the dd command. There is a Windows version at
To create a random file with a size of 1GB you can run the command
dd if=/dev/random of=random.file bs=1M count=1000
This means: use a blocksize of 1 MB and read/write 1000 blocks.
btw. on Linux you should use /dev/urandom but for this Windows version it has to be /dev/random
On Windows, you can create a file containing truly unique content with Powershell. No third-party software needed. No admin rights needed.
As opposed to fsutil, the output will not contain 0's or spaces. Each time you run the command, the output will be unique. On compression, the file will retain it's original size.
The output will look something like this:
䫲藌㦖鐆쩘ꌓ⮅픻씙방醒ম擾酰₵廙⊌弓똌硣浍鐟ઘ⃭佐怱쎜鼋ꄻ윤訟ᦟ맂㱆�㔭ර槗旌閣㏏⯉來殰鲑奣鑍翴㑈Ꮪ嚠昲︇퇇뻕耣珁犒晥䒋酉懒䊿䱵漝벻玓啈�펕戶臓헬珎宇ꄌꖓ萿 etc....
The command
$out = new-object byte[] 100000; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes('C:\100K.txt', $out)Replace 100000 with whatever size you want, in bytes. You can use an online converter if you need help defining the size you prefer.
Replace C:\100K.txt with the filepath you want. If you provide a name without a path, it will be saved in your Windows profile folder (or maybe C:, depending on your system configuration). The file extension has no impact on the process.
Breakdown
This is a series of three commands. The first command creates an empty array called $out, of the size you specify. The second command loads the array with random characters. The third command saves the array to a file.
Here's the Microsoft support file for new-object.
This appears to be supported at least as far back as Powershell 3.0. (Currently at version 7.x as of this writing).
Taken from:
Limit
I can output files up to 2G. Anything larger hits a limit. For example, 3G gives:
"Cannot convert value "3000000000" to type "System.Int32". Error: "Value was either too large or too small for an Int32.""
This answer shows a way to write large files in chunks. Basically, wrap a do..while around the commands which load the array and write to file. The writes need to append to the file.
Regardless of limits on array-size, I think you'll want to consider your available RAM.
6Install Veracrypt.
Create an encrypted container that is formatted (not quick format) with whatever size you want.
This will ensure the contents are cryptographically random.
Alternatively, create a file with fsutil as suggested by fossa then encrypt the contents with a one-time pad (for example, with AES using a random passphrase that you throw away).