snipt

Ctrl+h for KB shortcuts

Text only

dd

1
2
3
4
5
6
dd, permite copiar y convertir datos de archivos.

Utilidades:

# Comprobar la velocidad de escritura del disco duro.
$ dd if=/dev/zero of=small.txt bs=64k count=32k
https://snipt.net/embed/1e368d86315d0024c1cf27d9e1b30c57/
https://snipt.net/raw/1e368d86315d0024c1cf27d9e1b30c57/
1e368d86315d0024c1cf27d9e1b30c57
text
Text only
7
2016-09-15T17:09:42
True
False
False
Jun 12, 2013 at 08:48 AM
/api/public/snipt/63948/
dd-3
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>dd, permite copiar y convertir datos de archivos. </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>Utilidades: </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a># Comprobar la velocidad de escritura del disco duro. </span><span id="L-6"><a name="L-6"></a>$ dd if=/dev/zero of=small.txt bs=64k count=32k </span></pre></div> </td></tr></table>
dd

Text only

Save partition into a iso with dd

sudo dd if=/dev/sdc1 of=/tmp/tmp.iso
https://snipt.net/embed/f7cd38bf69f17b3d9d98c155e3b03370/
https://snipt.net/raw/f7cd38bf69f17b3d9d98c155e3b03370/
f7cd38bf69f17b3d9d98c155e3b03370
text
Text only
2
2016-09-22T17:03:38
True
False
False
May 22, 2013 at 02:01 PM
/api/public/snipt/43760/
copiar-particion-con-dd
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>sudo dd if=/dev/sdc1 of=/tmp/tmp.iso </span></pre></div> </td></tr></table>
Debian, Linux, Ubuntu, dd, iso

Bash

Create an empty fixed-size sparse file for later use

1
2
3
4
# Create an empty file sized to suit your needs, whereas no real blocks are physically written.
# In this example, a 8 GB sparse file (/mnt/DISK) will be created.

dd of=/mnt/DISK bs=1G count=0 seek=8
https://snipt.net/embed/08be4d160df69c0c7b8e089b3c5673cf/
https://snipt.net/raw/08be4d160df69c0c7b8e089b3c5673cf/
08be4d160df69c0c7b8e089b3c5673cf
bash
Bash
4
2016-09-23T23:33:00
True
False
False
/api/public/snipt/36892/
create-an-empty-fixed-size-sparse-file-for-later-use
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># Create an empty file sized to suit your needs, whereas no real blocks are physically written.</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># In this example, a 8 GB sparse file (/mnt/DISK) will be created.</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>dd <span class="nv">of</span><span class="o">=</span>/mnt/DISK <span class="nv">bs</span><span class="o">=</span>1G <span class="nv">count</span><span class="o">=</span><span class="m">0</span> <span class="nv">seek</span><span class="o">=</span>8 </span></pre></div> </td></tr></table>
bash, dd

Bash

test read speed

1
2
3
# read 1 GB from dev sdb to null 
# 
dd if=/dev/sdb of=/dev/null bs=64K count=16384
https://snipt.net/embed/2e9d372af41927bc6593617d96bf0322/
https://snipt.net/raw/2e9d372af41927bc6593617d96bf0322/
2e9d372af41927bc6593617d96bf0322
bash
Bash
3
2016-09-23T06:58:29
True
False
False
/api/public/snipt/34002/
test-read-speed
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># read 1 GB from dev sdb to null </span> </span><span id="L-2"><a name="L-2"></a><span class="c"># </span> </span><span id="L-3"><a name="L-3"></a>dd <span class="k">if</span><span class="o">=</span>/dev/sdb <span class="nv">of</span><span class="o">=</span>/dev/null <span class="nv">bs</span><span class="o">=</span>64K <span class="nv">count</span><span class="o">=</span>16384 </span></pre></div> </td></tr></table>
dd

Bash

sparse disk dd mkfs.ext3

1
2
3
4
5
# sparse disk dd
# seek * 300 = 1024 * 300 = 300G

dd if=/dev/zero of=/xen/dom1.img bs=1024k seek=1024 count=0
mkfs.ext3 -F dom1.img
https://snipt.net/embed/129ff03ff5751f4c3c4fbb93bfa06e24/
https://snipt.net/raw/129ff03ff5751f4c3c4fbb93bfa06e24/
129ff03ff5751f4c3c4fbb93bfa06e24
bash
Bash
6
2016-09-24T07:55:26
True
False
False
/api/public/snipt/10015/
sparse-disk-dd-mkfsext3
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># sparse disk dd</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># seek * 300 = 1024 * 300 = 300G</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>dd <span class="k">if</span><span class="o">=</span>/dev/zero <span class="nv">of</span><span class="o">=</span>/xen/dom1.img <span class="nv">bs</span><span class="o">=</span>1024k <span class="nv">seek</span><span class="o">=</span><span class="m">1024</span> <span class="nv">count</span><span class="o">=</span>0 </span><span id="L-5"><a name="L-5"></a>mkfs.ext3 -F dom1.img </span></pre></div> </td></tr></table>
dd, disk, mkfs.ext3, sparse

Bash

creating a big sparse file (quickly)

dd if=/dev/zero of=the_file bs=1 count=0 seek=12345
https://snipt.net/embed/176bc85ce9dff8a3f02afd0a63b2df77/
https://snipt.net/raw/176bc85ce9dff8a3f02afd0a63b2df77/
176bc85ce9dff8a3f02afd0a63b2df77
bash
Bash
1
2016-09-18T05:40:19
True
False
False
/api/public/snipt/7489/
creating-a-big-sparse-file-quickly
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>dd <span class="k">if</span><span class="o">=</span>/dev/zero <span class="nv">of</span><span class="o">=</span>the_file <span class="nv">bs</span><span class="o">=</span><span class="m">1</span> <span class="nv">count</span><span class="o">=</span><span class="m">0</span> <span class="nv">seek</span><span class="o">=</span>12345 </span></pre></div> </td></tr></table>
dd
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.