LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   writing data to fill a 1 TB disk (https://www.linuxquestions.org/questions/linux-general-1/writing-data-to-fill-a-1-tb-disk-4175418786/)

zackmax 07-26-2012 09:02 AM

writing data to fill a 1 TB disk
 
hi everyone:

I have to run a test with a drive that needs to be 1 TB but needs to have 10 GB of data after every 100 GB.

Like this:

10 GB data
100 GB free
10 GB data
100 GB free
10 GB data
...

I know this can probably be done with dd command but I would appreciate some help and I cannot figure out the correct switches.

Thank you for your help!

eSelix 07-26-2012 10:40 AM

Yes, "dd" in loop can do it:
Code:

dd if=/dev/random of=/dev/sdx conv=notrunc oflag=append bs=1G count=10 seek=100
Where /dev/sdx is a drive you want to write (be aware that it destroy whole data on it, but you can also use a partition name or ordinary filename) and argument for "bs" depends on available memory, you can lower it and raise "count" and "seek" accordingly if you get message about low memory. Just enclose it within some loop.

I do not known if "conv=notrunc oflag=append" is appropriate for devices, if not then you need create some more advanced loop with progressive "seek".

zackmax 08-03-2012 03:58 PM

Quote:

Originally Posted by eSelix (Post 4738657)
Yes, "dd" in loop can do it:
Code:

dd if=/dev/random of=/dev/sdx conv=notrunc oflag=append bs=1G count=10 seek=100
Where /dev/sdx is a drive you want to write (be aware that it destroy whole data on it, but you can also use a partition name or ordinary filename) and argument for "bs" depends on available memory, you can lower it and raise "count" and "seek" accordingly if you get message about low memory. Just enclose it within some loop.

I do not known if "conv=notrunc oflag=append" is appropriate for devices, if not then you need create some more advanced loop with progressive "seek".


Thank you for your help! :)

rknichols 08-03-2012 06:17 PM

"seek" is the answer here. "append" would try to append to the end of the device, not wherever you happened to stop writing last time, causing an immediate "No space left" error and no data transferred.

anomie 08-03-2012 07:14 PM

Is pseudo-random data really a requirement? If not, using /dev/zero as input would be a lot more efficient than /dev/random (or /dev/urandom).

zackmax 08-03-2012 08:28 PM

Quote:

Originally Posted by anomie (Post 4745451)
Is pseudo-random data really a requirement? If not, using /dev/zero as input would be a lot more efficient than /dev/random (or /dev/urandom).

nope not a requirement. I will remember this for next time. Thank you!

sundialsvcs 08-04-2012 01:43 PM

If you want to "fill" a device e.g. to erase it, consider that many disk drives are able to perform "on-board diagnostics" (such as "SMART") independently of what they do in response to CPU-initiated commands. The disk drive itself might be capable of executing a "data security erase."


All times are GMT -5. The time now is 08:12 PM.