Inizio  >  Docs  >  Linux  >  Trucchi veloci  >  dd tricks  
dd tricksdd tricks

Index

'dd' over network with Netcat

Client:
dd if=file.img bs=16M | bzip2 -c | ncat serverNCat 2222

serverNCat:
ncat -p 2222 -l | bzip2 -d | dd bs=16M of=/dev/sdX

 

ps auxww |grep " dd " |grep -v grep |awk '{print $2}' |while read pid; do kill -USR1 $pid; done

 

watch -n 10 killall -USR1 dd

killall -INFO dd

while killall -USR1 dd; do sleep 5; done

 

on OSX:

<code>while :; do clear; kill -INFO $PID; sleep 2; done</code>

mbr / grub delete

Backup MBR (with partition table) of drive hda in /opt/MBRboot.img
dd if=/dev/hda of=/opt/MBRboot.img bs=512 count=1

Backup MBR (without partition table) of drive hda in /opt/MBRboot.img
dd if=/dev/sda of=/opt/MBR.img bs=446 count=1

Delete partition table and MBR
sudo dd if=/dev/zero of=/dev/sdb count=1 bs=512

Delete only MBR
sudo dd if=/dev/zero of=/dev/sdb count=1 bs=446