How to back up an optimized iCloud Photos Library
It is so easy to make mistakes when using the Photos.app and accidentally to delete photos that are important for us. Or the Photos Library may become damaged beyond repair and will not work any longer. So we need to keep regular backups.
Time Machine or cloning software are the most convenient way to have an automatic backup of our Mac, running silently in the background. (Back up the library in Photos on Mac - Apple Support)
This is nice and easy, as long as we are not using iCloud Photos and "Optimize Mac Storage". If we are not careful, we may not have any backup of our photos at all, once the Mac is syncing with iCloud and the "Optimize" procedure is removing original image files from the Mac and keeping them only in iCloud. Neither Time Machine nor Cloning Software will include the originals, that are only in iCloud and no longer mirrored on our Mac. If we accidentally deleted photos from our Photos Library, the photos will also have been deleted from iCloud. Restoring this library from Time Machine or an older clone will not help, if the missing photos have only been in iCloud. We cannot recover them from a backup copy of the optimized library. Even if we recover the missing photos from a backup of our original files, the photos will not appear in the albums, where they used to be and the adjustments and metadata will be missing.
Step 1: Create a full local copy of our iCloud Photos Library using a second user account
We need a full backup copy of the Photos Library, including all original image files. As a first precaution, we should keep an archive of all original image files on an external volume. This will be very useful in Photos 5.0 on Catalina or later anyway, because Photos 5.0 and later are renaming the original image files on import. The library does no longer save the original image files like we imported them (How Photos 5.0 on Catalina Manages original image files - Apple Community).
But to backup our work with photos - the metadata, albums, folders, adjustments, we need a copy of the complete library. Therefore, we need to download a second version of the Photos Library to an external volume, with the "Optimize Storage" option disabled. And we have to update this backup copy regularly. However, it is not feasible to switch between two different iCloud Photos Libraries and keep them in sync with iCloud. Each user can only have one iCloud Photos Library. If we switch iCloud syncing to another library, Photos will upload the complete library again into iCloud. This may take more than a week, even for a moderately sized library of 50000 photos or so. We cannot do this on a daily basis for a backup.
We need a second user account to have an additional Photos Library, that will sync with our iCloud Photos Library non-optimized and download the full library to an external volume. We can have different iCloud Photo Libraries in each user account. How to create a second user account is described here: How to test an issue in another user account on your Mac - Apple Support (Internet Archive Version)
In this second user account we can also use Time Machine or cloning software to backup the full copy of our iCloud Photos Library, so we will have a history. But even so, it will be a lot of trouble to make backups of the Photos Library.
The easy way out is to avoid the Optimize Storage option for iCloud Photos.
Step 2: Set up Time Machine to have a backup history
Using the second user account to sync with iCloud Photos is only half the task: It will give automatically download our Photos Library to an external drive with enough free storage to hold the complete Photos Library including the originals and keep it updated and in sync with iCloud.
But what is missing is the backup history. Our copy is just saving the current stage. We need a way to revert to a previous version to protect us in case we should make a bad mistake and accidentally erase important images or videos or accidentally batch change the metadata of thousands of items. The local copy of our iCloud Photos Library does not include the items we recently deleted or the previous versions of the items we modified. It will just give us access to our photos, if we are offline.
To be able to recover from mistakes we need Time Machine or another archival backup. So the next step is to include the external drive with the full local copy of the iCloud Photos Library in our regular Time Machine backup of the Mac (Back up the library in Photos on Mac - Apple Support) . Now we can recover older versions of our Photos Library and recover accidentally deleted items. It is recommended to use a Time Machine volume that is large enough to hold a long history.
First version (December 2, 2019)