Editing Dd (command)

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 6: Line 6:
 
:<code>oflag=sync</code><ref>https://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html#dd-invocation</ref>
 
:<code>oflag=sync</code><ref>https://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html#dd-invocation</ref>
 
:<code>iflag=[fullblock|nocache]</code>
 
:<code>iflag=[fullblock|nocache]</code>
:<code>conv=notrunc,noerror</code><ref>https://askubuntu.com/a/227933</ref>. notrunc is only important to prevent truncation when writing into a file. This has no effect on a block device such as sda or sdb<ref>https://stackoverflow.com/a/20531600</ref>
+
 
  
 
== Examples ==
 
== Examples ==
 
* Write a 10G file with random data: 10 G (<code>bs=10G count=1</code>), with random data (<code>[[/dev]]/[[urandom]]</code>)<ref>https://superuser.com/a/470957</ref>:
 
* Write a 10G file with random data: 10 G (<code>bs=10G count=1</code>), with random data (<code>[[/dev]]/[[urandom]]</code>)<ref>https://superuser.com/a/470957</ref>:
<code>dd iflag=fullblock if=/dev/[[urandom]] of=sample_output_file.txt bs=10G count=1 status=[[progress]]</code>
+
<code>dd iflag=fullblock if=/dev/[[urandom]] of=sample_output_file.txt bs=10G count=1 status=progress</code>
 
<pre>
 
<pre>
 
  10737418240 bytes (11 GB, 10 GiB) copied, 66 s, 162 MB/s
 
  10737418240 bytes (11 GB, 10 GiB) copied, 66 s, 162 MB/s
Line 17: Line 17:
 
  10737418240 bytes (11 GB, 10 GiB) copied, 66.4367 s, 162 MB/s
 
  10737418240 bytes (11 GB, 10 GiB) copied, 66.4367 s, 162 MB/s
 
</pre>
 
</pre>
status=progress not supported on [[macOS]]
 
  
* Write a 10G with zeroes: 10 G (<code>bs=10G count=1</code>), file with "zeroes" (<code>[[/dev/zero]]</code>):
+
* Write a 10G with zeroes: 10 G (<code>bs=10G count=1</code>), file with "zeroes" (<code>/dev/zero</code>):
 
<code>dd iflag=fullblock if=[[/dev/zero]] of=sample_output_file.txt bs=10G count=1 status=progress</code>
 
<code>dd iflag=fullblock if=[[/dev/zero]] of=sample_output_file.txt bs=10G count=1 status=progress</code>
 
<pre>
 
<pre>
Line 32: Line 31:
 
dd: memory exhausted by input buffer of size 10737418240 bytes (10 GiB)
 
dd: memory exhausted by input buffer of size 10737418240 bytes (10 GiB)
 
</pre>
 
</pre>
 
* <code>if=/dev/vda | [[gzip -1]] | ssh your.server.com dd of=/mnt/storage/imagename.img.gz</code>
 
 
 
* [[Clone an SD card with dd]]
 
  
 
== Activities ==
 
== Activities ==
Line 45: Line 39:
  
 
Advanced
 
Advanced
# Understand iflags, such us [[fullblock]] <code>iflag=fullblock</code> meaning
+
# Understand iflags, such us fullblock <code>iflag=fullblock</code> meaning
 
# Try to interrupt/kill your command: <code>dd iflag=fullblock if=/dev/urandom of=sample_output_file.txt bs=10G count=1</code> and explain outcome.
 
# Try to interrupt/kill your command: <code>dd iflag=fullblock if=/dev/urandom of=sample_output_file.txt bs=10G count=1</code> and explain outcome.
 
== Related terms ==
 
* [[Progress (command)]]
 
  
 
== See also ==
 
== See also ==
* {{cp}}
+
* [[cp]] and [[rsync]]
 
* {{Io performance commands}}
 
* {{Io performance commands}}
* {{pv}}
+
* [[pv]]
 
* [[Benchmarking tools]]
 
* [[Benchmarking tools]]
 
* {{files}}
 
* {{files}}

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Advertising: