Make dd give a progress report.

คิดว่าหลายท่านคงเคยใช้คำสั่ง dd กันมาบ้างแล้ว
แต่เวลาใช้งานเราไม่สามารถที่จะรู้ได้เลยว่าคำสั่งนี้ทำไปถึงไหนแล้ว
ในบทนี้ผมจะเสนอวิธีการดูความคืบหน้าของการทำงานของคำสั่ง dd กันครับ

$ dd if=/dev/zero of=/tmp/demo bs=1M count=1563
1563+0 records in
1563+0 records out
1638924288 bytes (1.6 GB) copied, 15.355191 seconds, 104.4 MB/s

วิธีการที่ทำให้สามารถดูความคืบหน้าของการทำงานมีรายละเอียดดังน

โดยทั่วไปถ้าเราใช้คำสั่ง dd จะมาผมลัพธ์ออกมาดังข้างล่าง
จะใช้คำสั่ง

$ pkill -USR1 ^dd$

ควบคู่กับคำสั่ง watch โดยพิมพ์คำสั่งดังข้างล่าง

$ watch -n5 pkill -USR1 ^dd$

*คำสั่ง watch จะค้างจึงไม่สามารถพิมพ์คำสั่งอะไรเพิ่มได้ ถ้า่ต้องการออกให้กด ctrl+c
ขั้นสุดท้ายลองใช้คำสั่งและดูผลลัพธ์กันครับ ซึ่งผลลัพธ์จะ
ออกมาคล้ายๆข้อความด้านล่างครับ

$ dd if=/dev/zero of=/tmp/demo bs=1M count=1563
474+0 records in
474+0 records out
497025024 bytes (497 MB) copied, 4.06409 seconds, 122 MB/s
983+0 records in
983+0 records out
1030750208 bytes (1.0 GB) copied, 9.97723 seconds, 103 MB/s
1508+0 records in
1508+0 records out
1581252608 bytes (1.6 GB) copied, 15.1398 seconds, 104 MB/s
1563+0 records in
1563+0 records out
1638924288 bytes (1.6 GB) copied, 15.6136 seconds, 105 MB/s

Related posts:

  1. Diskdump report error messages when restart the diskdump service เมื่อเราได้ทำการแก้ไขหรือ configure diskdump แล้ว restart diskdump service ได้มี...
  2. Why CPU stats between ps and top Command are Different ความแตกต่างของการใช้ command ps กับ top ในการดู CPU stat...

You can leave a response, or trackback from your own site.

Leave a Reply