How to mount and unmount a drive in linux

How To Mount A Drive In Linux

This simple step by step guide will show you how to mount a new hard drive or partitions onto your Linux server

Initially you wanna check the hard drives on your system

fdisk -l

so now you now whats being seen by the system

Command Line

mount /dev/partitionId /some/mounting/point
for example
mount /dev/sdb /backup

The mounting point path must already be created with proper permissions. So a more likely flow of commands would be below:

Command Line

mkdir /some/mounting/point
chmod 777 /some/mounting/point
mount /dev/partitionId /some/mounting/point
for example:
mkdir /backup
chmod 777 /backup
mount /dev/sdb /backup
Now you just need to add the addon hard drive into fstab to be booted on startup as well
nano /etc/fstab

How To Unmount A Drive In Linux

Command Line

umount /dev/partitionId

This command is very easy to type wrong. It is NOT unmount. Take another closer look if thats what you saw at first. It is umount — no n here!