Wednesday, August 30, 2017

mac use ssh to clone harddisk from remote server to local usb harddisk

  1. plug the harddisk to mac
  2. use Terminal
  3. use "diskutil list" to find the new harddisk
  4. use "diskutil unmount /dev/diskX "
  5. mac "ssh -l user yourserver.com" to set sudo dd without password (omitted)
  6. mac "sudo" to enter password for dd
  7. ssh -l user yourserver.com "sudo /bin/dd if=/dev/sda" | dd of=/dev/disk2 
  8. Rest and wait



To monitor dd progress, Command + T to open new terminal tab
 
-While dd is executing, run this in another terminal:
while pgrep ^dd; do sudo pkill -INFO dd; sleep 1; done
 
It prints the dd status every 1 second in the original terminal window where dd is executing, and quits when the command is done. 

No comments: