Caution : When using the “dd” command, if the size of “bs” is larger than 32MB, a 33554431(32MB-1)bytes file is created.
1
2
3
4
5
6
7
8
9
10
11
$ dd if=/dev/urandom of=100M_filled_with_random_data bs=100M count=1
0+1 records in
0+1 records out
33554431 bytes (34 MB, 32 MiB) copied, 0.553194 s, 60.7 MB/s
$ ls-alh
total 33M
drwxr-xr-x 2 chuljeon39a chuljeon39a 4.0K Mar 1 18:53 .
drwxr-xr-x 30 chuljeon39a chuljeon39a 4.0K Mar 1 14:52 ..
-rw-r--r-- 1 chuljeon39a chuljeon39a 32M Mar 1 18:53 100M_filled_with_random_data
$
It was expected a 100MB file to be created, but a 32MB file was actually created.
That’s because it reads only 33554431 bytes from “/dev/urandom” at a time.
Leave a comment