After backuping with 'rsync --archive --update' my home directory from ext4 to btrfs, rsync reports errors like this:

rsync: readdir("/mnt/backup/home/me/.mozilla/firefox/qbdcaxwe.default/sessions/????????? ??????"): Not a directory (20)                
rsync: rename "/mnt/backup/home/me/.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN" ->                           
+"home/me/.mutt/cache/bodies/imaps:myemaill@imap.gmail.com/INBOX/3-13228": Not a directory (20) 

When I try to delete these items with 'rm' - there is an error message, that this item is a directory. But 'rm -d' fails with a message "cannot remove ...: No such file or directory.". 'btrfs check' and 'btrfs scrub' haven't found any filesystem errors.

Here is the output for 'file', 'rm' and 'rmdir' commands:

$ file /.../.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN
/.../.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN: SMTP mail, Non-ISO extended-ASCII text, with very long lines
$ rm /.../.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN
rm: remove regular file ‘/.../.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN’? y
rm: cannot remove ‘/.../.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN’: Not a directory
$ rmdir /.../.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN
rmdir: failed to remove ‘/.../.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN’: Not a directory

How such filesystem items can be removed?

| |

Backing up a user's homedir can have problems if executed by the user while having apps running since apps can hold files open and/or add/remove files and dirs and interfering with the backup process.

Much better (if possible) is to create the backup as root while the user is logged out.

Alternatively try to minimize the number of apps you're running while doing the backup (exit the GUI and execute the rsync cmd from a commandline terminal).

Finally - some apps use special chars in their file/dir names which may confuse various utilities. For these you need to keep track of the occurences (best to redirect the output to a file) and handle them manually, using alternative solutions (escaping of the chars, use of TAB key to autocomplete file/dir names or even other copy utilities) as needed.

| |

If you are using btrfs why not take advantage of its features?

take a snapshot:

sudo btrfs sub snap /home/me /home/me/.$(date +%Y-%m-%d_%H%M%S)_snapshot

rsync the old backup into the snapshot rather than the live data:

rsync --archive --update /mnt/backup/home/me/ /home/me/$(sudo btrfs subvolume list -c /home/me|tail -n1|awk '{print $NF}')/

(I mostly use rsync -mauvPAX from/ to/ # but you might not need all of that.)

Now that you have btrfs you can backup the snapshot rather than the live data, and that should help avoid this problem.

| |

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.