LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-20-2018, 11:48 AM   #1
anutosho
Member
 
Registered: Nov 2007
Posts: 32

Rep: Reputation: 30
dd - excessive reads from target


Hi together, today I wanted to write a CD image to a USB key, using dd. I noticed that the write is relatively slow. When I started the gkrellm monitor I noticed that dd is doing excessive reads from the target (the USB stick). Write operations took place only between these read operations, see attached screenshot (oh, no file attachments here?...) Any idea what's happening here?
 
Old 03-20-2018, 12:32 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You don't say what blocksize (if any) or other options you specified.

This link suggests 4M and also notes you need to be sure the thumb drive is unmounted (not ejected):

Code:
dd bs=4M if=[ur .iso] of=/dev/sd[that 1 letter]
The link talks about a Windows CD but I doubt that matters if you're doing a dd.
 
Old 03-20-2018, 12:40 PM   #3
anutosho
Member
 
Registered: Nov 2007
Posts: 32

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by MensaWater View Post
You don't say what blocksize (if any) or other options you specified.
I didn't because I did not specify any special blocksize, so the standard is used.
I don't think the drive was mounted (cannot be 100% sure, though)
I remember having this issue with hard disks, too. Sometimes it helped to just cancel and restart the dd process.
 
Old 03-20-2018, 03:01 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by anutosho View Post
the standard is used.
The default might be painfully slow for various reasons. Use of an appropriate bs helps speed things up AND reduce the number of reads and writes. I suggested the 4M as the post that suggested it talked about CD to usb so seemed relevant.

For more details reading on setting appropriate block size you might try these:
http://blog.tdg5.com/tuning-dd-block-size/
https://serverfault.com/questions/65...rove-the-speed
 
Old 03-20-2018, 04:54 PM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I think dd reads three times as much as it writes. It reads into a buffer, then it compares the buffer to the source, then it writes the buffer to the target. And it probably interleaves several of those operations.
 
Old 03-20-2018, 09:19 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
It looks like it does what you'd expect - reads sectors, and writes them out. I put perf probes on libc read and write, and ran a small dd - count = 100000. Here's the result, redacted for brevity;
Code:
[root@xps ~]# cat read.001 
# event histogram
#
# trigger info: hist:keys=common_pid.execname:vals=hitcount:sort=hitcount:size=2048 [active]
#

...
{ common_pid: gnome-shell     [      1700] } hitcount:        470
{ common_pid: dd              [     17140] } hitcount:     100000

[root@xps ~]# cat write.001 
# event histogram
#
# trigger info: hist:keys=common_pid.execname:vals=hitcount:sort=hitcount:size=2048 [active]
#

...
{ common_pid: bash            [     16376] } hitcount:        151
{ common_pid: dd              [     17140] } hitcount:     100003
The effects the OP is seeing would be due to the I/O scheduler and caching effects (hence cancel/restart being faster).
 
Old 03-20-2018, 11:34 PM   #7
anutosho
Member
 
Registered: Nov 2007
Posts: 32

Original Poster
Rep: Reputation: 30
Thanks a lot for your tips and insights.
I think this could be regarded as solved.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installation (Linux) RISCV GNU Toolchain error: C compiler cannot create executables, recipe for target 'configure-target-libgomp' failed riscv Linux - Newbie 2 03-23-2017 08:36 AM
How do I find the target directory (not the target fs) of a mount -bind raananh Linux - Newbie 2 01-13-2013 09:18 AM
Difference between buffered disk reads and cached reads? pinga123 Linux - Newbie 1 07-13-2011 11:40 AM
Making a symlink follow its target when the target moves pwabrahams Linux - Software 3 03-08-2011 07:04 PM
Slow ddrescue recovery problem (slow reads? excessive retries?) mventimi Linux - General 4 09-22-2010 07:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration