January 23, 2025

iCloud drive sync, or mount, with a Linux, Ubuntu, device

Updated 2025-01-23 !

With my project to keep a MacBook Air 2011(MBA) alive, Ubuntu installed, i searched for a solution where my iCoud drive(iCD) was 
continuous synced with my MBA. This must work both ways so even a file change made on MBA should be replicated to iCD.

rclone now, 2025-01, works with iCloud !! Setup below !!

Before "rclone" was working with iCloud I solved my sync between iCD and MBA with Syncthing(ST). Check below. ST doesn't sync with iCloud so the work around here was to use my MacMini, Mac OS, as the "Middle man". It's always on and synced with iCD.

rclone
Install 
I have installed, both on a Raspberry Pi(RPi) and on Ubuntu, using command

sudo -v ; curl https://rclone.org/install.sh | sudo bash

Configuration
The configuration is described here but please note you can just use your regular password and 2FA. ADP is not supported. So issue the command below and follow the instructions

rclone config

Check install
To just verify that the rclone command works with iCloud you can use 

rclone ls iclouddrive:"Numbers/"

Of course you must have the default folder for "Numbers" still on iCloud or use another valid folder name.

Usage
sync and bisync are two variants for synchronization but you maybe want to start "small" with just a "mount" ?

"mount" needs a local folder as target so start with creating, on a RPi, 

mkdir idrive


and then the mount with command

rclone mount --vfs-cache-mode full iclouddrive:"Numbers" /home/pi/idrive

Check the mounted folder via RPi "File Manager".

There are several other subcommands that also can be used.

SyncThing
Mac OS install
Get the latest version and install in the standard app folder
To start app att login "System Settings > General > Login Items" Click the add button, +, and select the "syncthing.app".

Ubuntu install
In the terminal 

sudo apt update 
sudo apt install syncthing 

Autostart of the ST app is made with the below commands where you should change "mats_a" to your user.

mats_a@MacB:~$ sudo systemctl enable syncthing@mats_a.service
Created symlink /etc/systemd/system/multi-user.target.wants/syncthing@mats_a.service → /usr/lib/systemd/system/syncthing@.service.
mats_a@MacB:~$ sudo systemctl start syncthing@mats_a.service
mats_a@MacB:~$ sudo systemctl status syncthing@mats_a.service
● syncthing@mats_a.service - Syncthing - Open Source Continuous File Synchronization for mats_a
     Loaded: loaded (/usr/lib/systemd/system/syncthing@.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-09-14 20:03:00 CEST; 89ms ago
       Docs: man:syncthing(1)
   Main PID: 4648 (syncthing)
      Tasks: 18 (limit: 4510)
     Memory: 9.1M (peak: 9.4M)
        CPU: 75ms
     CGroup: /system.slice/system-syncthing.slice/syncthing@mats_a.service
             ├─4648 /usr/bin/syncthing serve --no-browser --no-restart --logflags=0
             └─4656 /usr/bin/syncthing serve --no-browser --no-restart --logflags=0

Sep 14 20:03:00 MacB systemd[1]: syncthing@mats_a.service: Scheduled restart job, restart counter is >
Sep 14 20:03:00 MacB systemd[1]: Started syncthing@mats_a.service - Syncthing - Open Source Continuou>
Sep 14 20:03:00 MacB syncthing[4648]: [start] INFO: syncthing v1.27.2-ds4 "Gold Grasshopper" (go1.22.>
Sep 14 20:03:00 MacB syncthing[4648]: [TP7XP] INFO: My ID: TP7XPH5-ZAH5J25-OC5KGSB-7B45XKC-S2WIP33-7E>

Setup
In both cases you will reach the ST interface at http://localhost:8384/

Here is getting started where I, on Mac OS, share the "Documents" folder to the Ubuntu device.
On the Ubuntu device set up a path to a folder where the "Documents" on the Mac OS shall sync.

Then test that the sync works both ways.

Another way ?
There is MultCloud, are there others ?, but the free version is just 5 Gb data traffic per month. 

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !