2 deleted 666 characters in body
source | link

Those commands will overwrite your sda device with zeroes -- the first one will do the first 16MB (block size of 4096 and count of 4096 blocks) and the 2nd one will overwrite the last 2MB (512 block size with 4096 blocks) with zeroes. (it's not technically erasing, and that relates to my first point below.)

(that was the part already mentioned in other answers, including it here for completeness)

The other thing that is worth mentioning is that after these commands are executed, it's theoretically possible to recover this data, because overwriting the disk with a single pass does not destroy everything, there are still traces of it. Note that this process is extremely tedious and/or expensive and requires extremely specific equipment. There are companies that offer such services, so if you're looking to wipe a disk clean, dd'ing with zeroes on a single pass is not good enough. Some government agencies require at least 7 passes (some ones, some zeroes, and others with random bits) and even more secure processes do as many as 35 passes of the same.

Another thing that is worth mentioning is that the block size does have effects, but those are generally only seen on high-volume operations. The most efficient (fastest) way to execute the command is if the block size of the command matches the access size of the device, otherwise time is wasted.

If you're interested, you can try creating a file with a million 1-block chunks, and a file with 1 million block chunks and see the difference:

[user@host tmp]$ time dd if=/dev/zero of=/tmp/test1 bs=1 count=1000000
1000000+0 records in
1000000+0 records out
1000000 bytes (1.0 MB) copied, 2.44439 s, 409 kB/s

real    0m2.447s
user    0m0.177s
sys     0m2.269s
[user@host tmp]$ time dd if=/dev/zero of=/tmp/test2 bs=1000000 count=1
1+0 records in
1+0 records out
1000000 bytes (1.0 MB) copied, 0.00155357 s, 644 MB/s

real    0m0.003s
user    0m0.001s
sys     0m0.002s
[user@host tmp]$ ls -al test*
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test1
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test2

As you can see, blocksize has a massive impact on efficiency. That's perhaps a sidebar to the OP, but I feel that it's still relevant.

TL;DR: Don't execute arbitrary code you find on the net, or that someone you don't trust gives you. It'll ruin your day.

Those commands will overwrite your sda device with zeroes -- the first one will do the first 16MB (block size of 4096 and count of 4096 blocks) and the 2nd one will overwrite the last 2MB (512 block size with 4096 blocks) with zeroes. (it's not technically erasing, and that relates to my first point below.)

(that was the part already mentioned in other answers, including it here for completeness)

The other thing that is worth mentioning is that after these commands are executed, it's theoretically possible to recover this data, because overwriting the disk with a single pass does not destroy everything, there are still traces of it. Note that this process is extremely tedious and/or expensive and requires extremely specific equipment. There are companies that offer such services, so if you're looking to wipe a disk clean, dd'ing with zeroes on a single pass is not good enough. Some government agencies require at least 7 passes (some ones, some zeroes, and others with random bits) and even more secure processes do as many as 35 passes of the same.

Another thing that is worth mentioning is that the block size does have effects, but those are generally only seen on high-volume operations. The most efficient (fastest) way to execute the command is if the block size of the command matches the access size of the device, otherwise time is wasted.

If you're interested, you can try creating a file with a million 1-block chunks, and a file with 1 million block chunks and see the difference:

[user@host tmp]$ time dd if=/dev/zero of=/tmp/test1 bs=1 count=1000000
1000000+0 records in
1000000+0 records out
1000000 bytes (1.0 MB) copied, 2.44439 s, 409 kB/s

real    0m2.447s
user    0m0.177s
sys     0m2.269s
[user@host tmp]$ time dd if=/dev/zero of=/tmp/test2 bs=1000000 count=1
1+0 records in
1+0 records out
1000000 bytes (1.0 MB) copied, 0.00155357 s, 644 MB/s

real    0m0.003s
user    0m0.001s
sys     0m0.002s
[user@host tmp]$ ls -al test*
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test1
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test2

As you can see, blocksize has a massive impact on efficiency. That's perhaps a sidebar to the OP, but I feel that it's still relevant.

TL;DR: Don't execute arbitrary code you find on the net, or that someone you don't trust gives you. It'll ruin your day.

Those commands will overwrite your sda device with zeroes -- the first one will do the first 16MB (block size of 4096 and count of 4096 blocks) and the 2nd one will overwrite the last 2MB (512 block size with 4096 blocks) with zeroes. (it's not technically erasing, and that relates to my first point below.)

(that was the part already mentioned in other answers, including it here for completeness)

Another thing that is worth mentioning is that the block size does have effects, but those are generally only seen on high-volume operations. The most efficient (fastest) way to execute the command is if the block size of the command matches the access size of the device, otherwise time is wasted.

If you're interested, you can try creating a file with a million 1-block chunks, and a file with 1 million block chunks and see the difference:

[user@host tmp]$ time dd if=/dev/zero of=/tmp/test1 bs=1 count=1000000
1000000+0 records in
1000000+0 records out
1000000 bytes (1.0 MB) copied, 2.44439 s, 409 kB/s

real    0m2.447s
user    0m0.177s
sys     0m2.269s
[user@host tmp]$ time dd if=/dev/zero of=/tmp/test2 bs=1000000 count=1
1+0 records in
1+0 records out
1000000 bytes (1.0 MB) copied, 0.00155357 s, 644 MB/s

real    0m0.003s
user    0m0.001s
sys     0m0.002s
[user@host tmp]$ ls -al test*
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test1
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test2

As you can see, blocksize has a massive impact on efficiency. That's perhaps a sidebar to the OP, but I feel that it's still relevant.

TL;DR: Don't execute arbitrary code you find on the net, or that someone you don't trust gives you. It'll ruin your day.

1
source | link

Those commands will overwrite your sda device with zeroes -- the first one will do the first 16MB (block size of 4096 and count of 4096 blocks) and the 2nd one will overwrite the last 2MB (512 block size with 4096 blocks) with zeroes. (it's not technically erasing, and that relates to my first point below.)

(that was the part already mentioned in other answers, including it here for completeness)

The other thing that is worth mentioning is that after these commands are executed, it's theoretically possible to recover this data, because overwriting the disk with a single pass does not destroy everything, there are still traces of it. Note that this process is extremely tedious and/or expensive and requires extremely specific equipment. There are companies that offer such services, so if you're looking to wipe a disk clean, dd'ing with zeroes on a single pass is not good enough. Some government agencies require at least 7 passes (some ones, some zeroes, and others with random bits) and even more secure processes do as many as 35 passes of the same.

Another thing that is worth mentioning is that the block size does have effects, but those are generally only seen on high-volume operations. The most efficient (fastest) way to execute the command is if the block size of the command matches the access size of the device, otherwise time is wasted.

If you're interested, you can try creating a file with a million 1-block chunks, and a file with 1 million block chunks and see the difference:

[user@host tmp]$ time dd if=/dev/zero of=/tmp/test1 bs=1 count=1000000
1000000+0 records in
1000000+0 records out
1000000 bytes (1.0 MB) copied, 2.44439 s, 409 kB/s

real    0m2.447s
user    0m0.177s
sys     0m2.269s
[user@host tmp]$ time dd if=/dev/zero of=/tmp/test2 bs=1000000 count=1
1+0 records in
1+0 records out
1000000 bytes (1.0 MB) copied, 0.00155357 s, 644 MB/s

real    0m0.003s
user    0m0.001s
sys     0m0.002s
[user@host tmp]$ ls -al test*
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test1
-rw-rw---- 1 user grp 1000000 Apr  8 15:51 test2

As you can see, blocksize has a massive impact on efficiency. That's perhaps a sidebar to the OP, but I feel that it's still relevant.

TL;DR: Don't execute arbitrary code you find on the net, or that someone you don't trust gives you. It'll ruin your day.