četrtek, 14. maj 2020

unix dd command

#Format disk with zero

fdisk -l
dd if=/dev/zero of=/dev/sdd bs=1M count=1

#If your intent is to backup a remote computer's HDD A via SSH to a single file that's on your local computer's HDD, you could do one of the following.

#Backup disk examples
#run from remote computer
dd if=/dev/sda | gzip -1 - | ssh user@local dd of=image.gz

#run from local computer
ssh user@remote "dd if=/dev/sda | gzip -1 -" | dd of=image.gz

#Methods for monitoring?
#Login via ssh in another terminal and ls -l the file to see what it's size is.
#You can use pv to monitor the progress of a large dd operation, for instance, for the remote example above, you can do:
dd if=/dev/sda | gzip -1 - | pv | ssh user@local dd of=image.gz
#Send a "SIGUSR1" signal to dd and it will print stats. Something like:
pkill -USR1 dd

#Install RaspberryPi
dd if=/dev/zero of=/dev/mmcblk0 status=progress

#Install image
df -h
fdisk -l
umount /dev/mmcblk0
dd bs=4M if=2017-11-29-raspbian-stretch.img of=/dev/mmcblk0 conv=fsync

Ni komentarjev:

Objavite komentar