How to mount a file system in Linux using the mount command?
In Linux, the mount command can be used to mount a file system. Below are the basic steps for mounting a file system using the mount command.
- the directory named “filesystem”
$ sudo mkdir /mnt/filesystem
- Confirm the device name of the file system to be mounted. Use the lsblk or fdisk -l command to view the list of devices. For example, the device to be mounted is /dev/sda1.
- Mounting a file system using the mount command.
$ sudo mount /dev/sda1 /mnt/filesystem
You can specify the file system type using the -t option.
$ sudo mount -t ext4 /dev/sda1 /mnt/filesystem
- Confirm that the file system is successfully mounted. You can use the command df -h to check the usage of the mounting point. If the file system is successfully mounted, you should be able to see information about it.
- To uninstall the file system, you can use the umount command.
$ sudo umount /mnt/filesystem
Note: Sufficient permission is required when using the mount command to mount a file system. Therefore, it is usually necessary to execute these operations as the root user or using the sudo command.