Hints and Tips Topic
   >  Mounting a New File System
   >  File System will not Mount
   >  Using Symbolic Links
   >  Kernel Panic - not syncing VFS
   >  Unmounting a File System

 

Unmounting a File System on Linux

How to Temporarily Unmount a Linux Filesystem

Sometimes, you need to ensure that a disc is offline - for example, when running certain disc repair utilities, such as fschk or when replacing hardware. In these cases, it is important that no process (including the operating system itself) is accessing the drive at the same time.

The command to unmount a filesystem in Linux is:

umount <device name>

Note: that the command is umount and not unmount!

For example:

$ sudo umount /dev/sda
$ sudo umount /dev/sdb1
$ umount /media/myuser/PENDRIVE

You can verify the filesystem has been unmounted using the df command - and checking that it is no longer listed:

$ df
Filesystem     1K-blocks     Used           Available Use% Mounted on
/dev/sda1       74866848     62937340   8126424  89%      /
udev                1020744        4                 1020740   1%       /dev
tmpfs               411396          836             410560     1%       /run
none                5120              0                  5120         0%       /run/lock
none                1028480        868             1027612  1%       /run/shm
none                102400          60               102340     1%       /run/user
/dev/sdb1        3909784       3481364    428420     90%     /media/myuser/PENDRIVE

How to Permanently Unmount a Linux Filesystem

If you want to permanently unmount a filesystem (-for example, if the drive is being removed altogether) you will need to remove it from /etc/fstab. This is a text file used by Linux during system startup to tell what should be connected to the system. It can be edited via any text editor - for example:

sudo vi /etc/fstab

The file format is described in the section on Mounting a New File System, but it is simply a case of removing the line for the desired filesystem and saving the changes.

Once you have done this, the next time you boot Linux, that filesystem will no longer be mounted (-or accessible) - unless you manually mount it.

Note: that changes to /etc/fstab will only take effect once you reboot the system


References and Further Reading:


HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button