Sample Header Ad - 728x90

Ask Different (Apple)

Q&A for power users of Apple hardware and software

Latest Questions

-1 votes
1 answers
46 views
Halfway to disaster? How to Protect iCloud Drive contents after deleting files from local copy with multiple OS installs
1. How can I protect iCloud Drive contents when deleting files from a mac ***with multiple OS installs***, i.e. from a offline local copy? I have multiple macOS installs on my Mac. I think, some time ago, without thinking through the consequences 'till now, I may have deleted "extra copies" of some...
1. How can I protect iCloud Drive contents when deleting files from a mac ***with multiple OS installs***, i.e. from a offline local copy? I have multiple macOS installs on my Mac. I think, some time ago, without thinking through the consequences 'till now, I may have deleted "extra copies" of some large files from iCloud Drive in one of the offline installs - but **not** the main one that is currently booted. I'm thinking that if I log into the copy of macOS with the "extra copies", the mac will sync with iCloud, and thereby **delete the files from iCloud (the cloud copy)**. **2. Correct?** (And I presume later, when I log into my main OS, it will delete them from that install's local copy too - assuming there even is a locally cached copy. **3. Correct?**) 4. Assuming I've already done this - deleted "extra copies" from an offline copy of the OS - how can I prevent losing the other copies? Way to detect that I've done this? I presume there are a few ways to do this, wondering what the best are. I suppose I could delete and never use the other OS installs, but I'm looking for a less brute-force option. 5. Is there a way to tell the OS not to trust the local cache? I guess this is a variation of the issue where people delete photos from devices sync'd with iCloud, ignoring the warning of the consequences (the warning). But on MacOS, there's no such warning - it's presumed the user knows what they're doing. I may have been smart enough to turn off iCloud Drive while logged in to the other OS before deleting stuff, but I'm not sure. That would have been the smart thing to do. Note: I have NOT activated iCloud Drive for "Desktop & Documents" on any of the installs. I have for everything else.
WHO'sNoToOldRx4Covid-CENSORED (1316 rep)
Jun 1, 2025, 04:31 PM • Last activity: Jun 1, 2025, 11:25 PM
28 votes
7 answers
38982 views
Using rsync to backup
I currently back up the contents of an external hard drive A by (1) deleting everything in the destination external hard drive B and (2) copying everything from A to B (in Finder). The external hard drive only contains “basic data” (folders, images, videos, documents, etc.), nothing fancy/weird. But...
I currently back up the contents of an external hard drive A by (1) deleting everything in the destination external hard drive B and (2) copying everything from A to B (in Finder). The external hard drive only contains “basic data” (folders, images, videos, documents, etc.), nothing fancy/weird. But with all the amazing free tools that exist out there I couldn't find a decent one to backup (suggestions accepted). I want to automize this. After a few searches, it seems I can use rsync. I want then to automize this by using rsync to avoid copying files that are already on the destination hard drive (of course, if a change has been made, I want to update the file/folder; the same with deleted files/folders or new files/folders; the idea is to mimic what I usually do manually with Finder). I got to this point rsync -av --progress --delete /Volumes/A/ /Volumes/B Now the log is full of files which name starts with . or ._ or even ._.. Are they necessary? ## Question How can I copy only the files that matter, leaving all those that don't matter behind. For example, if I have photo.png I would expect to copy photo.png, not ._photo.png or many files. What --exclude or --exclude-from can be used safely on a Mac? May be a good rule is “just copy anything that Finder shows” which is what I would copy if I passed manually through all folders. ##  Extra question Is -av --progress --delete enough? Am I committing a crime or risking some data? What options would you use. *Please, back your answer with some arguments, I would appreciate it.* I'm looking for a way to automate rsync which seems quite powerful and free to use.
Manuel (690 rep)
Jan 24, 2016, 11:37 AM • Last activity: Jun 1, 2025, 05:34 PM
5 votes
5 answers
1971 views
Shell scripts that call rsync no longer work in macOS Sequoia?
I updated a MacPro from Ventura to Sequoia and now the `rsync` command have problems when wrapped in a script. Here's a minimalist `myrsync.sh` to reproduce the observed behaviour: ```sh #!/bin/sh rsync "$@" ``` **remark:** You can use `bash` or `zsh` instead of `sh` --- When I call that script with...
I updated a MacPro from Ventura to Sequoia and now the rsync command have problems when wrapped in a script. Here's a minimalist myrsync.sh to reproduce the observed behaviour:
#!/bin/sh
rsync "$@"
**remark:** You can use bash or zsh instead of sh --- When I call that script with:
./myrsync.sh -av user@remote:tmp .
It doesn't ask for the password and hangs indefinitely. It can't even be terminated with a Ctrl-C, I have to forcefully kill -9 it. --- What's even more confusing is that when I run rsync directly:
rsync -av user@remote:tmp .
It works as expected. --- How can I fix this?
Fravadona (231 rep)
Mar 28, 2025, 11:14 AM • Last activity: Apr 22, 2025, 11:14 PM
-1 votes
1 answers
130 views
Why does rsync --delete-after work but rsync --delete does not?
I have encountered a situation in `rsync` where `--delete` does not work *but* ``--delete-after`` seemingly does. See the screen shot below that shows the two commands one right after the other. Deleting `test.txt` is the expected result that only works with `--delete-after`. (And for some reason it...
I have encountered a situation in rsync where --delete does not work *but* `--delete-after` seemingly does. See the screen shot below that shows the two commands one right after the other. Deleting test.txt is the expected result that only works with --delete-after. (And for some reason it's not working today but has worked fine before.) Is this an rsync issue specific to the Mac? This is on Sequoia 15.1 using rsync version 2.6.9.
sh
sent 319 bytes received 26 bytes 230 bytes/sec
total size is 6279 speedup is 18.20
[redacted] rsync -avn --delete test.directory/ test.2.directory/
Transfer starting: 7 files

sent 319 bytes received 26 bytes 230 bytes/sec
total size is 6279 speedup is 18.20
[redacted] rsync -avn --delete-after test.directory/ test.2.directory/
building file list ... done
deleting test.txt
Terminal.app screen shot showing rsync output **Update to initial post with answer** Here's an example (with help from ChatGPT) that provides an example: mkdir -p test/source test/dest touch test/source/file1 touch test/dest/file1 test/dest/file2 # file2 should be deleted with --delete rsync -av --delete test/source/ test/dest/ This does delete file2, as intended. The issue is that there isn't any "verbose" output indicating that file2 is being deleted, even though -v is being used. Interestingly when you use --delete-after, it does show that file2 is being deleted. The solution is to use the -i flag and this does show file2 being deleted more explicitly. Without -i: rsync -av --delete test/source/ test/dest/ Transfer starting: 2 files In contrast with -i rsync -avi --delete test/source/ test/dest/ building file list ... done *deleting file2 .d..t.... ./ So the question becomes: why does -v work the way I expect it to with --delete-after but not with -delete. Is this related to Sequoia using a different version of rsync? See also https://apple.stackexchange.com/questions/479291/shell-scripts-that-call-rsync-no-longer-work-in-macos-sequoia
andrewj (149 rep)
Apr 5, 2025, 11:47 AM • Last activity: Apr 18, 2025, 04:06 PM
2 votes
0 answers
62 views
How to copy files from remote server to external HD without using local disk
I am trying to copy files to an external HD on macOS Sequoia The remote server (WebDAV) mounted via Finder -> Go -> Connect The problem is that using sync, the local Machintosh HD runs out of space during the copy. - I tried to avoid caching or setting tmp folders to the external HD, but whatever I...
I am trying to copy files to an external HD on macOS Sequoia The remote server (WebDAV) mounted via Finder -> Go -> Connect The problem is that using sync, the local Machintosh HD runs out of space during the copy. - I tried to avoid caching or setting tmp folders to the external HD, but whatever I do, the space available on the local HD keeps going down during the copy. - The local HD went from 20GB free to 0.5GB during the file transfer, till all stopped because of it. This is an example of the rsync command I use and my shell is zsh: rsync -hvrPt --temp-dir=/Volumes/USB_DRIVE/tmp --max-size=1000M --no-partial /Volumes/dgk.data.uu.nl/research-***/***/***/*.fast5 /Volumes/USB_DRIVE/fast5_pass --temp-dir --max-size and --no-partial were used to avoid clogging my local HD during the transfer, but it didn't work. How can I transfer 500GB from a remote server to a USB drive without using the local HD space (only 20GB free)???
alec_djinn (211 rep)
Mar 27, 2025, 09:05 AM • Last activity: Apr 1, 2025, 06:22 PM
0 votes
1 answers
59 views
How can I debug an AppleScript failure after moving to a new Mac running Sequoia?
Id like help to figure out why this script fails to work now that I my moved my system from a 2012 Mac mini running Catalina to new M4 mini. I use 2 external HD's for storing iTunes and movie data and try to save the log file to an external SSD (used to be my boot drive on old Mac mini). AppleScript...
Id like help to figure out why this script fails to work now that I my moved my system from a 2012 Mac mini running Catalina to new M4 mini. I use 2 external HD's for storing iTunes and movie data and try to save the log file to an external SSD (used to be my boot drive on old Mac mini). AppleScript seems to compile properly - misleading - and when run the error pops up. I am running Script editor from the current boot drive and presume it runs rsync from the boot drive as well. Here is the script....
set source to "'/Volumes/Media Main/'"

set destFolder to "'/Volumes/Media Backup'"

do shell script  "/Volumes/'Macintosh HD'/usr/bin/rsync -av --delete --exclude=.* -i --log-file=/Volumes/'Macintosh SSD 1TB'/Users/bill/Desktop/AppleScriptLog/MediaBackup.txt"  & (quoted form of source) & " " & (quoted form of destFolder) 


tell application "TextEdit"
	open file "/Volumes/'Macintosh SSD 1TB'/Users/bill/Documents:/Done.txt"
end tell
The error is as follows Result: error "rsync: failed to open log-file /Volumes/Macintosh SSD 1TB/Users/bill/Desktop/AppleScriptLog/MediaBackup.txt'/Volumes/Media Main/': No such file or directory (2) rsync: link_stat \"/'/Volumes/Media Backup'\" failed: No such file or directory (2) rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/5bb93434-bef0-11ef-bef2-d285688f7a47/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]" number 23
Bill (23 rep)
Mar 23, 2025, 06:05 PM • Last activity: Mar 23, 2025, 08:01 PM
0 votes
1 answers
112 views
How to rsync the data volume
I want to make a full backup of my Macintosh HD - Data volume which is running MacOS 12. The backup needs to be an exact as is replica so needs all existing attributes, permissions, ACLs etc. What is the best Rsync command to use? Simply running the command below doesn’t give me an exact replica: rs...
I want to make a full backup of my Macintosh HD - Data volume which is running MacOS 12. The backup needs to be an exact as is replica so needs all existing attributes, permissions, ACLs etc. What is the best Rsync command to use? Simply running the command below doesn’t give me an exact replica: rsync -av / /Volumes/externalhdd
M9A (141 rep)
Mar 12, 2025, 04:26 AM • Last activity: Mar 14, 2025, 02:20 AM
6 votes
1 answers
984 views
Shell script run daily by launchd stopped working after macOS Sequoia upgrade
I have a setup to copy backups from an Ubuntu 22 server running in the cloud to a local Mac. On the Mac I have a shell script to run the rsync command and a launchd daemon to run this script daily. This has been working as expected until macOS was upgraded to Sequoia, after which it stopped working....
I have a setup to copy backups from an Ubuntu 22 server running in the cloud to a local Mac. On the Mac I have a shell script to run the rsync command and a launchd daemon to run this script daily. This has been working as expected until macOS was upgraded to Sequoia, after which it stopped working. The shell script works as expected when run manually with sudo in Terminal, but fails without sudo. I suspect this is a hint, although I can't figure out why it worked prior to Sequoia, or what I should change to get it to work now. (The 'back' user is for a real human to access the backups in Finder) The script:
#!/bin/bash -p

#Use special key for rsync
export RSYNC_RSH="ssh -i /Users/back/.ssh/.ssh-noautoload/unattended-rsync"

#Transfer
rsync -avH root@domain.tld:'"/opt/FileMaker/FileMaker Server/Data/Backups/Day*"' /Users/back/Documents/backups/

#Goodbye
exit 0
The launch daemon:
Label
                hentfmsbackup
                Program
		/Users/back/.rsyncScripts/getBackup.sh
                RunAtLoad
                
		StartCalendarInterval
		
			Hour
			0
			Minute
			15
		
		KeepAlive
		
			SuccessfulExit
			
		
		UserName
		back
Searching for answers have not turned up any solution yet. All tips/hints are welcome.
Erik Cayré (61 rep)
Feb 20, 2025, 12:09 PM • Last activity: Feb 21, 2025, 01:40 AM
3 votes
1 answers
59 views
Rsync from Linux to MacOS loses fractional portion of file timetsamp
If I rsync a bunch of files from Linux to MacOS, all the file timestamps have the fractional portion zeroed out. If I go from Linux to Linux, the fractional portions of the timestamps are preserved. Is this expected behavior? How can I preserve the fractional portion of the timestamps? I need them b...
If I rsync a bunch of files from Linux to MacOS, all the file timestamps have the fractional portion zeroed out. If I go from Linux to Linux, the fractional portions of the timestamps are preserved. Is this expected behavior? How can I preserve the fractional portion of the timestamps? I need them because file times are used to compute checksums. **Timestamps of files rsynced to Linux:** enter image description here **Timestamps of same files rsynced to MacOS:** enter image description here
togaen (33 rep)
Jan 31, 2025, 06:17 PM • Last activity: Jan 31, 2025, 08:42 PM
5 votes
3 answers
843 views
rsync : Show deleted files
I'm in the process of porting scripts which use `rsync` to MacOS 10.15.7. Typical commands in these scripts look like rsync -rau --delete SOURCE DESTINATION Is there a way to display, which files have been deleted from DESTINATION? On Linux, I would use the option `--info=del`, but on the Mac versio...
I'm in the process of porting scripts which use rsync to MacOS 10.15.7. Typical commands in these scripts look like rsync -rau --delete SOURCE DESTINATION Is there a way to display, which files have been deleted from DESTINATION? On Linux, I would use the option --info=del, but on the Mac version of rsync, --info does not exist, as we can see [in the man-page](https://ss64.com/osx/rsync.html) .
user1934428 (1458 rep)
Apr 20, 2023, 01:45 PM • Last activity: Dec 15, 2024, 09:49 AM
1 votes
0 answers
810 views
Why am I getting this Rsync error on my MacBook?
I made a backup from an NTFS formatted USB flash drive to transfer files to a MacBook. For this purpose I created a simple bash script (I upgraded bash to 5.2 with homebrew): #!/bin/bash declare -A BACKUP_INFOS BACKUP_INFOS=( [/Users/ /Documents]="/Volumes/CORSAIR128/argomentare /Volumes/CORSAIR128/...
I made a backup from an NTFS formatted USB flash drive to transfer files to a MacBook. For this purpose I created a simple bash script (I upgraded bash to 5.2 with homebrew): #!/bin/bash declare -A BACKUP_INFOS BACKUP_INFOS=( [/Users//Documents]="/Volumes/CORSAIR128/argomentare /Volumes/CORSAIR128/articoli /Volumes/CORSAIR128/bibliografie ... /Volumes/CORSAIR128/xindy" ) for dest_dir in "${!BACKUP_INFOS[@]}" do mkdir -p "$dest_dir" src="${BACKUP_INFOS[$dest_dir]}" rsync -avuz --delete --delete-after --progress $src "$dest_dir" done The file always worked until I upgraded my OS from Sonoma to Sequoia, but I can't tell if there's a connection. Now the script doesn't work anymore and I get this error: rsync: [sender]readdir("/Volumes/CORSAIR128/argomentare"): Invalid arguments (22) rsync: [sender]readdir("/Volumes/CORSAIR128/articoli"): Invalid arguments (22) 300 files rsync: [sender] readlink_stat("/Volumes/CORSAIR128/articoli /Volumes/CORSAIR128/bibliografie/nagel.doc") failed: Bad file descriptor (9) ... I don't understand what this could depend on. If you need more information, please specify what is needed to understand better the nature of the problem. Thanks **Update 1**: I tried to set this:
#!/usr/bin/env bash
set -x
But the result is always the same one. **Update 2**: I set bash to be my shell and not zsh. However I receive new, different errors, with the above script: macbook.sh line 3: declare -A: invalid option ... macbook.sh line 27: /Users//Documents: syntax error: operand expected (error token is "/Users//Documents") **Update 3**: 1) is just a sign of omission (and not part of the code): the directories planned for the backup are several dozen and therefore I omitted several of them in the code reported so as not to lengthen the text of the message too much. 2) I launch the script with bash macbook.sh 3) ls -la macbook.sh returns the following simple output: staff 2106 22 Set 19:51 macbook.sh 4) If I run a command manually and referring to only one directory I get the following output: rsync -avuz --delete --delete-after --process /Volumes/CORSAIR128 Argomentare /Users//Documents 1 file to consider IO error encountered -- skipping file deletion sent 87 bytes received 11 bytes 196,00 bytes/sec total size is 0 speedup is 0,00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1358) [sender=3.3.0] 5) The mount point of the USB drive is (still) /Volumes/CORSAIR128 6) It's impossible to format on Sequoia in NTFS (that filesystem is read only) **Update 4** The problem is solved by formatting the USB device in exFAT. The script works regularly. I wonder then if in reality the problem is (I formulate a pure hypothesis) in something that has changed in Sequoia with respect to the management of NTFS partitions.
user41063 (111 rep)
Sep 22, 2024, 06:38 PM • Last activity: Oct 14, 2024, 09:45 AM
1 votes
0 answers
97 views
Rsync unable to create hard links of symlinks
I have long used rsync to back up various directories on my production servers. I do "incremental" backups using rsync's `--link-dest` flag. This causes rsync to check the directory of the previous backup and if the file in question hasn't changed, it just creates a hard link to the previous file in...
I have long used rsync to back up various directories on my production servers. I do "incremental" backups using rsync's --link-dest flag. This causes rsync to check the directory of the previous backup and if the file in question hasn't changed, it just creates a hard link to the previous file in the destination directory. This has worked for years. I recently upgraded my Mac and as a result I am now running MacOS Sonoma 14.5 which is a much newer version than on my old Mac. My rsync backups now fail with rsync: [generator] failed to hard-link /Volumes/Data03/backup/etc-2024-0925-1448/localtime with localtime: Operation not supported (45). I get this error for every symlink in the previous backup directory. This can be replicated in the shell:
$ touch x.1
$ ln -s x.1 x.2
$ ln -P x.2 x.3. # -P means link to the symlink, not the symlink's target
ln: x.3: Operation not supported
Any idea of how to fix this? TIA Edit - Additional information: After additional testing, I have discovered that creating hard links to symlinks works on APFS volumes. The exact same shell commands shown above are successful on an APFS volume, for whatever that's worth.
David Patterson (141 rep)
Sep 25, 2024, 04:34 PM • Last activity: Sep 26, 2024, 02:40 PM
3 votes
0 answers
87 views
rsync performance issues on large directories
I'm trying to clone a directory tree with millions of files from a remote server to my local machine with rsync and running into some issues. rsync on Mac OS creates an extra `._` file _for every single file_. Since these are all approx 4k and many of the files are very small this is increasing the...
I'm trying to clone a directory tree with millions of files from a remote server to my local machine with rsync and running into some issues. rsync on Mac OS creates an extra ._ file _for every single file_. Since these are all approx 4k and many of the files are very small this is increasing the space requirement by something like 50% so 200GB is now consuming 300GB. Additionally, since every file now requires two writes, it seems to be going much slower than the same action performed on a linux box. At the moment the process has been running for approx 8 hours and will take at least another 30. Based on my bandwidth and network speed, this should only take 2 at the most. I know there have been serveral related questions on the topic: - https://apple.stackexchange.com/questions/14980/why-are-dot-underscore-files-created-and-how-can-i-avoid-them - https://apple.stackexchange.com/questions/136248/disable-storage-of-invisible-files-on-my-cfs-or-smb-network-storage My question is concerned specifically with how to get "normal" performance out of rsync in this situation, or if not possible, how to clone a remote directory tree efficiently without all the extra overhead of creating millions of 4k .- files.
You Old Fool (515 rep)
Sep 26, 2024, 11:34 AM
4 votes
1 answers
584 views
Can I use rsync to fix the timestamps that Migration Assistant trashed?
I have discovered the hard way that Apple's "Migration Assistant" doesn't always preserve file timestamps (i.e., created/modified dates in `~/Documents`), and I now have a new machine with some folders containing files that are timestamped to the migration — *not* the original timestamps. It's a mes...
I have discovered the hard way that Apple's "Migration Assistant" doesn't always preserve file timestamps (i.e., created/modified dates in ~/Documents), and I now have a new machine with some folders containing files that are timestamped to the migration — *not* the original timestamps. It's a mess, and sort of a disaster for my workflow. I've just learned that many others have been burned by this before me. Question: is there some way that I can use rsync, perhaps with the --size-only flag to restore the original, correct timestamps? I need to create an NFS share, I guess, to rsync between two different macs. Or maybe I could do it via ssh? If this is possible, any pointers on how to actually do it?
mrob (81 rep)
Jul 4, 2022, 05:18 AM • Last activity: Sep 16, 2024, 04:08 AM
0 votes
1 answers
178 views
How to use rsync without creating annoying underscore files?
I am using rsync as follows rsync --inplace -aEu -v --delete --exclude=".DS_Store" --exclude="._*" /Users/alex/Documents /Volumes/BACKUP/Documents to sync the files and folders from my `Documents` folders to a hard drive (with a FAT32 partition). However, while copying, it seems that underscore file...
I am using rsync as follows rsync --inplace -aEu -v --delete --exclude=".DS_Store" --exclude="._*" /Users/alex/Documents /Volumes/BACKUP/Documents to sync the files and folders from my Documents folders to a hard drive (with a FAT32 partition). However, while copying, it seems that underscore files are created, like ._file.py How to avoid creating them on the backup?
Alex (2711 rep)
Sep 14, 2024, 09:48 AM • Last activity: Sep 14, 2024, 09:41 PM
0 votes
1 answers
669 views
Rsync 3.1.2 and ACL error
For over a year, I've been using rsync to add a layer of archiving to my systems. It has worked fine. I recently upgraded the computers to High Sierra. My server contains a volume incorporating a sparsebundle. In the past, this volume (/Volume/Videos) archived without problems. Once I ran my script...
For over a year, I've been using rsync to add a layer of archiving to my systems. It has worked fine. I recently upgraded the computers to High Sierra. My server contains a volume incorporating a sparsebundle. In the past, this volume (/Volume/Videos) archived without problems. Once I ran my script on High Sierra, it fails with: rsync: unpack_smb_acl: sys_acl_get_info(): No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2] I've been using rsync 3.1.2 with the -aAXE options to get the ACLs,etc. For this single volume, I'm now trying the default rsync without those options, and it appears to be working. Later, I'll try again with rsync 3.1.2 and no AXE options. Has anyone else seen this behavior in High Sierra? Does anyone have an explanation about why it is happening?
tim.rohrer (646 rep)
Oct 18, 2017, 11:46 AM • Last activity: Jul 29, 2024, 07:20 PM
2 votes
3 answers
5978 views
Using rsync with path names containing spaces
I am trying to use `rsync` (on macOS Catalina) but have trouble with spaces in file path names. I have used `-s` or `--protect-args` but they do not do anything (when I look at the help for rsync, these options are not listed). I am running `rsync` 2.6.9 in `zsh`. Can anyone help please? Here is wha...
I am trying to use rsync (on macOS Catalina) but have trouble with spaces in file path names. I have used -s or --protect-args but they do not do anything (when I look at the help for rsync, these options are not listed). I am running rsync 2.6.9 in zsh. Can anyone help please? Here is what I get when I run this rsync command: chris@cgimac ~ % rsync -ahv /Volumes/G_5TB_general/Backup of CG-nas/mac drives/Fitness and health /Volumes/G_5TB_general/temp dump building file list ... rsync: link_stat "/Volumes/G_5TB_general/Backup" failed: No such file or directory (2) rsync: link_stat "/Users/chris/of" failed: No such file or directory (2) rsync: link_stat "/Users/chris/CG-nas/mac" failed: No such file or directory (2) rsync: link_stat "/Users/chris/drives/Fitness" failed: No such file or directory (2) rsync: link_stat "/Users/chris/and" failed: No such file or directory (2) rsync: link_stat "/Users/chris/health" failed: No such file or directory (2) done I get the exact same result if I modify the command to rsync -ahv ‘/Volumes/G_5TB_general/Backup of CG-nas/mac drives/Fitness and health’ ‘/Volumes/G_5TB_general/temp dump’ I have looked elsewhere and there are many examples eg st https://www.cyberciti.biz/faq/rsync-transfer-filename-that-contains-whitespace/ where the -s (or --protect-args) option for rsync apparently work.
chris (31 rep)
Apr 9, 2020, 02:52 AM • Last activity: Jun 25, 2024, 10:50 PM
0 votes
0 answers
91 views
Shell script can't be executed by LaunchDeamon or LaunchAgent
_macOS 14.2.1 (23C71)_ I have this shell script which copies a folder to an external hard drive using rsync: ```bash #!/bin/bash SOURCE_DIR="/Users/tristan/Library/Application Support/Postgres/var-16" BACKUP_DIR="/Volumes/Malbec/Backup" BACKUP_NAME="backup_$(date +%Y%m%d_%H%M%S)" BACKUP_PATH="$BACKU...
_macOS 14.2.1 (23C71)_ I have this shell script which copies a folder to an external hard drive using rsync:
#!/bin/bash

SOURCE_DIR="/Users/tristan/Library/Application Support/Postgres/var-16"
BACKUP_DIR="/Volumes/Malbec/Backup"

BACKUP_NAME="backup_$(date +%Y%m%d_%H%M%S)"
BACKUP_PATH="$BACKUP_DIR/$BACKUP_NAME"

rsync -a --delete "$SOURCE_DIR/" "$BACKUP_PATH/"
Running this script manually works fine but when trying to execute it with a LaunchDeamon/LaunchAgent it doesn't work. Also when the backup folder is on the internal hard drive it works without a problem. This is the plist:
Label
    postgres.backup
	UserName
	tristan
    StandardOutPath
    /Users/tristan/Server_Backup/daily.0000_out.log
    StandardErrorPath
    /Users/tristan/Server_Backup/daily.0000_error.log
    Program
    /Users/tristan/Server_Backup/Backup.sh
	RunAtLoad
    
    StartCalendarInterval
    
        Hour
        18
        Minute
        5
And this is the error I get:
rsync: mkdir "/Volumes/Malbec/Backup/backup_20240503_180246" failed: Operation not permitted (1)
rsync error: error in file IO (code 11) at /AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(545) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/rsync/rsync/io.c(453) [sender=2.6.9]
rsync: mkdir "/Volumes/Malbec/Backup/backup_20240503_180505" failed: Operation not permitted (1)
rsync error: error in file IO (code 11) at /AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(545) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/rsync/rsync/io.c(453) [sender=2.6.9]
I'm guessing it's some kind of permission problem. I have already added rsync to full disk access in the Privacy & Security settings. **Edit:** I let the thing sit for a few days and when I came back it ran and made backups. It just started working out of nowhere when I was away.
QGuy (11 rep)
May 3, 2024, 04:21 PM • Last activity: May 16, 2024, 02:47 PM
1 votes
1 answers
114 views
Create a local snapshot of an external drive in macOS
I'd like to backup my external drives to my NAS using rsync and not Time Machine, because I occasionally want to actually use these files on the remote server. I'd like to create an APFS snapshot before rsync begins so that the data integrity is preserved (for example in Apple Photos sqlite DB or a...
I'd like to backup my external drives to my NAS using rsync and not Time Machine, because I occasionally want to actually use these files on the remote server. I'd like to create an APFS snapshot before rsync begins so that the data integrity is preserved (for example in Apple Photos sqlite DB or a docker.raw VM). It seems that if you run tmutil localsnapshot /Volumes/ExternalData or tmutil snapshot /Volumes/ExternalData, it will not work if that drive is excluded from the time machine backup (as is the case for me, I don't need that data backed up twice to the same target). Any idea how I can create a snapshot of an external drive that's exluded from Time Machine?
odedia (131 rep)
Apr 18, 2024, 07:42 PM • Last activity: Apr 18, 2024, 08:36 PM
1 votes
1 answers
280 views
Convert absolute paths into relative path for rsync
I try to sync to folders, but with exceptions made by tags. So I learned, that I need different commands to build up that job. First I create a file of excluded files, which have a tag in orange or red set. Then I call rsync with this output file as the no-do-list. But the content of the file is an...
I try to sync to folders, but with exceptions made by tags. So I learned, that I need different commands to build up that job. First I create a file of excluded files, which have a tag in orange or red set. Then I call rsync with this output file as the no-do-list. But the content of the file is an absolute file name, while rsync seems to need relative path. This is what I already have (need local language for names!):
mdfind -onlyin . "kMDItemUserTags == 'Orange' || kMDItemUserTags == 'Rot'" > excluded.txt
And this is the one I need to get run:
rsync -avz --exclude-from "excluded.txt" source/ destination/
Any ideas? Additional infos for better reading: Now with "sed", I get: ./Gruppe/A-Teens ./Gruppe/A-Teens/A - Teens - Mama Mia.mp3 ./Gruppe/A-Teens/A - Teens - Super Trouper.mp3 Unfortunately this does not work. Again everything is copied. Actual statements: cd /Users/serveruser/Desktop/fasttemp/temp/Unser/Songs mdfind -onlyin . "kMDItemUserTags == 'Orange' || kMDItemUserTags == 'Rot'" | sed 's|/Users/serveruser/Desktop/fasttemp/temp/Unser/Songs|.|' > excluded.txt rsync -avz --exclude-from "excluded.txt" /Users/serveruser/Desktop/fasttemp/temp/Unser/Songs/ /Users/serveruser/Desktop/fasttemp/temp/Unser/Backup/
Peter Silie (113 rep)
Jan 3, 2024, 09:06 AM • Last activity: Jan 5, 2024, 04:59 PM
Showing page 1 of 20 total questions