From: Robert Nichols on 18 Jan 2010 19:59 In article <4b54ed66$0$275$14726298(a)news.sunsite.dk>, Joseph Rosevear <joe(a)max.hopto.org> wrote: :In alt.os.linux.slackware Douglas Mayne <doug(a)localhost.localnet> wrote: :> I had to zero some disk partitions yesterday. I used this command: : :> # dd if=/dev/zero of=/dev/sdb5 & :> # P=$! : :Great. I didn't know about $!. : :> Then I checked its progress periodically, : :> # kill -USR1 $P : :I tried this and it killed the process. E.g., : : konqueror& : P=$! : kill -USR1 $P : :Is dd immune to being killed? What's up here? The only issue here is the seriously misnamed "kill" command. All the "kill" command does is send a signal to one or more processes. The default signal happens to be TERM (terminate gracefully), and the default action for most other signals is also to terminate the process unless the process has set up some other action to be performed on receipt of that signal. The 'dd' command has arranged for showing progress information when it receives the USR1 signal. 'konquerer', OTOH, has not set up anything for that signal, so it terminates. Even the TERM signal can be intercepted by a process. That's what allows database servers and the like to do the "graceful" part of graceful termination. Only a few signals cannot be intercepted, the prime example being the KILL signal that is sent when you run "kill -9". -- Bob Nichols AT comcast.net I am "RNichols42"
From: Douglas Mayne on 19 Jan 2010 10:01 On Mon, 18 Jan 2010 08:05:26 +1100, Grant wrote: > On Sun, 17 Jan 2010 15:40:49 +0000 (UTC), Douglas Mayne > <doug(a)localhost.localnet> wrote: > >>I had to zero some disk partitions yesterday. I used this command: >> >># dd if=/dev/zero of=/dev/sdb5 & >># P=$! >> >>Then I checked its progress periodically, >> >># kill -USR1 $P >> >>The progress checks showed significantly variable output speed, from 6 >>to 80 MB/s. I retested the same problem with a similar command, >> >># cat /dev/zero >/dev/sdb5 >> >>This does not allow progress monitoring, but it does complete with an >>elapsed time consistent with the fastest disk I/O (i.e. 80 MB/s.) >> >>I am curious to why there is such a big difference for what would seem >>to be very similar I/O commands. Any comments? > > dd runs much faster if you specify a large block size, for example: > > # dd if=/dev/zero bs=1M of=/dev/sdb5 & > > Sometimes I use bs=4k -- anything's better than the default 512 byte > block writes ;) > > Grant. > Thanks for the hint. I was working under the assumption that dd would automatically buffer between the devices using a somewhat optimal buffer size for the two devices. I don't know where I got that idea. After retesting with a 1M buffer, the speed goes up even higher than I had expected. The status reports give the write speed as 133 MB/s. I assume that is nearing the absolute best write speed for a magnetic disk, and is aided in this case by being totally sequential write operation. As far as I can remember, I haven't seen anything that fast before. BTW, thanks for the kill -USR1 command. I originally saw it in your post on aols, and have added that to the bag of good tricks. -- Douglas Mayne
From: Douglas Mayne on 19 Jan 2010 18:19 On Mon, 18 Jan 2010 23:23:18 +0000, Joseph Rosevear wrote: > In alt.os.linux.slackware Douglas Mayne <doug(a)localhost.localnet> wrote: >> I had to zero some disk partitions yesterday. I used this command: > >> # dd if=/dev/zero of=/dev/sdb5 & >> # P=$! > > Great. I didn't know about $!. > >> Then I checked its progress periodically, > >> # kill -USR1 $P > > I tried this and it killed the process. E.g., > > konqueror& > P=$! > kill -USR1 $P > > Is dd immune to being killed? What's up here? There was an interesting thread on alt.os.linux.slackware a few months ago: http://groups.google.com/group/alt.os.linux.slackware/msg/94e0d12967be24b7 I know you read that group, too ;-) Check out that thread. > > (I tried to look up some documentation on "kill -USR1". I couldn't find > -USR1 mentioned in "man kill" or "help kill". Argh.) > kill sends signals. Maybe, in addition to man kill try man 7 signal The Slackware manual page for kill is somewhat different than the standard unix manual page that Google finds with "man kill" http://unixhelp.ed.ac.uk/CGI/man-cgi?kill > >> The progress checks showed significantly variable output speed, from 6 >> to 80 MB/s. I retested the same problem with a similar command, > >> # cat /dev/zero >/dev/sdb5 > > Great. I didn't know you could do this. > >> This does not allow progress monitoring, but it does complete with an >> elapsed time consistent with the fastest disk I/O (i.e. 80 MB/s.) > >> I am curious to why there is such a big difference for what would seem >> to be very similar I/O commands. Any comments? > >> Other information: I ran this on Slackware 13.0 with kernel 2.6.30.10. >> The hardware was a Core 2 motherboard and Seagate SATA (3 Gb/s) hard >> disk. > >> TIA > > I guess I didn't help you with your question... unless the answer to > your question is connected to my question. > > -Joe > Note: comments inline. -- Douglas Mayne
First
|
Prev
|
Pages: 1 2 Prev: Software reset of ps2/usb adapter? Next: difference between striping using mdadm and LVM |