Categories
Linux Tutorial Series

Linux Tutorial Series – 147 – Why is unmounting important?

Here is the video version, if you prefer it:

When you attach a new device to your machine, it is most likely automatically mounted (at least it is on my Debian 10). However, when you want to stop using the device, it is always a good idea to right click on it (in the GUI) and press something along the lines of “Safely remove device”. Why is it so?

You see, in operating systems, there are these things called buffers. Think of buffers like this. Let’s say you were transporting a bunch of wooden planks. The guy who has the truck to transport it comes to your driveway, takes all the planks at your driveway and drives them to the destination. The problem is that it takes a very long time for the driver to go from your house to the destination. So, if you were to carry planks on a plank-by-plank basis and you always waited for the driver with only one plank in your hands, the job would take a very, very long time. But, you can carry planks on the driveway and once the driver arrives, he picks up all the planks on the driveway and drives them to the destination. In this analogy, your driveway is the buffer.

This driving wooden planks analogy can be used to explain writing data to an attached device (such as an USB or an external hard drive). Your operating system has a buffer to which it writes the data and then it writes the data from the buffer to your external device, because data can be written much faster from your operating system to the buffer than from the buffer to your external device. The buffer exists to equalize the speed difference.

So now we come to the reason why unmounting is important – unmounting makes sure that all of the data in the buffer is written to the external device. This happens, again, because writing to the buffer is a lot faster than it is to transfer data from the buffer to an external device.

Hope you learned something interesting today!

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

Your email address will not be published. Required fields are marked *