At first glance it doesn't care much.
[sean@bob ddtest]$ echo "hello" > test
[sean@bob ddtest]$ ls -l test
-rw-rw-r-- 1 sean sean 6 Feb 21 21:43 test
[sean@bob ddtest]$ dd if=test of=test.out
bs=1k
0+1 records in
0+1 records out
6 bytes (6 B) copied, 0.000157303 seconds, 38.1 kB/s
[sean@bob ddtest]$ ls -l test.out
-rw-rw-r-- 1 sean sean 6 Feb 21 21:43 test.out
Flip through the source code to
dd.c:
/* The number of bytes in which atomic reads are done. */
static size_t input_blocksize = 0;
/* The number of bytes in which atomic writes are done. */
static size_t output_blocksize = 0;
You'd have to browser a bit deeper to get the One True Answer, there looks like there are several different types of copying that can happen, each has different behaviours.
notrunc is a bit easier, it's only referenced in two places, both in the same function. It seems to be a direct setting/clearing of O_TRUNC to open(2):
O_TRUNC
If the file already exists and is a regular file and the open
mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0. If the file is a FIFO or terminal device
file, the O_TRUNC flag is ignored. Otherwise the effect of
O_TRUNC is unspecified.
Sean
Can someone tell me how the dd command handles block sizes? The man
page and any Linux books I have don't explain it very well.
If I specify
dd if=\dev\mydevice ... bs=1M
What happens if mydevice has a fraction of a block left over?
What is "notrunc" for the output file? Truncation from what to what?
--
-Dan
Dr. Dan Martin, MD, CCFP, BSc, BCSc (Hon)
GP Hospital Practitioner
Computer Science grad student
ummar143@cc.umanitoba.ca
(204) 831-1746
answering machine always on
_______________________________________________
Roundtable mailing list
Roundtable@muug.mb.ca
http://www.muug.mb.ca/mailman/listinfo/roundtable