In Linux there is a hierarchical file system. We can mount additional child file systems uner this file system or we can mount a storage device with the help of Linux mount command. By doing this, we make this file system or a storage device accessible in the existing Linux system. In this Linux lesson, we will learn about mounting.
You can check Linux Commands Cheat Sheet for more Linux commands.
Table of Contents
Linux mount command can be use with or without any options. If you use Linux mount command without options, it displays all the mounted file systems, mount points and mount options.
Beside using this command alone, we can also use additional options with mount. One of them is -t options. With -t option, we can define the type of the file that will be mounted to the system. This can be any of the file types like ext2, ext3, ext4, xfs, btrfs, vfat, sysfs, proc, nfs and cifs.
If we use this command without other parameter, it shows only that file system.
We can use also -a option to mount all devices described at /etc/fstab.
If we use -l option with mount, it lists all the file systems mounted yet.
To mount something in Linux system, we will use the below syntax:
mount -t type device dir
/etc/fstab is the place in which there are information about which device need to be mount where. If we leave dir part, it checks for a mount point in /etc/fstab.
To mount a file system, we need to specify the file system that we will mount and the mount point. For example, if we mount /dev/sdb1 file system to the /mnt/media direcrıty, we will use the below comman:
To mount a USB drive, we use Linux mount command. To do this, again, we specify the name of the usb drive with its location and give also the target mount place.
We sometimes mount ISO files to use them on our Linux system. In Linux mount an ISO is not difficult. To do this, we need to map the data of this ISO to a loop device. We will use -o loop option for this process.
Linux umount command is used to do a reverse job with mount command. With Linux umouth command, we detach any file or a storage device from Linux system.
Leave a Reply