Introduction To Filesystems
Data on a computer, as you may know, is stored in binary as a series of 1s and 0s. The way these are stored on a device and their structure is called the "filesystem". In Linux devices are referenced in /dev. Data is not actually stored on a device so you cannot access this data by going into /dev, this is because it is stored inside the filesystem on the device so you need to access these filesystems somehow. Accessing such filesystems is called "mounting" them, and in Linux (like any UNIX system) you can mount filesystems into any directory, that is, make the files stored in that filesystem accessible when you go into a certain directory. These directories are called the "mount points" of a filesystem. In other systems this is done differently. For example in Windows there is no distinction made between a device and the filesystem on it, and the user is restricted to mounting a device’s filesystem in a top-level volume which is automatically assigned a letter such as C:, D:, etc. and the files inside these filesystems are accessed inside each volume’s root such as "C:\", "D:\", "E:\", etc. (remember, Windows uses back slashes instead of the more common forward slashes you find in Linux)
Linux only has one top-level volume which is kept in the system’s RAM. It too has a root, but since there is only one top-level volume there is no point giving it a label (as there is nothing to distinguish it from) which means that all files in a Linux system are accessed via simply "/". This top-level volume is kept in RAM, but the files themselves are stored on various drives (some real and some fake) (also, files may be kept in the RAM before they are written to disc for reasons which I will explain further down). A Linux system needs only one "physical" (real) filesystem, which is that of /. However, it is very useful to keep some directories inside / separate. For example, users’ files are often kept on a separate hard drive partition and mounted on /home. Also, the "fake" filesystems can make it much easier to administer and run a Linux system. For example the folder "/proc" does not actually contain any data. In fact, it is "fake" since it shows various files containing useful pieces of information to do with your system, however none of these files actually exist until they are opened, in which case the system does a quick check to find the required information, displays it and pretends that it was there all along.
These system filesystems are all automatically set up, but it is creating custom filesystems and using removable media which allow for some interesting uses of mounting.
What Can Be Mounted
The most common thing to be mounted is a hard drive partition. Hard drives are kept in /dev and have different names depending on what type of drive they are. IDE/ATA drives are labelled as /dev/hda, /dev/hdb, /dev/hdc and /dev/hdd (since a PC’s IDE interfaces can only handle 4 devices at a time). Note that these can be devices such as IDE/ATA CDROMS, Compact Flash to IDE converters, and some special floppy drives (although they tend to appear mainly in laptops). For SCSI devices the labels are /dev/sda, /dev/sdb, /dev/sdc, /dev/sdd, /dev/sde, /dev/sdf, /dev/sdg, /dev/sdh and /dev/sdi (since a SCSI chain can contain up to nine devices). Other types of drive, such as USB, SATA, etc. are mapped to these SCSI devices by Linux. Therefore SATA and USB drives are labelled as /dev/sdX where X is a letter, starting at "a".
Since these are literally the devices you can issue a command such as:
If /dev/hdc is a CD drive then it will eject.
In the case of hard drives, there is another abstraction. A hard drive (and many devices such as USB "sticks" which act like hard drives) can be partitioned to allow many filesystems to be stored on them. This means that the filesystems themselves are accessible via the partition labels, such as /dev/hda1 (the first partition on /dev/hda). This means that we finally know about something we can mount, a partition, since it contains a filesystem.
Another physical filesystem which can be mounted is the ISO9660 filesystem used on CDROMs. Since there is only ever one CD in a CD drive there is no point creating /dev/hdc1 (where /dev/hdc is a CDROM drive) since there is only one filesystem on it. That means that you can mount CD drive devices explicitly, so if /dev/hdc is a CDROM drive then it is possible to mount /dev/hdc if there is a disc in it.
Floppy disks only contain one filesystem, and are labeled as /dev/fd0 for the first drive, /dev/fd1 for the second drive, etc. So now we know three things which can be mounted.
Devices like USB sticks are treated like hard drives (so /dev/sda1, for example, may contain a filesystem) and so are iPods (although I think the main data on an iPod is stored on the second partition)
Mounting is not restricted to physical devices. If you have a filesystem "image" (which IS a filesystem, whether an exact copy of an existing filesystem, or a filesystem created specifically for that file) then you can mount that through the use of a fake device called the "loopback device"
How To Mount/Unmount Filesystems
Unmounting
Firstly I will tell you how to unmount any filesystem you mount after trying these commands. Unmounting is done through the "umount" command, which can be given a device or a mount point so:
Would both unmount the filesystem on /dev/hda1 if it is mounted on /mnt.
Remember that a filesystem cannot be in use when it is unmounted, otherwise umount will give an error. If you know it is safe to unmount a filesystem you can use:
To do a "lazy" unmount
Note that files are often stored temporarily in the RAM to prevent filesystem fragmentation and speed up access times for slow devices like floppy disks. For this reason you should always unmount filesystems before you unplug or eject the device or you may find that your files have not actually been written to your device yet.
Mounting
Is responsible for mounting filesystems. The syntax for this command is quite simple (remember that mount must be run with super user privileges to change the system) so:
Will mount the filesystem on /dev/sda1 (which may be a USB drive, a SATA drive or a SCSI drive) into the folder /mnt. That means that going into /mnt will show you the filesystem which is on /dev/sda1.
Many options can be given to mount. A useful option is the "type" option, when automatic filesystem-type detection fails. An example would be:
That command tells mount to put the filesystem on the first floppy disk into the folder /floppy, and tells it to treat the filesystem as a FAT filesystem. If the wrong type is given then mount will not mount the filesystem and you will be told of the error.
To mount a filesystem contained in a file using the loopback device the command would look like this
To create a filesystem image you can either "dump" an existing filesystem into a file, for example by using the command:
Alternatively you can create an empty file by using:
And then creating a filesystem on this file as if it were a drive by using the command:
Which will create an ext3 filesystem on the device (ext2 with a journal). Images created using either method can be mounted via the loopback device.
An interesting ability of mount is it’s ability to move specific parts of a filesystem around. For example:
Will let the folder "/mnt/Files/Music" also be accessible in /home/user/Music. If you wish to "move" a folder (no data is copied or removed, it is merely displayed in a different place) then use:
Instead. This can come in handy, for example you may have your dual-boot Windows partition mounted in /windows. You can get easier access to your personal files by using:
For windows 98/95 users, and with:
For Windows XP users.
Mount can mount filesystems which are accessed remotely using NFS (the Networked Files System) (Please complete this as I do not know how to use NFS)
Windows NTFS Disks
Permanently mount internal Windows NTFS disks. Install and use the NTFS Configuration Tool (external link) To get it go to the Ubuntu Software Center -> System Tools -> NTFS Configuration Tool -> Install
A. Partitioning (for >2GB Harddisk) (New) (Updated on 18 Jan 2020)
![]()
2. But we cannot mount it right now, if we mount it now, errors will come out. We need to partition it first, we use parted to partition:
3. Within the parted, type the following to have gpt partition, gpt can allow partition larger than 2GB:
4. Set the size for partition, I here partition from 0GB to 4GB:
5. Then quit the parted:
B. Formatting
- Format the newly partitioned harddisk:
C. Mounting (including auto mount after reboot)
- Usually drive is mounted in /mnt/. Create a new directory in /mnt/ first.
2. Then we can mount it by:
3. But we need to mount it for every time we reboot. To mount it automatically after each reboot, I use nano to modify the file /etc/fstab:
4. Enter following at the end of file:
The first item is the path for the hard drive. The second one is the destination for the mounted drive, where we want to mount. The third one is the format type. The forth to sixth one I just kept as defaults, 0 and 0.
D. Checking whether the hard drive is mounted
To check if the drive sdb, is mounted? Use mount command:
- mount
E. Unmounting (Updated on 05 May 2020)
To unmount, simply using the umount command:
But sometimes, the mounted harddisk maybe still in use which makes you cannot unmount. To unmount under this condition, there is a lazy mode:
F. Partitioning Using fdisk (for <2GB Harddisk) (Old)
- First, after connecting the harddisk to the computer by SATA and power cables, we can check the new 4-TB harddisk by:
2. But we cannot mount it right now, if we mount it now, errors will come out. We need to partition it first:
Монтирование дисков в Linux

Существуют совершенно разные методы монтирования дисков в Linux, однако начинающим пользователям проще всего будет взаимодействовать с программами, в которых присутствует графический интерфейс. Одним из таких решений является GParted, по умолчанию установленное во многих популярных дистрибутивах. Предлагаем начать именно с него.
- Запустите операционную систему и отыщите GParted через меню приложений. Запуск осуществляется стандартным кликом по соответствующему значку.

- Для открытия подобных приложений всегда требуется подтверждение подлинности, поэтому придется ввести пароль от root, чтобы запустить окно.

- Здесь отыщите необходимый раздел или физический накопитель, ориентируясь по его названию, файловой системе или размеру. Щелкните по выбранной строке правой кнопкой мыши.
Точно таким же образом осуществляется подключение любых съемных носителей, встроенных жестких дисков или отдельных логических разделов. В большинстве случаев эта операция проходит успешно, но если какая-то ошибка и появится, вы получите соответствующее уведомление с инструкциями по ее решению.
Способ 2: Стандартная утилита «Диски»
В большинстве популярных дистрибутивов имеется стандартная утилита под названием «Диски». Именно она и отвечает за управление накопителями. Если приведенного выше решения на ПК не оказалось или оно вам не подходит, выполните такие действия:
- Воспользуйтесь меню приложений, чтобы отыскать соответствующую утилиту. Запустите ее, нажав по значку.

- Здесь просмотрите существующие разделы. Можно назвать на кнопку в виде шестеренки, чтобы изучить дополнительные параметры и выбрать необходимый логический том для монтирования.

- После выбора остается только нажать на значок в форме треугольника, который и отвечает за подключение.
Как видите, ничего сложного в использовании упомянутой утилиты нет. Юзеру необходимо только определиться с накопителем и нажать на специально отведенную кнопку, чтобы монтирование прошло успешно.
Способ 3: Терминальная команда
Иногда бывает невозможно использовать графическую оболочку, чтобы подключить накопитель или отдельный логический том. В таких ситуациях остается только обратиться к консоли и использовать стандартную команду, отвечающую за монтирование дисков.
- Запустите «Терминал» удобным для вас образом, например, горячей клавишей Ctrl + Alt + T или через меню приложений.

- Введите команду sudo mount -v /dev/sda2 /mnt/ , где /dev/sda2 — название необходимого диска, а /mnt/ — точка монтирования.

- Подтвердите данное действие, введя пароль суперпользователя. Это требуется, поскольку для активации команды был использован аргумент sudo.

- Вы будете уведомлены о том, что данная операция завершена успешно.

Если вы не знаете точное название диска или логического тома, чтобы вписать его в строку, понадобится заранее уточнить эту информацию. Осуществляется поставленная задача тоже при помощи стандартных терминальных команд. Ориентироваться в выводах можно по размеру тома или его заполненности. Более детально о данной теме написано в отдельной статье на нашем сайте по следующей ссылке.
Дополнительно отметим, что у команды mount есть множество полезных опций, позволяющих установить параметры монтирования. Рекомендуем ознакомиться с основными из них:
| Опции | Описание |
|---|---|
| -r | Подключение в формате только для чтения |
| -w | Монтирование с возможностью чтения и записи |
| -c | Использование абсолютных путей |
| -t ext4 | Монтирование файловой системы. Здесь ext4 следует заменить на необходимую ФС |
| -a | Монтирование всех разделов и носителей, указанных в fstab |
Теперь вы знакомы с одной из основных команд в Linux под названием mount и знаете, что она отвечает за подключение дисков. В следующем способе мы тоже будем задействовать эту утилиту, но в немного необычной и более сложной ситуации.
Способ 4: Монтирование окружения в режиме LiveCD
Особого внимания заслуживает метод монтирования окружения или отдельных разделов дисков в режиме загрузки с LiveCD. В большинстве случаев подобное подключение производится конкретно с теми носителями, где хранится основная операционная система, например, для дальнейшего сжатия томов или взаимодействия с файлами. Выглядит эта операция следующим образом:
-
Загрузите компьютер с LiveCD версией дистрибутива. Более детально об этом читайте в официальной документации по приведенной далее ссылке.
Все действия будут осуществляться непосредственно через основную операционную систему, и можно приступить к работе с разделами или имеющимися там файлами.
В этой статье вы узнали о принципах монтирования дисков в Linux. После этого можно смело переходить к их использованию. На нашем сайте имеются отдельные темы, посвященные этому процессу. Предлагаем прочитать их, перейдя по указанным ниже ссылкам.
Mount Drives in Ubuntu Command Line

report this ad
Mounting drives with a graphical user interface is easy. But it becomes a hassle when you don't have access to one.
Well, mounting via the command line is not as easy as doing it in GUI, but it is not super complicated either.
Let me show how to mount drives in Ubuntu command line.
Please enable JavaScript
An introduction to mounting
Mounting is the process in which a drive is made accessible to your Operating System to perform read/write operations. This is common to all OSes.
For example, Windows assigns a drive letter (C, D, E, etc) whilst Linux distributions assign a default path in the /media/<username> or /run/media/<username> folder.
To mount your drive, you should be aware of two things:
- What device you're mounting (/dev/sda2, /dev/vdb1, etc)
- Where you're mounting it (A mounting point)
Of course, there are other ways too, but let's stick to the simple and obvious one, the mount command.
The mount command
The mount command is a very popular one, which lets you mount a drive into a folder of your choice. It supports a wide range of partition types.
The general format of the mount command is
In this command, the following are the ones to note.
- <DEVICE> — The address of the drive you're mounting (/dev/sda2 or any hardware address)
- /PATH/TO/FOLDER — The absolute path of the folder where you're mounting the drive into
- -t <TYPE> — (Optional) Lets you specify the type of partition which is being mounted
Now, let's look at how you can mount the drive.
Step1: Check Partitions in your system
It is essential to know the drive name which you want to mount and for that purpose, you can list available drives using the following command:

The output of lsblk
From here, check what the drive address your device is pointing to. Here, let us mount a removable USB drive.
Step 2: Creating a mounting point
To mount a drive, first, you have to have a place where you can mount it. But to create a mounting point, you don't need anything else but a mkdir command (yes, the mounting point is nothing but a directory):
For example, here, I created a mounting point inside the media directory named Sandisk :
Step 3: Mount the drive
Once you are done creating the mounting point, you can use the mount command in the following manner to mount the drive:
For example, if I want to mount the drive /dev/sdc1 having ext4 FS on a previously created mounting point, I will be using the following:

Mount the drive inside the folder
Our mount-point is also shown in the output of lsblk as follows:

The mount point is displayed in the output of lsblk
Mount drive permanently in Ubuntu
As I mentioned earlier, using the mount command, you can only mount the drive on a temporary basis.
And to make changes permanent, you have to make some changes in the /etc/fstab file.
First, open the /etc/fstab file using the following command:
Go to the end of the file in the nano text editor using Alt + / and add one line in the following syntax:
So if I want to mount /dev/sdc1 having ext4 Filesystem, I will be using the following:
Unmount drives in Ubuntu
To unmount, you can type either the mount point (folder) or the device address with the umount command.
Both of them should do it.
But if any process is occurring while you're trying to unmount the drive, and you do not want that to fail, use the lazy option to unmount automatically when the process ends.
And if you mounted the drive permanently, open the /etc/fstab file and remove the line and then restart the device.
Getting error 'Umount Target is Busy'?
While unmounting, you may get an error saying "Umount Target is Busy" which is the result of the target being busy and you're trying to unmount it.
And here's the detailed guide on how to fix that issue:
Linux Handbook Sagar Sharma

Here's another article that deals with network shares in Ubuntu:
It's FOSS Abhishek Prakash