chuggerguy

backupmasterdrive

Feb 26th, 2025 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | Software | 0 0
  1. #!/bin/bash
  2.  
  3. if [ "$(id -u)" != "0" ]; then
  4.   exec sudo "$0" "$@"
  5. fi
  6.  
  7. backuplocation="/home/chugger/bigmedia/macrium reflect/acer2/linux"
  8. backupname="/home/chugger/bigmedia/macrium reflect/acer2/linux/`hostname`_linux_backup_`date '+%Y-%m-%d'`_.img.gz"
  9. user=$SUDO_USER
  10.  
  11.  
  12. bash -c "dd status=progress if=/dev/nvme1n1 | gzip > \"$backupname\" ; chown $user:$user \"$backupname\""
  13.  
  14.  
  15. # to restore... something like this:
  16. # gzip -d -c {backup.img.gz} | dd status=progress of={where}
  17.  
  18.  
  19.  
Advertisement
Add Comment
Please, Sign In to add comment