0

I was wondering if there are certain versions of dd that don't understand multiplicative suffixes. From the dd man page it says:

bs=BYTES
    read and write BYTES bytes at a time (also see ibs=,obs=) 
BLOCKS and BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

but when I ran dd with a G suffix on the bs parameter I got an error about the number not being understood:

bash $ dd if=/dev/urandom of=largeMovie.avi count=1024 bs=75G
dd: invalid number `75G'

The version of dd is as follows:

bash $ dd --version
dd (coreutils) 5.97

A

amadain
  • 2,724
  • 4
  • 37
  • 58

2 Answers2

1

G is not a standard suffix. The behavior is therefore undefined.

The only standard suffixes are k (1024) and b (512). If you want anything else, you can use x between several numbers with suffixes to multiply:

dd bs=1024 count=75x1024x1024x1024

(Your example tries to allocate 75GiB of RAM which is rarely ok, so I switched the bs and count)

Here's what POSIX says:

For the bs=, cbs=, ibs=, and obs= operands, the application shall supply an expression specifying a size in bytes. The expression, expr, can be:

A positive decimal number

A positive decimal number followed by k, specifying multiplication by 1024

A positive decimal number followed by b, specifying multiplication by 512

Two or more positive decimal numbers (with or without k or b) separated by x, specifying the product of the indicated values

Community
  • 1
  • 1
that other guy
  • 116,971
  • 11
  • 170
  • 194
0

I think you're on 32 bit and 75G is bigger than size_t. Even on 64 bit you'll need at least that amount of mem available as dd will allocate a buffer of the size specified by bs.

pixelbeat
  • 30,615
  • 9
  • 51
  • 60