Score:0

Backup files : log for keeping track of successfully copied files and errors

cn flag

I am using Ubuntu 20.04 and I want to fresh install Ubuntu 22.04.

I have one partition and I want to copy the files that I have on my laptop on an external ssd.

While copying some files, I encountered some errors (e.g. error copying files, invalid characters (more than >20k files and I don't want to rename them manually or using regex, etc.))

Is there a way to keep a log regarding the files that are copied (successfully or not) ? I want to be able to verify the files that are copied, but have a log with the files that couldn't be copied (skipped)* as well as the error type ?

*Or at least the name of the file (even 0kB) so I can go back and check later on ?

Thank you in advance.

Marco avatar
br flag
How do you do the copy ? drag&drop or command line? if command line, please add the exact command to the question.
waltinator avatar
it flag
What's the filesystem on the target disk? Do: `sudo lsblk --fs` to see. Older (from a design view) filesystems have severe limits on file names, sizes, number of files, etc. Could you `umount` it and use `gparted` to format it as `ext4`?
waltinator avatar
it flag
To get around target filesystem limits, use `tar` to bundle the files e.g. ` sudo tar -cvf /targetdisk/home.tar /home`. Read `man tar`.
Marrluxia avatar
cn flag
@Marco I've tried both. Copying manually and ```cp -a /source/. /dest/```
Marrluxia avatar
cn flag
@waltinator it's ntfs, surprisingly the disk in which the files are saved is formatted as vfat (1% /boot/efi) and ext4 (88%). How does that affect the copying process ?
Marco avatar
br flag
Usually external storage is formatted with "vfat" from the vendor, because nearly all OS can read "vfat" (or "FAT32" in windows terminology). As "vfat" has not all features which POSIX filesystems (linux) have, it is totally normal to get problems while you copy files from linux to "vfat". Example: "vfat" does not have filesystem permissions, "vfat" does not know of symbolic links, etc. The vfat driver tells your `cp` command "error: I can not do what you want me to do". And it is perfectly okay to show an error to the user, who has to decide, what to do.
Score:0
cn flag

rsync -av /path/to/copyfrom/ --log-file=foo.log produced exactly the expected output.
Afterwards, wrote a small script to extract the total number of files copied/not copied + the errors and the path of the files that could not be copied.

The "destination" ssd was formatted as ntfs which created some errors due to permitted characters etc. Once the ssd was formatted as ext4 (I don't mind ext4 "limitation" with Windows) everything was fine.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.