But amid the chaos and terror, the city's university has remained open throughout most of this time.
This has raised questions about whether it has been kept open to provide a facade of normality, or whether it has been used as a technical facility to develop weapons, including for chemical warfare.
But there are clandestine networks of Mosul students and academics who have wanted the rest of the world to know what happens in a university under IS control and in the deteriorating conditions of their city.
They have been helped by the New York-based Scholar Rescue Fund, part of the Institute of International Education, which once rescued academics in Europe from the Nazis.
On condition of anonymity, they describe a city of violence and fear, with public executions, vice police patrols, persecution, air raids, worsening shortages and bans on communication.
Day-to-day life overlaps with horrific displays of control.
In one account, someone coming home from a shopping trip in Mosul was stopped by IS members and forced, along with other passers-by, to witness the "horrifying and disturbing" spectacle of a public beheading.
There is also danger from coalition air raids, with 32 air strikes in or around Mosul last week.
"Life under Isil [another name for IS] has one meaning - absolute fear," according to one Mosul source.
There is a culture of spying, betrayal, blackmail, regular "humiliations" and deadly consequences.
"It is extremely easy for them to kill anyone. Their courts can come to a judgement in a few minutes and the execution will take place immediately."
"Some students worked with them and started spying on us," said sources who saw the University of Mosul being taken over by IS in June 2014.
Subjects such as literature and philosophy were suspended and anything seen as symbolising opposition to their religious ideology was attacked.
"They burned the books in the central library, then they demolished the archaeological sites."
"Right from the beginning, Isis [another name for IS] thought that any book that doesn't advance Islam is meaningless and worthless."
Any academics with links to the west or loyal to the Iraqi government "all lost their lives".
The university switched to subjects promoting the new regime's war effort, with foreign fighters using some of the buildings for accommodation.
Physical sciences became a priority and the IS regime encouraged training in medicine, pharmacy, nursing and dentistry, filling gaps left by doctors who had fled the city.
Languages have been encouraged - both as a way of working with foreign fighters and supporting propaganda efforts.
Even sports and exercise were re-invented as a form of jihadist training, with military-style lessons.
Mosul is a city under siege, with Kurdish Peshmerga forces and the Iraqi army closing in.
Sources say the response of IS has been to exert an increasingly aggressive control over communication and movement.
"They are placing more and more strict rules on internet access. They are knocking door to door, surveying each house, and asking to copy documents and ID cards to see how these belong to internet accounts.
"So whenever they spot an exchange of information these people will be in grave danger."
People are still getting information from social media but they are increasingly unwilling to post anything themselves.
Staff at the university have been warned of punishments for anyone failing to reveal escape plans of colleagues.
There are also stories of drivers being used to double-cross people trying to leave.
There have been worries about the university's laboratories being used to develop weapons - including chemical or biological agents.
In March, a US air strike hit the university campus, causing speculation about its intended target.
There have been claims that the college of electrical engineering, telecommunication channels, military censors and a propaganda radio station were hit. A former dean of computing science is reported to have been among those killed.
But doubts have been expressed about the university's capacity to develop weapons.
"Everything is already available. Arms and weapons are being brought in from all over the world. Why would they worry about re-inventing them?"
And there is a suggestion that IS has been using the university for the practical reason that it has its own separate and secure power supply.
There have been reports that IS is transferring weapons research and sensitive materials from the university into residential areas.
But other sources say this pattern for concealing armaments has been long established.
"I have seen this ever since Isil took over the city. Suspicious barrels and ammunition would be moved from one house to another every day."
There are others who say the extent of military research remains unknown.
"Frankly speaking, no one knows. There is secrecy around all physics and chemistry labs as well as agricultural materials."
"Isis is losing fighters in battle, losing control of roads, the city is under siege, they are running out of resources.
"The city is starving," says one person bluntly.
This is a picture of an administration under growing pressure, running short of money and becoming increasingly violent and repressive.
"Public executions and stoning happen on a daily basis," but it is hard to get an overview as "the city's neighbourhoods seem like disconnected islands".
Claims have been made recently about particularly gruesome executions, including lowering victims into acid.
"The problem is you have Isis and ignorance and poverty. Ignorance has been gaining ground. People are in desperate circumstances and they are ready to take desperate measures.
"This could mean joining Isis or working for them, because they need bread."
The typical local IS recruits are described as young men from rural areas, needing a regular income, who might have once suffered from sectarianism at the hands of the Iraqi security forces.
"Now, many of them would like to leave Isil, but they know they will be killed immediately."
Many of the city's former leaders and councillors have been killed. Scholars and clergymen who opposed IS were imprisoned or killed and replaced with sympathisers, so the regime has control of the city's mosques.
Women face particular sanctions, including from cane-wielding patrols of vice police.
Foreign fighters, visible at checkpoints, are described as "brainwashed and naive enough to believe the caliphate is a reality".
"They try to give a positive impression and be nice to the kids."
Propaganda is a central feature of the regime. Black flags are hung in public places and neighbourhoods have IS "media outlets".
"It's like a small kiosk with DVDs, LCD screens, projecting their ideology, how they are killing the infidels. They are giving free DVDs to children. And young people and ignorant people are flocking here to see - look at these valiant fighters."
"This culture of violence works both ways. It deters people from doing anything against the will of Isis. And it breeds a generation of ignorant and violent fighters."
There are public executions and "they know children will be present, they want them to be exposed".
"Families with morals and values would shy away from public executions."
But there are fears of a long-lasting traumatic legacy. "Society will need psychological rehabilitation" as well as the reconstruction of buildings.
"It was like a psychological tsunami, we didn't know what to do."
In the middle of the night, with IS forces advancing, people tried to escape towards Iraqi Kurdistan.
"It was terrifying. I leaned against the wall of my house, hearing the gunshots and screaming. I was in a state of loss, knowing I was heading to nowhere.
"It was the most tragic and unforgettable exodus I will ever witness in my life. There were people in massive numbers, cars, children, everything you can imagine, trying to escape."
This is a city waiting for an attack.
"There is a culture of fear and persecution, people are slowly dying."
There are warnings that IS is using "resentment" at the air raids to "drive a wedge between the coalition and the civilians in the city".
There are calls for emergency arrangements to be put in place so civilians can be evacuated. There is also an expectation of a bitter fight.
"Mosul is their last resort, their last functioning city. They will fight to the last man."
Institute of International Education president Allan Goodman says their contacts with Mosul academics show a "harrowing" story.
"Put yourself in their shoes. We're hearing that anyone in an Isis-controlled area is always afraid," says Dr Goodman.
Mark Angelson, chairman of the Scholar Rescue Fund, said: "Professors are offered no alternative - either conform or be killed."
Almost exactly two years ago, Iraq's second biggest city, Mosul, was overrun by the forces of so-called Islamic State (IS).