iMac doesn‘t start up My iMac doesn’t start up. The loading bar doesn’t fill up and then, after 10 minutes or so, it shuts down. I tried to get in the recovery mode, but there is the Macintosh HD drive grey and it says „not active“.
Any help or advice on how to solve it? 
Thanks

(I haven‘t saved my files on a external hard drive and I don‘t want to lose it)

Macos 10.13

Update:  So i think it tries to repairs the volume repair volume and then some error messages one says invalid number of threads and then it tries again and then something fails and it shuts down.
This is an attempt to write a canonical answer for drive error/faults and the importance of backing up data.

The Symptoms


  My iMac doesn’t start up. The loading bar doesn’t fill up and then,
  after 10 minutes or so, it shuts down.


This is just one of the symptoms of a possible hard drive crash.  It could be that it boots but is horribly slow.  It could also boot and perform well, then suddenly crash (kernel panic).  It could make horrible noise, or it could be as quiet as the day you bought it (SSD's of course).

In this particular case, it attempts to repair the volume, fails, then shuts down.  This definitely points to a failed drive.

What to do...

Stop using your device and remove your drive.  If you ever hope to have a chance at recovering your data you need to stop attempting to boot from it.  Most of all, don't try to "stress" it in the hopes of making things better.

A Word on Backing up Your Data

Ironically, the last item mentioned is the most important:


  (I haven‘t saved my files on a external hard drive and I don‘t want to
  lose it)


Whether you are using an iMac, a MacBook Pro, a PC or even working on an IBM mainframe, the very first thing you need to consider is backing up your data.  Everything fails. Period. Whatever it is, at some point in time, it will fail. What we cannot predict with any certainty is when it will fail

Your operating system can be easily reinstalled.  It may take a few weeks to tweak your settings just so, but that doctoral dissertation, picture of your family from last holiday, or file with the original recipe Coca-Cola will be gone - forever (generally speaking).

Backup is a very inexpensive insurance policy.  You can recover your data, but at a very high cost.  Would you rather pay $100USD for an external USB drive or thousands to a data recovery service?

Is it practical to backup your data now?  Probably and personally, I would avoid using the drive until I could get set up with a fully functioning machine before I begin my data recovery attempts.

Replacing a Failed Drive

The specific iMac model wasn't referenced, but it really doesn't matter in the context of this answer. It could be a spinning hard drive or an SSD inside an iMac, Mac Pro, or MacBook.  The drive has failed and it must be replaced.


iMac - must remove the glass to access the internal hard drive.  All Intel iMacs (at the time of this writing) have user serviceable drives - they can be replaced.  SSDs are normally proprietary, however.


Pre-2012 iMacs used magnets to hold the glass and screws to hold the LCD.  The removal is fairly straight forward.
2012 and later iMacs have the glass and LCD fused together with the assembly fastened to the body with adhesive.  This must be cut to access the internals

MacBook Pros


2012 and earlier MacBook Pro's used off-the-shelf standard 2.5" HDDs.  Removal of the bottom cover allows access to drive and memory.
2013-2015 MBP's used a "proprietary" PCIe SSD that was also accessible after removing the rear cover
2015 and later MBP's have the SSD soldered to the PCB.  It is no longer a user serviceable part.



"Rebuild" your Mac

To begin the process of rebuilding your Mac, you need to start with a clean slate and a fully functioning machine.  You can't rebuild you car's engine or transmission while you're still driving it and you can't rebuild your data while operating on a faulty system.

Here's what you need to do:


Buy a USB drive for Backup
Install a new drive
Re-install macOS and your Applications.
Make a backup


The Recovery Process


Get a USB to SATA enclosure/adapter to connect to your failed drive
Obtain recovery software and attempt the recovery process
After you have recovered all that you can, make another backup
Set up a backup strategy and schedule


Each one of these items has been address separately on this site and at many times linked back to Apple's own site (i.e. Using Time Machine).

One very important thing to note is that iCloud is not backup; it's file synchronization.  Meaning if you delete it on one device, it's deleted everywhere.