I've transferred my files (just text files, jpegs, movies) from my old windows pc to my just-purchased stand-alone Linux laptop (s/h Dell Linux Mint 17.1). To back up these files to usb, the Backup Tool has two problems:

  • (1) the Tool doesn't remove files from the usb that I've removed from the laptop, which means going through the usb to delete them,
  • (2) the Tool needs to be set up each time I want to make a backup, which is annoying.

I'm only a couple of weeks into understanding Linux. I've written the following script, quickly run from Terminal:

rsync -arh --quiet --delete ~/ /media/my-laptop/my-usb

I suspect something is wrong with this. All seems to work more or less okay (i.e. the usb after each run of the script has an exact copy of what's on the hard disk), but (using ctrl h) I see that the hidden files are being copied as well, and generating a lot of error messages in the process such as:

rsync : mkstemp “media/my-pc/my-usm/.local/share/Trash/files/. …...” failed : Invalid argument (22). 

rsync : symlink “media/my-pc/my-usm/.local/share/Trash/files/….”  →  “….”  failed : Operation not permitted (1). 

Will a simple amendment to my 2-line #! script above allow me to back up my files, and just my files, without the hidden files and associated error messages?


Rather than trying to avoid backing up your dot files, it's worth looking at the reason why the backup of these files is failing.

It seems that your backup target is probably a FAT filesystem. This cannot handle all the metadata associated with your files (ownerships, permissions, etc) so you are not making a "true" copy of your data.

One option here is to reformat the device as an ext4 filesystem and backp to that. You can get FOSS drivers for Windows that read ext4 filesystems so it's not like you're siloing your data.

If you are going to reformat the USB device, check and double check that you're about to format the correct device. It's painfully difficult to recover your root filesystem if you've erased it.

I'd expect it to be something like /dev/sdb1 but NOT /dev/sda*. You can probably determine the device with the command mount | grep /media but ensure that the device name IS NOT the same as obtained from mount | grep '/$'. If in doubt, update your question with the full result of the mount command.

Another option is to use an incremental backup tool such as duplicity.


If you do not want to include "hidden" files, you can tell rsync to ignore those with:


So, given your example, it would be something like:

rsync -arh --quiet --exclude=".*" --delete ~/ /media/my-laptop/my-usb

Edit: Beware however, that this approach means you will not backup any of your configuration files (the ”hidden” ones that start with a leading . in the filename).

  • That's technically a correct answer to the question as asked, but it's a bad idea. This will omit some important files from the backup, such as the user's configuration files, anything in their browser profile, their email archives in many GUI mail clients, etc. – Gilles 'SO- stop being evil' Oct 12 '16 at 21:59
  • @Gilles Yes, I agree. The ”hidden” files are often the most important. – maulinglawns Oct 13 '16 at 6:25
  • @Gilles The question was specific about excluding the hidden files, but whether or not it is a bad idea, I find it wrong to downvote a correct answer, a comment ought to be enough. There may be several situations where inclusion of hidden files can actually be dangerous! For example, if you have already set up your environment on the target machine, then read back the hidden files from an older, or very different host. This could really cause disaster! – Rein Oct 13 '16 at 13:45
  • I think I need to distinguish between two tasks. One task is to create a back of files (self-created texts, pics, movies) that I can access from any computer I come across. For this a FAT usb and --exclude=".*" would seem to be what is required. The other task is for a backup of the system itself in the event of a crash. Can you point me in the right direction for information on this. It's a standalone machine with Linux Mint 17.1. – Martin Oct 14 '16 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.