Skip to content

Latest commit

 

History

History
89 lines (77 loc) · 6.19 KB

README.md

File metadata and controls

89 lines (77 loc) · 6.19 KB

RbuWSL: Rsync backup using Windows Subsystem for Linux

README is pending. More coming soon.

Introduction

RbuWSL's script will backup your desired data on Windows 10 to an external drive using rsync. Rsync allows differential backup of data allowing only new/modified files to be transferred. On Windows 10, use of rsync can be achieved using Ubuntu (Bash) through Windows Subsystem for Linux (WSL).

Motivation

I needed a faster method to quickly backup all my files on Windows to an external drive. Copying/pasting my users files took too long because non-modified files would be transferred also. With 500GB+ worth of data, this was not a feasible option. I found rsync as a solution. Rsync allows you to transfer files from source to destination quickly by only transferring new and modified files. I created RbuWSL for my own personal use so I can quickly automate the backup process to an external drive using rsync.

Disclaimer

Use at your own risk. The author, maintainers, and contributors of this script are not responsible for any loss and corruption this script may cause to your files, system, and the drive you are backing up to. Make sure to read the README properly before using this script.

  • Only use this script on Windows with WSL
  • Do NOT use this script with Cygwin, MinGW, Git Bash, etc.. You may run into permission related issues.

License

Coming soon

Usage

How to run

  1. Edit the constants in this script and tailor for your backup needs. All constants can be found in the CONSTANTS section of the script.
  2. Run Ubuntu (bash) on Windows 10. (Win+R) Run >> ubuntu.exe
  3. Navigate to location of this script. Example: cd /mnt/c/Users/Username/Downloads/RbuWSL
  4. Run the script by typing the command: ./RbuWSL.sh

Requirements

Suggestions

  • Modify the constants in this script so you do NOT have to type the settings every time you backup.
  • Use the rsync option -avhP --stats --delete for basic use.
    • These options will duplicate your source backup files onto the destination drive. The --delete option will be ensure to delete the files in the destination drive that no longer exist your source files.
  • Use the option --no-p --chmod=ugo=rwX to ensure no ACL permission issues occur.
    • This is NOT really needed when using Ubuntu/Bash WSL on Windows.
    • I use this option because I am paranoid of getting unaccessible files/folders due to ACL permission issues I had in the past when using rsync with Cygwin. Refer to https://superuser.com/a/1184342/607501 for more details.

Example

Assume your name is John and when you connect your external drive to Windows PC, it shows up as drive G, and you want to backup the following folders: Pictures, My Music, and Downloads to the JohnBackup folder in the root of your external drive. Then you would modify the CONSTANTS in the RbuWSL.sh file to as shown below.

DESTINATION_DRIVE_LETTER="G" DESTINATION_BACKUP_PATH="JohnBackup" SOURCE_WINDOWS_USERNAME="John" SOURCE_BACKUP_PATH="" declare -a SOURCE_BACKUP_PATH_FOLDERS=( "Pictures" "My Music" "Downloads" )

TODO

Known Issues

  • None yet

Personal references

Links below are my personal references I read while writing this script. I am listing them in the README as my own personal bookmarks in case I need to refer to them in the future.

WSL Documentations

Bash syntax

ACL Permissions Troubleshooting