Question

I need to fill a USB memory and I want others to be able to repeat this in an easy way. SO I dont want to write "find a file that filles the memory" so they have to look around for such a file.

Rather I want to generate X MB of data and write that to a file that can then be transferrred to the USB stick.

How would you do that (on Windows)?

Was it helpful?

Solution

If you are on Windows, you can use fsutil:

fsutil file createnew D:\fatboy.tmp SIZE

If you are on Linux or OSX or somesuch, you can use mkfile to make a big file:

mkfile SIZE PathToFileOnUSB

e.g.

mkfile 10m /some/where/on/USB/10MegFile

Or, if your system lacks mkfile, use dd to fill storage quickly and easily.

So, if you want 10MB, use:

dd if=/dev/zero of=PathToFileOnUSB bs=1m count=10

That says... dump data, reading from /dev/zero (which supplies an endless sream of zeroes) and writing to the file called PathToFileOnUSB using a blocksize (bs) of 1 megabyte, and do this 10 times (cnt).

If you want X MB, use:

dd if=/dev/zero of=PathToFileOnUSB bs=1m count=X

If you want to fill the device, write until error without specifying a count:

dd if=/dev/zero of=PathToFileOnUSB bs=1m
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top