How to Mount and Unmount Filesystem in Linux

Mount is a point to access a filesystem in Linux. You can mount a filesystem on any directory and access material by simply entering to that directory. In Linux terms, these directories are known as mount points. This guide will help you to mount and unmount filesystem in Linux system.

1. Use mount Command

Mostly, each Linux/Unix operating systems provides mount command. This command is used to mount any file system on any directory. After that you can access the filesystem content.

mount [-t fstype] filesystem mountpoint

For example, you have added a disk /dev/sda on your system. Now you want to mount this on /data directory. You can use the following command to mount it.

mount /dev/sda /data

This command will automatically detects the file system on disk. But in some cases, you have to specify the file system type with command.

mount -t ext4 /dev/sda /data

2. Unmount Filesystem

Use umount command to unmount any mounted filesystem on your system. Run umount command with disk name or mount point name to unmount currently mounted disk.

umount /dev/sda
umount /data

3. Mount Disk on System Boot

You have to mount disk on system boot. So that partitions will be available on system boot. /etc/fstab file is used to mount disks. You need to edit /etc/fstab and add new entry to mount the partitions automatically.

Edit /etc/fstab and append below line at end of file. Change /dev/sda with your disk name.

/dev/sda /data ext4 defaults 0 0

Now run mount -a command to immediate mount all disk defined in /etc/fstab file.

mount -a

That’s all we have to do, Previously I have write about How To-Install AjaXplorer ( File Sharing Software ) On Linux. Please check and give your opinion below if you experience any issues or to discuss your ideas and experiences.