Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have always backed up my home directory to an external hard drive using the cp -r command.

Until recently, it worked fine, but now I regularly get the error message cp: cannot create regular file followed by invalid argument or cp: cannot create symbolic link followed by operation not permitted.

I've tried sudo cp -r but the issue persists. What am I doing wrong?

share|improve this question
What is the file system of the external hdd.?. –  aneeshep Mar 19 '11 at 4:09

3 Answers 3

cp -rv should at least tell you what file it's baulking out on.

The problem you're having sounds like you're copying a symlink (that is a file that just points to another) to a filesystem that doesn't support symlinks. There are three options for this:

  • Turn your backup volume into a filesystem that accepts symlinks (eg reformat it from FAT or NTFS to EXT3 or EXT4). Might be a pain depending on how much data you've got there (that you might have to juggle while you do it).

  • Just ignore symlinks and not copy them. This might break things if you try to restore as it'll be missing some files.

  • Expand out symlinks so they contain a copy of the actual data. This takes up more space.

The first would be my choice but if you need the drive for another system that doesn't support EXTx volumes, that's an issue.

Whether or not the second two are realistic options, I'd run cp with its verbose flag to see what you're dealing with. If it's a single file, perhaps a plain copy would be okay, if it's not, and it's just a junky helper, perhaps omitting it would be okay.

But as a side note, most people seem to prefer using rsync to do backups. It has a whole lot of options that make it perfect for the job. You can read a version of its manpage here. It has various options (as outlined above) on how to handle symlinks.

share|improve this answer

See your dmesg. Usual problem is either filesystem problem or failing hard disk (and therefore filesystem problem).

You can umounting external disk and then running fsck. For example

umount /dev/sdb1
fsck -f /dev/sdb1
share|improve this answer

I just ran into the same problem (actually on Cent OS via VirtualBox) and the problem was permissions related. I had a shared directory with my local machine (a Mac on OSX Mavericks), attempted a cp and it balked on Protocol error. In my local machine I changed the owner of the directory to the regular user (me) (from root) and the group to something more generic than wheel. So, turned out to be a basic permissions problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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