Home > 備忘録 > Linux > dd コマンド( 4 )
fdiskでUSB接続したHDDを確認すること。これはハードディスク全体に「ゼロや乱数」を書き込むものです。
[root@server]# fdisk -l
[root@server]# dd if=/dev/zero of=/dev/sdb bs=4096 conv=sync,noerror (Zeroの書き込み)
[root@server]# dd if=/dev/urandom of=/dev/sdb bs=4096 conv=sync,noerror (乱数の書き込み)[root@server]# dd if=/dev/sda of=/dev/sdb[root@server]# dd if=/dev/sda of=/dev/sdc bs=512 count=1[root@server]# dd if=/dev/sda1 of=/dev/sdc1 bs=4096
[root@server]# dd if=/dev/sda2 of=/dev/sdc2 bs=4096[root@server]# dd if=/dev/zero of=/dev/sdc2 bs=4096 conv=sync,noerror ->(※注意)[root@server]# ps ax|grep dd
13579 pts/0 S 0:10 dd if=/dev/zero of=/dev/sdc2 bs=4096 conv=sync,noerror
13603 pts/0 S+ 0:00 grep dd[root@server]# kill -SIGUSR1 13579[root@server]# dd if=/dev/zero of=/dev/sdb bs=4096 conv=sync,noerror
2569+0 records in
2569+0 records out
2693791744 bytes (2.7 GB) copied, 99.2442 s, 27.1 MB/s[root@server]# killall -SIGUSR1 dd[root@server]# dd if=/dev/zero of=/dev/sdb bs=4096 conv=sync,noerror
2569+0 records in
2569+0 records out
2693791744 bytes (2.7 GB) copied, 99.2442 s, 27.1 MB/s[root@server]# dmesg | tail
[142321.470038] usb 2-1.4: SerialNumber: 00000000000000000000
[142321.473700] scsi host9: uas
[142321.474630] scsi 9:0:0:0: Direct-Access ST332041 8AS 0101 PQ: 0 ANSI: 6
[142321.486130] sd 9:0:0:0: Attached scsi generic sg4 type 0
[142321.486196] sd 9:0:0:0: [sdf] 625142448 512-byte logical blocks: (320 GB/298 GiB)
[142321.487224] sd 9:0:0:0: [sdf] Write Protect is off
[142321.487235] sd 9:0:0:0: [sdf] Mode Sense: 67 00 10 08
[142321.487795] sd 9:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports DPO and FUA
[142321.519407] sdf: sdf1
[142321.521549] sd 9:0:0:0: [sdf] Attached SCSI disk[root@server]# fdisk /dev/sdf