How to Auto Backup Files to USB Media When Connected

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

8 Responses

  1. tastym says:

    rsync SOURCE DESTINATION while you are trying to do rsync DESTINATION SOURCE which might completely mess up the user directories if they follow your guide.

    Your bash script simply won’t work on default setup without direct fstab modifications for specific usb devices.
    Device vendor ID is not permanent across udev sessions and it will be changed!

  2. Richard Steven Hack says:

    I just use fwbackups. I define backup jobs for each of my four data partitions and /home, set the times to backup in the fwbackups GUI, mount the drives and go to bed. Runs nicely every night.

    Who needs the command line and scripts? Fwbackups does incremental backups nicely and the only time it fails is if the target disk is out of space for some reason (or a file to be backed up has the wrong permissions.)

  3. Harald Dunkel says:

    If I got this right, then all your disks with vendor ID 125f will be overwritten with a backup, as soon as you plug them in. To avoid accidentally losing data, wouldn’t it be reasonable to check for a file system UID or some other unique string, besides the common vendor ID?

  4. p6ril says:

    Nice post, but I think I spotted a few errors. In the rule the line RUN+="/bin/" refers to a script named while in the rest of the post the script is called

    In the script itself, the rsync command refers to $MOUNT_LOC while it’s actually $MOUNT_POINT that is declared. Finally it would be nice to have some explanation about SYMLINK in the rule (especially the %n part which isn’t obvious). Besides these details, excellent use case. Thanks.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.