Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Samurai Shampoo

macrumors member
Original poster
Jul 2, 2017
85
2
Hello guys. Hope you are doing good.

My 2017 iMac got abruptly shut down because of a power outage which was caused by an external device

-> the electrical system in my house gets overloaded when the lawn mower is plugged in and too many other devices are running like lights and iMac. Someone plugged in the lawn mower and caused a power outage. Second time in 3 weeks.

Enough rambling: This sure can't be healthy for the macOS or the interal disk.
How can I check if there are any problems with my iMac after the power outage?
Disk health or similar things.


I checked the activity monitor and after the first two uses there were CPU tasks called "mdworker" (a dozen of this one), "mds" and a 3rd one that I can't remember.

They used tons of CPU - up to 89% - and this went on for almost ten minutes. Spotlight seemed to use a giant amount of CPU % as well.

Hope someone can help me here.
 

mreg376

macrumors 65816
Mar 23, 2008
1,233
418
Brooklyn, NY
The only thing the power outage should affect are open files that you hadn't saved. mdworker relates to Spotlight, which was probably re-indexing.
 

DeltaMac

macrumors G5
Jul 30, 2003
13,767
4,591
Delaware
The "mdworker" and "mds" and a couple of other similar names appear when the spotlight database is rebuilding.
This is pretty common to see.
The power failure likely triggered that on the next boot.
Those rebuilding processes simply take some time. Could be 2 minutes, or 2 hours (even longer) for a rebuild to complete, but (should) eventually settle down to whatever is your normal.

Power failure may have very little result (either good OR bad), or might corrupt boot files on the hard drive (maybe even preventing the next boot), or something in-between.
The biggest item that I would check is to run First Aid on the hard drive.
I suggest that you shut down, then boot to your recovery system by pressing the power button, then holding Command + r
When you see the progress bar, you can release the keys. It may take noticeably longer to boot. You will end at a window with some choices. Choose Disk Utility, then click Continue.
When the Disk Utility window appears, choose Show All Devices from the View menu.
Click on your drive, which is probably the top item in the list. Run First Aid. That may repair some file system items (or just complete with no problems.) Then, select your drive (the line with your hard drive's name (Macintosh HD, or MyDrive, whatever is that name that you recognize), and run First Aid again.
No Problems, then Quit Disk Utility, and choose Restart from the Apple menu.
If there's really no problems found, you should be OK.

If this is a recurring problem for you, consider adding a UPS (Uninterruptible Power Supply) to your system. Switches over to battery when power fails, to give you time to safely shut down your system. Unless you spend a LOT of money, a UPS is NOT designed to be used to allow you to work for the rest of the day with no AC power. 10 or 15 minutes, as a maximum. :cool:
 

NajamQ

macrumors member
Apr 30, 2018
68
37
Hello guys. Hope you are doing good.

My 2017 iMac got abruptly shut down because of a power outage which was caused by an external device

-> the electrical system in my house gets overloaded when the lawn mower is plugged in and too many other devices are running like lights and iMac. Someone plugged in the lawn mower and caused a power outage. Second time in 3 weeks.

Enough rambling: This sure can't be healthy for the macOS or the interal disk.
How can I check if there are any problems with my iMac after the power outage?
Disk health or similar things.


I checked the activity monitor and after the first two uses there were CPU tasks called "mdworker" (a dozen of this one), "mds" and a 3rd one that I can't remember.

They used tons of CPU - up to 89% - and this went on for almost ten minutes. Spotlight seemed to use a giant amount of CPU % as well.

Hope someone can help me here.
You are worried about iMac adruptly shutting down. It can cause data corruption if there was an active copy/move process or saving a document. Otherwise there is really no need to worry.

You can run first aid on Macintosh HD from disk utility to check for any errors in file system but really don't worry about it.

I do recommend you use a surge protector with iMac. Power cut is not to worry about but surges are dangerous (as lawn mower causes a surge which you should care about). A good quality UPS will have surge protection built in so it's a good investment.

Experience: rolling blackouts in my country, sometimes after every 3 hours. I do have a UPS connected to iMac from day one but it has shut down abruptly a few times during last 3 years and it's working good.
 

Samurai Shampoo

macrumors member
Original poster
Jul 2, 2017
85
2
Thanks for the replies.
The only thing the power outage should affect are open files that you hadn't saved. mdworker relates to Spotlight, which was probably re-indexing.
Okay, thanks. So, the disk health and OS can't be affected?

The "mdworker" and "mds" and a couple of other similar names appear when the spotlight database is rebuilding.
This is pretty common to see.
The power failure likely triggered that on the next boot.
Those rebuilding processes simply take some time. Could be 2 minutes, or 2 hours (even longer) for a rebuild to complete, but (should) eventually settle down to whatever is your normal.

Power failure may have very little result (either good OR bad), or might corrupt boot files on the hard drive (maybe even preventing the next boot), or something in-between.
The biggest item that I would check is to run First Aid on the hard drive.
I suggest that you shut down, then boot to your recovery system by pressing the power button, then holding Command + r
When you see the progress bar, you can release the keys. It may take noticeably longer to boot. You will end at a window with some choices. Choose Disk Utility, then click Continue.
When the Disk Utility window appears, choose Show All Devices from the View menu.
Click on your drive, which is probably the top item in the list. Run First Aid. That may repair some file system items (or just complete with no problems.) Then, select your drive (the line with your hard drive's name (Macintosh HD, or MyDrive, whatever is that name that you recognize), and run First Aid again.
No Problems, then Quit Disk Utility, and choose Restart from the Apple menu.
If there's really no problems found, you should be OK.

If this is a recurring problem for you, consider adding a UPS (Uninterruptible Power Supply) to your system. Switches over to battery when power fails, to give you time to safely shut down your system. Unless you spend a LOT of money, a UPS is NOT designed to be used to allow you to work for the rest of the day with no AC power. 10 or 15 minutes, as a maximum. :cool:
Thanks. Can first aid in Disk Utility be run in normal mode or does it have to be run in the recovery system?



You are worried about iMac adruptly shutting down. It can cause data corruption if there was an active copy/move process or saving a document. Otherwise there is really no need to worry.

You can run first aid on Macintosh HD from disk utility to check for any errors in file system but really don't worry about it.

I do recommend you use a surge protector with iMac. Power cut is not to worry about but surges are dangerous (as lawn mower causes a surge which you should care about). A good quality UPS will have surge protection built in so it's a good investment.

Experience: rolling blackouts in my country, sometimes after every 3 hours. I do have a UPS connected to iMac from day one but it has shut down abruptly a few times during last 3 years and it's working good.
Thanks for the insight. I'd rather not get an UPS because they are so loud and my iMac fans are already abnormally loud but I do have a surge protector connected to my mac.
 

mreg376

macrumors 65816
Mar 23, 2008
1,233
418
Brooklyn, NY
If you're going to get power outages, you're asking for trouble by not having a UPS. Basic UPS's, enough to give you time to turn off the iMac in an orderly manner, are not expensive and are silent.
 

DeltaMac

macrumors G5
Jul 30, 2003
13,767
4,591
Delaware
I am not aware of any loud UPS. Unless you mean one with an autostart generator. Noisy enough, I suppose - but most UPSs do not make any noise at all, other than the occasional beep, warning you that the battery might be failing, for example.

First Aid in Disk Utility can be run at any time, booted up normally. However, if problems are found, then you would likely have to boot to the recovery system, and sometimes boot to Internet recovery, so file system problems have the best chance of being repaired properly. Booting to an external can also be a good choice.
 

chscag

macrumors 601
Feb 17, 2008
4,622
1,946
Fort Worth, Texas
Adding to the good advise from member "DeltaMac", I recommend investing in "DriveDX" which provides detailed analysis of your SSD or HHD. Disk Utility is fine for a simple run telling you if you have file or folder corruption but it misses many of the things that can go wrong with your SSD or HHD. Power failures, especially if they occur often enough can cause damage.
 

dwig

macrumors 6502a
Jan 4, 2015
908
449
Key West FL
I am not aware of any loud UPS. ....

You're quite right. Those made for personal computers will be totally silent except when "announcing" a power blip or failure. Also, many do make a slight hum during a power interruption. Some of the monster UPSs that provide power for large rack mounted server banks will have cooling fans.

I've been a believer in UPSs for over 30 years. They provide both surge protection and power backup. Over the years I experienced a vast number of power interruptions that would have crashed my computers had they not been on UPSs. To date, none have ever experienced any issues related to power.

Here in Key West, FL, we experience very frequent power interruptions. Most are quite brief, but long enough to have caused a computer to crash. The only computers that I use that are not on UPSs are phones, tablets and notebooks that have their own batteries, and these are all plugged in, for charge and/or use, to a good surge protector.
 

joema2

macrumors 68000
Sep 3, 2013
1,646
866
...So, the disk health and OS can't be affected?...Can first aid in Disk Utility be run in normal mode or does it have to be run in the recovery system?...I'd rather not get an UPS because they are so loud...

The problem is not just power failure but any uncontrolled shutdown. E.g, macOS hangs, crashes, or becomes unstable and won't shut down.

This can cause problems on two separate layers: file system and application. In theory HFS+ is transactional and will handle an uncontrolled shutdown. However it's probably a good idea to run Disk Utility First Aid after such an event. Unfortunately the method to properly run First Aid is poorly documented, can vary with macOS version, and can be confusing (see below).

First Aid only checks or corrects inconsistencies involving file system metadata. It does not do a disk surface scan for bad blocks, and it knows nothing about the application layer. E.g, if Lightroom crashes or macOS has an abrupt shutdown while Lightroom is doing I/O, its database could get damaged. This can only be checked by a utility aware of those higher-level data structures. The same is true for any application. Ideally by this point of OS evolution there would be a transactional database file system with a uniform integrity check, but alas there is not. This means every single application with a database of any kind must do its own unique application-layer integrity checks. Some database-centric apps such as FCPX have no exposed integrity checker.

Disk Utility has two different view modes, "Show Only Volumes" and "Show All Devices". I think before High Sierra the default was "Show All Devices". Starting with High Sierra the default is "Show Only Volumes". Which version of macOS you have affects whether you see only volumes in Disk Utility or volumes plus devices.

If you see volumes plus devices, or a disclosure triangle revealing devices under volumes, those must be checked individually by separate First Aid passes. If you see only volumes, checking that level will also check the devices, at least as of High Sierra.

Checking with macOS up in normal mode is called a Live Check. In theory this is OK, even if done on the system volume. Disk Utility will produce a warning if checking the system volume saying it must lock the boot volume first.

However, experienced service reps often recommend booting into Recovery and running Disk Utility First Aid from there. In theory this ensures a more quiescent file system with less transactions "in flight", requiring less compensation for an integrity check. How necessary this is in reality, I don't know.

I personally run First Aid with macOS up; I don't boot into Recovery to run it.

Re UPS, they are not loud. They are generally off line and only activate upon a power failure. There are on line UPSs which generate more heat and their cooling fan may run continuously. Most consumer-type UPSs are not of this type.
 

Samurai Shampoo

macrumors member
Original poster
Jul 2, 2017
85
2
Thanks to all of you again!

Checking with macOS up in normal mode is called a Live Check. In theory this is OK, even if done on the system volume. Disk Utility will produce a warning if checking the system volume saying it must lock the boot volume first.

However, experienced service reps often recommend booting into Recovery and running Disk Utility First Aid from there. In theory this ensures a more quiescent file system with less transactions "in flight", requiring less compensation for an integrity check. How necessary this is in reality, I don't know.

I personally run First Aid with macOS up; I don't boot into Recovery to run it.

Re UPS, they are not loud. They are generally off line and only activate upon a power failure. There are on line UPSs which generate more heat and their cooling fan may run continuously. Most consumer-type UPSs are not of this type.
I ran First Aid and everything looked good.


Now, I have some suspicion regarding Spotlight which could lead to solving another problem. Maybe you guys can help me here:

Like I said Spotlight went pretty crazy on the CPU % after the power outages. I checked the Storage yesterday and saw that the System takes up 112 GB of space on my Mac.

I never had Time Machine enabled. I even deleted that one default Time Machine snapshot from yesterday. This momentarily freed 10 GB of space but quickly jumped back to 112 GB and then increased to 113 GB. After 10 minutes it increased by a whopping 10 GB to 123 GB and I didn't even do anything besides browsing macrumors (no other apps running).

Could it be that Spotlight messed up somewhere and reindexed everything multiple times which made System Storage go thru the roof?
 

DeltaMac

macrumors G5
Jul 30, 2003
13,767
4,591
Delaware
You can reset Spotlight, which removes the existing database, and forces Spotlight to build a new one.
There's a couple of terminal commands that you can run, or just do it through the Spotlight pref pane in System Preferences:
Spotlight pref pane, then the Privacy tab. Drag your hard drive to that window. You should see a message asking if you want to remove the database for that drive, which you do.
Close the pane, then re-open it. Same Privacy window, delete your hard drive listed there. Re-indexing will start automatically, usually after a few seconds. Might take only a few seconds, or maybe up to an hour or so to finish. There's no way to control how fast it completes, other than to give it an hour, where your system might seem to go a bit slower, or might not be noticeable at all. I usually will restart my Mac after giving the indexing an hour or so, but that's not really necessary.
 
  • Like
Reactions: Samurai Shampoo

joema2

macrumors 68000
Sep 3, 2013
1,646
866
...Could it be that Spotlight messed up somewhere and reindexed everything multiple times which made System Storage go thru the roof?

You can manually rebuild the spotlight indexes using this method: https://support.apple.com/en-us/ht201716

However I don't think that deletes the index data store. You can do that by using Terminal commands:

https://www.amsys.co.uk/resolving-spotlight-issues-in-os-x/

To verify what folders and sub-folders are consuming space, you can use the free OmniDiskSweeper utility: https://www.omnigroup.com/more
 
  • Like
Reactions: Samurai Shampoo

Fishrrman

macrumors Penryn
Feb 20, 2009
29,279
13,377
I know I sound like a broken record on this, but the best solution for Spotlight is to TURN IT OFF:
sudo mdutil -a -i off
 

Samurai Shampoo

macrumors member
Original poster
Jul 2, 2017
85
2
You can manually rebuild the spotlight indexes using this method: https://support.apple.com/en-us/ht201716

However I don't think that deletes the index data store. You can do that by using Terminal commands:

https://www.amsys.co.uk/resolving-spotlight-issues-in-os-x/

To verify what folders and sub-folders are consuming space, you can use the free OmniDiskSweeper utility: https://www.omnigroup.com/more
Do these Terminal commands run forever and I have to stop them or is this a one time only event?

I did try that Time Machine snapshot delete command. Prior to using that command Time Machine always had a snapshot of the day before even tho it was disabled. Now I don't get any snapshots anymore.
 

joema2

macrumors 68000
Sep 3, 2013
1,646
866
Do these Terminal commands run forever and I have to stop them or is this a one time only event?

I did try that Time Machine snapshot delete command. Prior to using that command Time Machine always had a snapshot of the day before even tho it was disabled. Now I don't get any snapshots anymore.

To my knowledge deleting the spotlight indexes via Terminal is a one-time event. After rebooting the Mac and letting the index rebuild happen, it should be back to normal. If you don't wait a while you may not see snapshots.

This should be safe but any use of Terminal is at your own risk.

As of High Sierra and APFS, snapshots are more sophisticated. So the behavior you see may vary based on whether you're on High Sierra or not, whether you have an SSD boot drive or not, and whether your external Time Machine backup disk is connected or not: https://support.apple.com/en-us/ht204015
 
  • Like
Reactions: Samurai Shampoo

Samurai Shampoo

macrumors member
Original poster
Jul 2, 2017
85
2
To my knowledge deleting the spotlight indexes via Terminal is a one-time event. After rebooting the Mac and letting the index rebuild happen, it should be back to normal. If you don't wait a while you may not see snapshots.

This should be safe but any use of Terminal is at your own risk.

As of High Sierra and APFS, snapshots are more sophisticated. So the behavior you see may vary based on whether you're on High Sierra or not, whether you have an SSD boot drive or not, and whether your external Time Machine backup disk is connected or not: https://support.apple.com/en-us/ht204015
Okay, thanks. Now it's been a few days and that default time machine snapshot has not started again. I'm worried that the command is running continously. I don't see a performance hit from it but it can't be beneficial to have a terminal command run forever, right?

Anyone who knows for sure if this code runs one time or continously?:
sudo tmutil listlocalsnapshots /
tmutil deletelocalsnapshots 2017-09-27-005259

( that number is from the thread where I found the code:
https://forums.macrumors.com/threads/solution-reclaim-storage-back-from-system.2073174/ )
 

DeltaMac

macrumors G5
Jul 30, 2003
13,767
4,591
Delaware
That command to delete local snapshots runs the task as listed, and is done.
If you quit Terminal, where you started any commands that are still running, Terminal. will tell you that quitting Terminal will stop any running commands.
So - That's a good way to find out: Quit the terminal. Anything that you started as a running process (and continue to run) will be reported when you quit terminal. if Terminal is not running, then you are still OK.

And, you would normally remove TM local snapshots by connecting the external storage that you use for Time Machine backups. In normal operation, that would transfer that snapshot to the TM backup, and delete the local snapshot as a part of the process.
Sometimes there's a glitch in that process, and what should be just temp files don't quite work properly, and need to be deleted manually. That's the command that you ran. That should leave you with a system (and TM backups) that begin working as they should (in theory o_O )
 
  • Like
Reactions: Samurai Shampoo

joema2

macrumors 68000
Sep 3, 2013
1,646
866
...Now it's been a few days and that default time machine snapshot has not started again....

If the Time Machine icon is in your menu bar, click on that and verify that "back up automatically" is checked.

If it's not in your menu bar, go to System Preferences, click Time Machine, verify "back up automatically" is checked, and also check "Show Time Machine in menu bar". You can also click on "Options" and verify that the drives to be backed up haven't somehow been excluded.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.