Skip to main content

'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

 

'dd' with gzip

backup

dd if=/dev/hda conv=sync,noerror bs=64K | gzip -c  > /mnt/sda1/hda.img.gz

restore

gzip -dc /mnt/sda1/hda.img.gz | dd of=/dev/hda conv=sync,noerror bs=64K

check the status of 'dd' in progress

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:

while:;do clear; kill -INFO $PID; sleep 2;done

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