Mount a file system

Linux stores information about where and how partitions should be mounted in the /etc/fstab file. Linux refers to this file and mounts file systems on devices by automatically running the mount -a command (mount all file systems) each time you boot.

Here is an example /etc/fstab file:

etc fstab bile

You can use the mount command to see what file systems are currently mounted on the Linux system. Here is an example:

linux mount command

You can also use the mount command to manually mount a file system. This is usually done with removeable devices such as DVDs and CDs. The syntax for this command is:

mount -t FILE_SYSTEM_TYPE DEVICE MOUNT_POINT

You can usually omit the file system type parameter since Linux does a good job of detecting the file system type. For example, to mount a CD ROM on /mount_point, we can use the following command:

linux mount cd rom

We had to create the /mount_point directory before we’ve used the command above.

 

To unmount a device, you can use the umount command. You need to provide a directory name or a device name. For example, to unmount the device mounted above, we can use the following command:

linux umount command

Geek University 2022