..


Sponsored Links

The commands mount and umount

Article written by Stefano Cancedda

In systems that refer to the Linux world (or, more correctly, in unix-like) data storage devices are detected by the operating system when connected to the computer, but their file systems are not "integrated" into the automatically "global file system".

This process of "engagement" is by the mount command which connects the device's filesystem to the filesystem overall system by inserting it inside the 'directory tree (in any Linux system, a drive is represented as if it were a shared folder).
The inverse operation, which releases a mounted filesystem, you say you run through the disassembly and umount.

By way of comparison, regarding the Windows world, the mount operation is hidden by the operating system. This, in fact, and runs at startup, automatically, every time a new device is connected (consider, for example in the case of USB sticks).

On Linux systems, the mount operation is performed automatically at startup if the root directory (/) and, usually, also the insertion of a removable device. In some circumstances, however, is certainly useful to be able to do this by using manual controls.

The mount command has two basic parameters:

  • the location of the device to be mounted (eg / dev/sda1)
  • the path to the directory where you intend to mount
Optionally, other types are parameter.

Mount is launched with the following basic syntax:

 



 mount <device_da_montare> <percorso_destinazione>

 
If you want to use to explicitly specify the filesystem using the-t
 



 mount [-t <filesystem>] <device_da_montare> <percorso_destinazione>

 
The valid file for your system are listed in proc / filesystems. Usually this statement will be enough to see them:
 



 cat / proc / filesystems

 
The device LOOP
The loop device is a device that makes visible the virtual block to a file system as if it were a storage device.
Some files in a regular structure such as virtual images (eg ISO) are particularly suitable to be represented by an entire file system.
Through the loop you can do this mount.
The loop is done by launching the command mount with mount-o loop, followed by the file name and destination that will be used as the root.
 



 # Mount-o loop image.iso / mnt / disk

 
Force option
In some cases it is necessary to force the installation of a device as this is for some reason in a state of lock. The forced assembly is called with the syntax:
 



 <device_da_montare> <percorso_destinazione> mount-o force

 
Removing a device
The disassembly operation is usually less critical. Can be made simply by using the syntax:
 



 umount device

 
You can also remove a device as a parameter specifying the directory to umount when the device is mounted:
 



 umount directory_mountpoint

 
View a list of mounted devices
The list of mounted devices can be viewed in different ways, the simplest is to run the mount command without any parameters, as shown in the screenshot.

In the same category ...
E-Learning
Linux (Course) Linux (Course)
Complete guide to open-source system. From 49 €.
PHP (Course) PHP (Course)
Full course for creating dynamic Web sites. From 49 €.
Ruby and Ruby on Rails (Course) Ruby and Ruby on Rails (Course)
Create software and Web applications with Ruby and RoR. From 39 €.
Sponsored Links