You are not logged in.

#1 2015-05-15 20:29:50

avi9526
Member
Registered: 2015-05-15
Posts: 116

dd - not clearly understand problem with block size bigger than 512

Wiki page
https://wiki.archlinux.org/index.php/Dm … reparation
states that:

Regularly dd is used with a block size larger than default, for example bs=4M, to gain higher throughput. Using it with dm-crypt is detrimental, because it has the same default block size of 512 bytes and the command may exit before wiping the final blocks when a larger one is used.

I not fluent in english and understood this statements as: dd writing only with full blocks.

Than I checked in VM with virtual disk (which is not dm-crypt but has block size of 512 as mentioned in note above)

# blockdev --getpbsz /dev/vda
512

# dd if=/dev/zero of=/dev/vda bs=512                                                 
dd: error writing ‘/dev/vda’: No space left on device
262145+0 records in
262144+0 records out
134217728 bytes (134 MB) copied, 7.07533 s, 19.0 MB/s

# dd bs=512 if=/dev/vda skip=$((`blockdev --getsz /dev/vda` - 1)) 2>/dev/null | hexdump
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200

# dd if=/dev/urandom of=/dev/vda bs=777777                                           
dd: error writing ‘/dev/vda’: No space left on device
173+0 records in
172+0 records out
134217728 bytes (134 MB) copied, 7.80609 s, 17.2 MB/s
dd if=/dev/urandom of=/dev/vda bs=777777  0.00s user 6.41s system 82% cpu 7.813 total

# dd bs=512 if=/dev/vda skip=$((`blockdev --getsz /dev/vda` - 1)) 2>/dev/null | hexdump
0000000 3ea6 0144 4ea3 30a8 ce57 f878 ed81 5f34
0000010 8dd7 640b 5023 7791 2f60 cfde 4669 84f7
0000020 a6af 669e e025 8aaa 7601 31a5 fc39 829f
… random data until end

Seems dd writing all data even when dd block size mismatch with disk block size

At this point I have completely lost the point of that note in wiki. Could someone clarify it for me?

Last edited by avi9526 (2015-05-15 20:31:51)

Offline

#2 2015-05-15 21:03:03

frostschutz
Member
Registered: 2013-11-15
Posts: 1,419

Re: dd - not clearly understand problem with block size bigger than 512

That's nonsense. The wiki is wrong.

Offline

Board footer

Powered by FluxBB