The first libraries were composed for the most part, of unpublished records, a particular type of library called archives. Archaeological findings from the ancient city-states of Sumer have revealed temple rooms full of clay tablets in cuneiform script. These archives were made up almost completely of the records of commercial transactions or inventories, with only a few documents touching theological matters, historical records or legends. Things were much the same in the government and temple records on papyrus of Ancient Egypt.
The earliest discovered private archives were kept at Ugarit; besides correspondence and inventories, texts of myths may have been standardized practice-texts for teaching new scribes. There is also evidence of libraries at Nippur about 1900 B.C. and those at Nineveh about 700 B.C. showing a library classification system.
Over 30,000 clay tablets from the Library of Ashurbanipal have been discovered at Ninevah , providing archaeologists with an amazing wealth of Mesopotamian literary, religious and administrative work. Among the findings were the Enuma Elish , also known as the Epic of Creation, which depicts a traditional Babylonian view of creation, the Epic of Gilgamesh, a large selection of “omen texts” including Enuma Anu Enlil which “contained omens dealing with the moon, its visibility, eclipses, and conjunction with planets and fixed stars, the sun, its corona, spots, and eclipses, the weather, namely lightning, thunder, and clouds, and the planets and their visibility, appearance, and stations.”, and astronomic/astrological texts, as well as standard lists used by scribes and scholars such as word lists, bilingual vocabularies, lists of signs and synonyms, and lists of medical diagnoses.
 Libraries in Persian Empire
During the Achaemenid Persian Empire (558–330 BC) the religious and scientific books of Persia since Zoroaster, were archived in the libraries of "Ganj-i-hapigan" in Takht-i-Suleiman and "Dez-i-Napesht" in Persepolis. These books were probably in the fields of philosophy, astronomy, alchemy and medical sciences, the fields in which Magus of Persia were master in. After the invasion of Persia by Alexander the great all these books were burned. It has been mentioned in the book Arda Viraf that :
"He came to Persia with severe cruelty and war and devastation... and destroyed the metropolis and empire, and made them desolate... all the avesta and zand, written upon prepared cow-skins and with gold ink, was deposited in the archives... he burned them up."
 Libraries in the Hellenic world and Rome
Private or personal libraries made up of non-fiction and fiction books (as opposed to the state or institutional records kept in archives) appeared in classical Greece in the 5th century BC. The celebrated book collectors of Hellenistic Antiquity were listed in the late second century in Deipnosophistae:
Polycrates of Samos and Pisistratus who was tyrant of Athens, and Euclides who was himself also an Athenian and Nicorrates of Samos and even the kings of Pergamos, and Euripides the poet and Aristotle the philosopher, and Nelius his librarian; from whom they say our countryman Ptolemæus, surnamed Philadelphus, bought them all, and transported them, with all those which he had collected at Athens and at Rhodes to his own beautiful Alexandria.
All these libraries were Greek; the cultivated Hellenized diners in Deipnosophistae pass over the libraries of Rome in silence. By the time of Augustus there were public libraries near the forums of Rome: there were libraries in the Porticus Octaviae near the Theatre of Marcellus, in the temple of Apollo Palatinus, and in the Biblioteca Ulpiana in the Forum of Trajan. The state archives were kept in a structure on the slope between the Roman Forum and the Capitoline Hill.
Private libraries appeared during the late republic: Seneca inveighed against libraries fitted out for show by non-reading owners who scarcely read their titles in the course of a lifetime, but displayed the scrolls in bookcases (armaria) of citrus wood inlaid with ivory that ran right to the ceiling: "by now, like bathrooms and hot water, a library is got up as standard equipment for a fine house (domus). Libraries were amenities suited to a villa, such as Cicero's at Tusculum, Maecenas's several villas, or Livy the Younger's, all described in surving letters. At the Villa of the Papyri at Herculaneum, apparently the villa of Caesar's father-in-law, the Greek library has been partly preserved in volcanic ash; archaeologists speculate that a Latin library, kept separate from the Greek one, may await discovery at the site.
In the West, the first public libraries were established under the Roman Empire as each succeeding emperor strove to open one or many which outshone that of his predecessor. Unlike the Greek libraries, readers had direct access to the scrolls, which were kept on shelves built into the walls of a large room. Reading or copying was normally done in the room itself. The surviving records give only a few instances of lending features. As a rule Roman public libraries were bilingual: they had a Latin room and a Greek room. Most of the large Roman baths were also cultural centers, built from the start with a library, with the usual two room arrangement for Greek and Latin texts.
Libraries were filled with parchment scrolls as at Library of Pergamum and on papyrus scrolls as at Alexandria: export of prepared writing materials was a staple of commerce. There were a few institutional or royal libraries like the Library of Alexandria which were open to an educated public, but on the whole collections were private. In those rare cases where it was possible for a scholar to consult library books there seems to have been no direct access to the stacks. In all recorded cases the books were kept in a relatively small room where the staff went to get them for the readers, who had to consult them in an adjoining hall or covered walkway.
The Royal Library of Alexandria in Alexandria, Egypt, was once the largest library in the ancient world. In 642 after the Byzantine army was defeated at the Battle of Heliopolis the Muslim commander asked the caliph Umar what to do with the library. He gave the famous answer: "They will either contradict the Koran, in which case they are heresy, or they will agree with it, so they are superfluous." The Arabs subsequently burned the books to heat bathwater for the soldiers.
In the sixth century, at the very close of the Classical period, the great libraries of the Mediterranean world remained those of Constantinople and Alexandria. Cassiodorus, minister to Theodoric, established a monastery at Vivarium in the heel of Italy with a library where he attempted to bring Greek learning to Latin readers and preserve texts both sacred and secular for future generations. As its unofficial librarian, Cassiodorus not only collected as many manuscripts as he could, he also wrote treatises aimed at instructing his monks in the proper uses of reading and methods for copying texts accurately. In the end, however, the library at Vivarium was dispersed and lost within a century.
Through Origen and especially the scholarly presbyter Pamphilus of Caesarea, an avid collector of books of Scripture, the theological school of Caesarea won a reputation for having the most extensive ecclesiastical library of the time, containing more than 30,000 manuscripts: Gregory Nazianzus, Basil the Great, Jerome and others came to study there.
With education firmly in Christian hands, however, many of the works of classical antiquity were no longer considered useful. Old texts were washed off the valuable parchment and papyrus, which were reused, forming palimpsests. As scrolls gave way to the new book-form, the codex, which was universally used for Christian literature, old manuscript scrolls were cut apart and used to stiffen leather bindings.
 Ancient Chinese libraries
Little is known about early Chinese libraries, save what is written about the imperial library which began with the Qin Dynasty. One of the curators of the imperial library in the Han Dynasty is believed to have been the first to establish a library classification system and the first book notation system. At this time the library catalog was written on scrolls of fine silk and stored in silk bags