I know that a mirror is another server which holds the same data to download as the original server. This is easy to understand, but beyond this, I get the impression that the term "mirrors" in Ubuntu has a more precise meaning which I cant grasp intuitively. I see people talking about how to choose the fastest mirrors and so on, but cannot follow them.

Could you give me a quick explanation of the mirrors in Ubuntu and give me some terms, like files associated with them or important applications to deal with them in an everyday situation, so I can search for further information myself?

up vote 6 down vote accepted

You are asking 2 different questions, or rather you have 2 different tags on your question - repository and mirrors.

Most of the answers have already addressed the why and how behind mirrors. As one more anecdote (and the plural of anecdote is data!) I run a mirror of Mint, Ubuntu, and Debian simply to provide much quicker access in the computer lab I teach in. 20 folks all getting updates at once, or doing netinstalls, or ... goes much quicker at gigabit speed vs. the 5mb internet that feeds the building.

But repositories....

The ideas behind the repos for Ubuntu actually all start with Debian (which Ubuntu is heavily based on) and Debian's package management system which includes the apt utilities in various versions and incarnations (apt, apt-get, aptitude, etc). With the Debian package management system, a standard base system is told where to get software packages and updates from. This could be any number of sources - hard drives, cd-rom/dvd, network share, or via network protocol like http(s), ftp, and rsync. Part of this information includes what software is available, and what packages depend on what other packages all the way down to the base system.

This allows you to run a command like apt-get install task-mate-desktop and the package management system says "well, you need to have this version of libraryA installed, and that version of libraryB installed and foo version 3.14 and ... " and since it knows what you have installed, it knows what it needs to retrieve from the source (quite probably one of those mirrors you were asking about), and it goes gets what it needs and installs it all. Note that the GUI software management tools in Ubuntu et al. are all just front ends to apt and dpkg.

Now, the Debian/Ubuntu/Mint/etc. folks aren't the only ones doing stuff like this. The BSD releases and the ports collection as well as the pkg tool, yum for Redhat and similar distributions, the portage collection from Gentoo, and others.

  • I read, that most of the distros are divided into two package tools: rpm and dpkg. rpm and dpkg are low level pkg tools, they have no intelligence to deal with dependencies on their own. But there are high level pkg tools which are built onto them, yum for rpm and apt-get for dpkg. I do not know which else. This is how I understood it. What is apt, is it the same as apt-get or another low level pkg tool or another hi level pkg tool or something else? – sharkant May 9 '17 at 17:56

You pretty much have it down - a mirror holds a duplicate copy of all of the data on the master server. This exists for redundancy and speed. In a broader sense, a mirror is just a copy of some data for the same purposes. But, I'll just focus on mirror servers for the purposes of this answer.

In Canonical's case (and most cases), mirrors are spread all over the globe in strategic locations. This allows servers to handle less load individually and allows everyone to connect to their nearest server.

On the Internet, distance matters. In fact, it matters a lot. A long connection can cause high latency, slower connection speeds, and pretty much all the other classic issues that data has when it needs to travel across an ocean and half a continent. Therefore, we have these distributed mirrors. People connect to their physically nearest one (as it's usually the fastest -- there are some exceptions) for the lowest latency and highest download speed. Other times, users connect to a few mirrors and manually compare the speeds and choose whichever is the fastest. In some rare cases, users might manually override to use a specific mirror that is not their fastest -- usually for reliability or something special about that particular server.

In some cases, companies will host their own internal mirrors of Apt repositories. These exist to hold sensitive intellectual property or only allow employees to use specific versions. Mirrors don't necessarily need to be exact copies of the parent server.

  • 2
    @FranckDernoncourt There are hundreds of mirrors, and this is a very well known story. Furthermore, that server belongs to MIT and gets many many visits per day. I think it's a safe link. – Kaz Wolfe May 8 '17 at 22:24
  • I see, thanks for the reply. I think links pointing to archive.org are less likely to break, but up to you. – Franck Dernoncourt May 8 '17 at 22:29
  • "The email that couldn't travel any further than 3 millilightseconds..." - nice story :D – Byte Commander May 8 '17 at 23:27
  • I'd like to mention that the link under 'distance matters' is a delightful read. (At first I skipped following it, until I saw the comments.) – YoungFrog May 9 '17 at 17:40

As you find it out yourself, a mirror is another server which mirrors/clones everything from the main server.

There are a lot of advantages behind using mirrors, things like:

Short answer: redundancy, more reliability, backup, fault tolerance, money, performance, speed and many more.

  1. You can choose a mirror which is located in your country or is closer to you or in any other way you have a more reliable and faster access to that.

  2. We have redundancy. Redundancy simply means having more than of on (Copy/Backup) of a resource (Hardware or software) which brings more reliability. When I have access to thousands of mirrors there is a really low chance that I miss something or I lose my access to repositories.

  3. By redundancy it helps me achieve fault tolerance, it means that in any case of accident my services are up and available to my users.

  4. It helps to decrease the costs of servers. If we all use same mirror, it should have a huge resources and bandwidths, so the owner should pay a lot of money for that.

  5. It help us achieve better performance by not a server being used by millions of people.

  6. We can mirror it on our local network and hundreds of machines will work with that repository without the need of going to the Internet.

etc.

Mirror could refer to servers that have the same data as some other computer... like Ubuntu repository mirrors... but it could also could refer to a "disk mirror" or RAID.

In the simplest terms...

Disk Mirror refers to how disk subsystems can be set up for maximum uptime and reliability. Just imagine that you've got a mission-critical computer system running your company's payroll or inventory system. It's got to have 100% up time. In a non-mirrored environment, if you loose a boot hard disk to a hardware failure, typically the system goes down with it. If you loose a database drive, the data is gone, the system is inoperable, the hard disk needs to be replaced, and the database restored from backups. Data loss is very possible.

In the same example, if the boot hard disk had a mirror (another disk with exactly the same data as the boot hard disk) and you lost the primary boot hard disk to a hardware failure, the mirror can "pick up" exactly where the defective disk stops, and the computer system stays running. This also allows the system admin to take the defective hard disk offline, repair it, and return it to service without disrupting the computer system.

  • Good answer, but wrong question I think... – ivanivan May 8 '17 at 22:15
  • @ivanivan Thanks! I was responding to the question portion that asks "there is the term mirrors in Ubuntu which I cant grasp intuitively, they probably have a more specialized meaning". RAID. – heynnema May 8 '17 at 22:32
  • And your very minor edit clears that up nicely :) – ivanivan May 8 '17 at 22:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.