Everyone knows that the primary offensive weapon of an aircraft carrier or a big-deck amphibious assault ship is the aircraft on board. But those planes gotta drop (or fire) something at targets on the ground. Those planes also need stuff to fire at enemy planes (or missiles), as they are also the primary defensive weapon of those ships.
But all that stuff that goes boom needs to be kept somewhere safe. Why? Because if that stuff goes off at the wrong time, the best case can be a very messy situation, like that on the aircraft carrier USS Forrestal (CV 59) off Vietnam.
Aviation Ordnancemen place a weapons cart of GBU-38 500-pound satellite guided bombs on an ordnance elevator on the flight deck of the Nimitz-class aircraft carrier USS Theodore Roosevelt (CVN 71). The bombs are prepared in a ship's magazine, and then lifted up to the flight deck. (U.S. Navy photo by Photographer's Mate Airman Stephen Early)
It can get worse than the fire on the Forrestal. When the escort carrier USS Liscome Bay (CVE 56) was hit off Makin Island in 1943, ordnance blew up, sinking the ship in 23 minutes and killing 644 of her crew. Three of the Japanese carriers that were sunk at Midway, the Akagi, Kaga, and Soryu, all went down due to bombs for their planes going off after they were hit.
Bombs are prepared on board the amphibious assault ship USS Essex (LHD 2). (Youtube screenshot)
The United States learned from World War II. Today, the bomb magazines are kept deep inside carriers and amphibious assault ships. They carry a lot of bombs, missiles, and rockets. These weapons are prepared in the magazines, and then shipped up on special elevators to the flight deck where they can be loaded onto the planes.
An ordnance elevator has brought Joint Direct Attack Munitions for loading onto aircraft on board the amphibious assault ship USS Essex (LHD 2). (Youtube screenshot)
People often describe carriers (as well as the amphibious assault ships) as an airport on top of a floating city. That's not quite the truth. The carriers and amphibious assault ships are airports on top of floating forward operating bases – and they are mobile.
You can see some of the operations of the magazine on board the Wasp-class amphibious assault ship USS Essex (LHD 2) in the video below.