From rud0lf, 2 Weeks ago, written in Bash.
  1. # hello! I'd like to port raspberry pi /root partition from one usb disk (sdp) to another (sdq); I know about fstab
  2. # I don't do it daily so.. I'd like to know if I do everything correctly (to preserve permissions and ownership).
  3. # Tell me if something more is needed or if some operations are uneccessary:
  4.  
  5. sudo mkdir /mnt/orig
  6. sudo chmod 777 /mnt/orig
  7. sudo mount /dev/sdp1 /mnt/orig
  8.  
  9. sudo mkdir /mnt/target
  10. sudo chmod 777 /mnt/target
  11. sudo mount /dev/sdq1 /mnt/target
  12.  
  13. sudo rsync -axv /mnt/orig /mnt/target
  14.  
  15. sudo sync
  16.  
  17. sudo umount /mnt/orig
  18. sudo umount /mnt/target
  19.  
  20. # disconnecting both usb disks now
captcha