geerlingguy / rpi-clone

A shell script to clone a booted disk on a Raspberry Pi.
https://rpi-clone.jeffgeerling.com/
BSD 3-Clause "New" or "Revised" License
172 stars 10 forks source link

Do not sync owner/group for FAT filesystems #20

Open matthijskooijman opened 3 months ago

matthijskooijman commented 3 months ago

This can potentially cause rsync error messages, especially if the filesystem is already mounted with a uid= option (which will not be copied to the destination mount, leading to different owners and thus rsync trying and failing to fix the owner).

This commit was previously submitted as part of https://github.com/billw2/rpi-clone/pull/140 (but really unrelated to the core of that PR, so I'm submitting it separately here now) and have been in use in my project since that PR was submitted two years ago. Now I've just rebased and reviewed them, the changes still applied without issue.

matthijskooijman commented 2 months ago

Prompted by @framps' suggestion of adding more comments inline, I've added clarification of the FAT-specific rsync options in a comment, and also restuctured the code to not have two complete lists of rsync options (one for FAT and one for the rest), which are hard to read and prone to getting out of sync. Now, for FAT filesystems, the --no-owner and --no-goup options are added to the default options, which is a lot easier to read and more robust.

I have not been able to test this yet, so I'm marking this as draft until I did.