How to copy files safely in Fedora with BTRFS

I am trying to workout why this command doesnt work

[solomon@fedora ~]$ cd Documents
[solomon@fedora Documents]$ pwd
/home/solomon/Documents
[solomon@fedora Documents]$ ls
 Business   Personal   Tax.20220126  'Typora '
 Keepass    Tax       'To Do'         Zoom
[solomon@fedora Documents]$ rsync -P /home/solomon/Documents/Tax /run/media/solomon/3TB WD Red/backup
skipping directory Tax
rsync: [sender] link_stat "/run/media/solomon/3TB" failed: No such file or directory (2)
rsync: [sender] link_stat "/home/solomon/Documents/WD" failed: No such file or directory (2)
rsync: [Receiver] change_dir#3 "/home/solomon/Documents/Red" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(822) [Receiver=3.2.3]
[solomon@fedora Documents]$ 

I have checked the mount point and its correct

[solomon@fedora Documents]$ lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda                 8:0    0 232.9G  0 disk  
└─sda1              8:1    0 232.9G  0 part  
sdb                 8:16   0   2.7T  0 disk  
└─sdb1              8:17   0   2.7T  0 part  /run/media/solomon/3TB WD Red
sdc                 8:32   0 223.6G  0 disk  
├─sdc1              8:33   0   600M  0 part  /boot/efi
├─sdc2              8:34   0     1G  0 part  /boot
└─sdc3              8:35   0   222G  0 part  
  └─luks-2aafcb54-d261-46b8-8423-2ccc7ddc45cb
                  253:0    0   222G  0 crypt /home
                                             /
sdd                 8:48   1     0B  0 disk  
sr0                11:0    1  1024M  0 rom   
zram0             252:0    0     8G  0 disk  [SWAP]
[solomon@fedora Documents]$ 

1 Like

The spaces again. You need to escape them.

1 Like

sorry I grew up on MSDOS and IBM PCDOS, I need to do a short course on BASH

[solomon@fedora Documents]$ rsync -P /home/solomon/Documents/Tax /run/media/solomon/3TB\ WD\ Red/backup
skipping directory Tax
[solomon@fedora Documents]$ 

I get this output,

1 Like

Of course, because you only used rsync -P. That isn’t going to include anything.

Try what I recommended above. rsync -avhW

2 Likes

Okay I was following the instructions here

However as expected rsync -avhW /home/solomon/Documents/Tax /run/media/solomon/3TB\ WD\ Red/backup sending incremental file list

worked! I am very happy thanks a lot. Now I can test larger document directories with this.

sent 82.13M bytes  received 5.45K bytes  54.76M bytes/sec
total size is 82.08M  speedup is 1.00
[solomon@fedora Documents]$ 

There it is…magic. no snapshots! Just files…thanks for your patience

[solomon@fedora 3TB WD Red]$ cd backup
[solomon@fedora backup]$ ls
Tax
[solomon@fedora backup]$ 

3 Likes

To avoid the problems you noted with the spaces it seems always a good practice to NOT use spaces in file or directory names. You also should also avoid any other special characters that the shell interprets as other than literal.

I noted that in the post above you even have a directory name that ends in a whitespace character 'Typora ' which would make it difficult to understand why a command such as rsync -av Typora <destination> would not work.

4 Likes

Yes your right I’ll take that onboard from now on that a better way to file docs thanks for the tip. Interesting though I didn’t specify those quotation dashes on the typora folder, in bash that symbolises something I believe

1 Like

Any time you use ‘ls’, the output of file & directory names containing white space or other non-printable characters will be automatically quoted. Thus you can easily see those file names that require special handling for other commands.

Those of us that have been using linux and other unix like systems for 20+ years are very aware of these issues. Those coming from windows have been spoiled by the relaxed way that windows has for file names with white space and are not habitually trained to avoid the white spaces. The bash shell sees a white space as a word separator and the code below will fail with file names containing spaces.

for file in *.mpeg ; do
mv $file $file.mpg
done

This shows it clearly

$ touch file1.mpeg 'file 2.mpeg'
$ ls
 file1.mpeg  'file 2.mpeg'
$ for file in *.mpeg; do mv $file $file.mpg; done
mv: target '2.mpeg.mpg' is not a directory
$ ls
 file1.mpeg.mpg  'file 2.mpeg'
6 Likes

I’m embarrassed to ask but it there a recommended literature in the Fedora documentation or somewhere I can learn the proper syntax’s for BASH. I know this is assumed knowledge so its probably better to do a short course perhaps

You don’t Fedora-specific documentation on bash.

Any of the bash tutorials out there should work.

1 Like

Even with a bit of experience I use this. It covers everyone, from the novice through the expert, and is an excellent reference for us all to have on our bookshelf.
https://tldp.org/LDP/abs/html/

This is fantastic thanks,

1 Like