MacOS 下 launchd 平均每天磁盘写入都超过 10GB ,前 ubuntu 用户表示真的忍不了,经过分析写入文件位于 /var/log/com.apple.xpc.launchd/
的 log ,平均每分钟写入 10M 以上,全是用于启动 SpotLight 的操作
这个 mdworker 进程被频繁启动然后再被 kill ,不知道是哪个鬼才想出来的好主意,库克知道么?
2022-08-23 17:43:11.908127 <Notice>: Last log repeated 2 times
2022-08-23 17:43:11.907854 (system) <Warning>: failed lookup: name = com.apple.AppleLOM.Watchdog, flags = 0x1, requestor = watchdogd[301], error = 3: No such process
2022-08-23 17:43:27.284613 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000) <Notice>: internal event: WILL_SPAWN, code = 0
2022-08-23 17:43:27.284718 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000) <Notice>: service state: spawn scheduled
2022-08-23 17:43:27.284723 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000) <Notice>: service state: spawning
2022-08-23 17:43:27.285151 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000) <Notice>: launching: ipc (mach)
2022-08-23 17:43:27.286377 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000 [55975]) <Notice>: xpcproxy spawned with pid 55975
2022-08-23 17:43:27.286406 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000 [55975]) <Notice>: internal event: SPAWNED, code = 0
2022-08-23 17:43:27.286413 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000 [55975]) <Notice>: service state: xpcproxy
2022-08-23 17:43:27.286432 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000 [55975]) <Notice>: internal event: SOURCE_ATTACH, code = 0
2022-08-23 17:43:27.295285 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000 [55975]) <Notice>: service state: running
2022-08-23 17:43:27.295298 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000 [55975]) <Notice>: internal event: INIT, code = 0
2022-08-23 17:43:27.295308 (user/501/com.apple.mdworker.shared.0B000000-0300-0000-0000-000000000000 [55975]) <Notice>: Successfully spawned mdworker_shared[55975] because ipc (mach)
2022-08-23 17:43:41.908483 (system) <Warning>: failed lookup: name = com.apple.AppleLOM.Watchdog, flags = 0x1, requestor = watchdogd[301], error = 3: No such process
2022-08-23 17:43:59.239397 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000) <Notice>: internal event: WILL_SPAWN, code = 0
2022-08-23 17:43:59.239508 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000) <Notice>: service state: spawn scheduled
2022-08-23 17:43:59.239512 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000) <Notice>: service state: spawning
2022-08-23 17:43:59.239939 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000) <Notice>: launching: ipc (mach)
2022-08-23 17:43:59.241171 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000 [55976]) <Notice>: xpcproxy spawned with pid 55976
2022-08-23 17:43:59.241204 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000 [55976]) <Notice>: internal event: SPAWNED, code = 0
2022-08-23 17:43:59.241211 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000 [55976]) <Notice>: service state: xpcproxy
2022-08-23 17:43:59.241230 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000 [55976]) <Notice>: internal event: SOURCE_ATTACH, code = 0
2022-08-23 17:43:59.250474 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000 [55976]) <Notice>: service state: running
2022-08-23 17:43:59.250492 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000 [55976]) <Notice>: internal event: INIT, code = 0
2022-08-23 17:43:59.250505 (user/501/com.apple.mdworker.shared.0A000000-0300-0000-0000-000000000000 [55976]) <Notice>: Successfully spawned mdworker_shared[55976] because ipc (mach)
2022-08-23 17:44:09.824141 (gui/501 [100019]) <Warning>: failed lookup: name = com.apple.DFRSystemExtra.InputMenu.disableinput, flags = 0x1, requestor = TextInputMenuAg[724], error = 3: No such process
2022-08-23 17:44:11.909041 <Notice>: Last log repeated 1 times
2022-08-23 17:44:11.908979 (system) <Warning>: failed lookup: name = com.apple.AppleLOM.Watchdog, flags = 0x1, requestor = watchdogd[301], error = 3: No such process
2022-08-23 17:44:13.598349 (gui/501 [100019]) <Warning>: failed lookup: name = com.apple.DFRSystemExtra.InputMenu.disableinput, flags = 0x1, requestor = TextInputMenuAg[724], error = 3: No such process
2022-08-23 17:44:39.219725 <Notice>: Last log repeated 3 times
1
starrystarry 2022-08-23 18:26:56 +08:00
这个 bug 自从 macOS 10.14.6 的某个 Combo 更新之后就有了
国外论坛反馈 /private/var/folders/*/*/C/com.Apple.metadata.mdworker 里有数十万的空文件夹 |
2
xtinput 2022-08-23 19:15:07 +08:00
关掉重建就 OK 了,这个是创建系统搜索的索引
|
3
xtinput 2022-08-23 19:22:56 +08:00
@starrystarry #1 我在用 macOS13b5 ,没找到这个文件夹
|
4
bosskwei OP @starrystarry 我找到了你说的这个帖子,一年前就有人讨论了 https://forums.macrumors.com/threads/spotlight-mdworker-shared-file-flooding-system-log-removal-stops-search-index-from-working-properly.2248163/page-4
@xtinput 自己看 log 吧 /var/log/com.apple.xpc.launchd/ |
5
xtinput 2022-08-23 19:58:37 +08:00
我在活动监视器里面只看到 mdworker 进程读磁盘,没看到它写入
试试重建 Spotlight 索引吧 |
6
bosskwei OP @xtinput 大哥,你看一眼 log 好么??怎么给你说 A 你总是回复 B 。。。。。这个读写是 launchd 的
|
8
bosskwei OP vim /var/log/com.apple.xpc.launchd/* 懂了么?
|
9
xtinput 2022-08-23 20:21:50 +08:00
你的意思是每分钟写入了 10M 的日志???我这 launchd 进程 10 天写入量是 42GB
既然知道是 Spotlight ,那把它关了就 OK 了呀 /var/log/com.apple.xpc.launchd/ 文件夹下面只有 3 个文件,最早的一个是今天下午创建的,三个文件一共 20M 不到 |
10
bosskwei OP @xtinput 看文件的尺寸没有意义,因为旧的日志会被自动删除。你进去看里面的内容,搜索 mdworker.shared 试试,有惊喜 :)
|
11
xtinput 2022-08-23 21:24:55 +08:00
活动监视器有硬盘写入记录呀 launchd 10 天 42GB
|
12
YoungShook 2022-08-24 14:52:14 +08:00 1
Disable spotlight indexing on macOS to heavily speed up Virtual Instances.
# massively increase virtualized macOS by disabling spotlight. sudo mdutil -i off -a # since you can't use spotlight to find apps, you can renable with # sudo mdutil -i on -a |
13
bosskwei OP @YoungShook 感谢,这个命令不用关 sip ,非常有用。我试试搞个 crontab 定时任务,每天只允许 spotlight 启动一个小时,然后立刻 disable ,这样应该既可以用功能又不会一直在后台刷新
|