How to Mount/Unmount a File System in Linux

Windows Articles

How to install Django on Ubuntu 20.04?

Developing web applications is usually related to PHP frameworks. However, Python, which is a very versatile programming language, also has a framework...

How to install the Development and build tools on Ubuntu 20.04?

In this very short post, you will learn how to install a series of development and build tools on Ubuntu 20.04. These...

How to set a drive as read-only in Windows 10

Hello! Hard drives are a fundamental element in any operating system. Of course, Windows 10 is no exception. In fact, this is...

How to create a new KVM virtual Machine on Debian 10?

In the previous post, we explained how to install KVM on Debian 10. Now it's time to create a KVM Virtual Machine.

How to repair a USB drive in Windows 10.

Hi! USB sticks are undoubtedly very functional elements for working in Windows 10. Indeed, their use ranges from file management to creating...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

–blocLinux is a really powerful system in case of the storage management. Because of all the systems, it has to go through, Linux ensures the top-notch security of all the OS in the world. If you connect a SATA/PATA or SCSI device, you can’t access it directly. You have to manually mount the filesystem to get access to it. Now, let’s take a look how to mount the filesystem.

Mounting a filesystem

At first, connect the device to your Linux system. We’ll be using “hwinfo” for this purpose. This tool is available in Ubuntu, Fedora, and OpenSUSE.

sudo apt install hwinfo

Identify the disk by running the following command:

hwinfo --block --short

Now, run this command to mount the file system:

sudo mount /dev/sdb

Generally, you don’t have to specify the file system type as Linux will automatically understand the file system type. In the case of above command, you can also specify the mount point for the drive. For example, running command will mount the “/dev/sdb” as “/data”.

sudo mount /dev/sdb /data

Before using other options, you need to understand the structure of “mount”.

mount [-t file_system_type] [-o mount_options] device mount_point_directory

There are several available options with “mount” command.

  • remount – Unmounts and mounts a file system. It’s really useful if you have made changes in the “/etc/fstab” file. Use this command to apply the changes.
  • exec, noexec – You can define whether any executable can be run from the file system or not.
  • ro, rw – You can make sure whether the file system will be read-only (ro) or writable (rw).

Unmounting the file system

After using the file system, it’s better to unmount it again if you’re not using. Use this command:

sudo umount /dev/sdb

You can also use the mount point for unmounting the file system.

sudo umount /data

If you get an error like the directory is being used by other apps, use this command to identify the processes that are accessing the file system at the time.

Force-unmounting the file system

In some scenario, the kernel sees the file system as “busy”, no matter whatever you do. In that case, forced unmounting is the only option. Use this command for force-unmount:

umount -f /dev/sdb

This should be used as a last resort and you’re sure of it.

List mounted file systems

If you’re interested in finding out all the available (mounted) file systems, run this command:

mount

Enjoy!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install Django on Ubuntu 20.04?

Developing web applications is usually related to PHP frameworks. However, Python, which is a very versatile programming language, also has a framework...

How to install the Development and build tools on Ubuntu 20.04?

In this very short post, you will learn how to install a series of development and build tools on Ubuntu 20.04. These...

How to set a drive as read-only in Windows 10

Hello! Hard drives are a fundamental element in any operating system. Of course, Windows 10 is no exception. In fact, this is...

How to create a new KVM virtual Machine on Debian 10?

In the previous post, we explained how to install KVM on Debian 10. Now it's time to create a KVM Virtual Machine.

How to repair a USB drive in Windows 10.

Hi! USB sticks are undoubtedly very functional elements for working in Windows 10. Indeed, their use ranges from file management to creating...