My Ubuntu doesn't boot. I was able to boot from liveCD and connect an external hard drive. I want to backup my files. I tried cp -r /home destination, but I get problem with spaces in filenames, symlinks, errors "Cannon create fifo: Operation not permitted" "Permission denied" "Invalid argument" and plenty more. What is the best way to do it? Will cp -a fix these issues or should I do something more clever?

EDIT: Also in live mode I didn't have permission to view one folder in my home directory. I run sudo nautilus to view it.


So far I found out that using rsync doesn't have problems with filenames. But it doesn't copy .so and .a files. Also it is running extremely slow comparing to cp.


Give this command a try:

cp -ar /source/dir/. /destination/dir/

The -a option is an improved recursive option, it preserves all file attributes, and also preserve symlinks.

the r in -ar is an option to copy files/directories recursively, it is required for copying folders within the folder where your files are located.

The . at end of the source path is cp syntax that allows you to copy all files and folders, included hidden ones.

Since the -a option preserves file attributes, you will need to use sudo to view them or or run this command. (change user and group names)

sudo chown -r user:group /directory/of/file/backups

The above command will make you the owner of the backed up files.

|improve this answer|||||
  • thanks for the answer. I was told, the problem is that external hard has a different file system, this is why not all properties and things can be represented. – Noidea Sep 12 '16 at 17:53
  • @Noidea as far as I know, if Ubuntu live can see and access the data on the drive, it should be able to be copied with all of the permissions and properties intact. On another note, if you do use the cp command, use it with sudo in front. – user34716 Sep 12 '16 at 22:57

It turns out it is not the command, which is a problem. The commands posted by user34716 are correct. One has to use cp -ar to preserve attributes and symlinks.

However, the problem is that these attributes cannot be represented in all file systems. So if disk is not ext4 formatted, it is better to create archive. For liveCD the command will be:

tar -c -z -f /my/backup/disk/home.tar.gz -C / media/ubuntu/deviceName/home
|improve this answer|||||

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.