How to regenerate /etc/mtab file on Linux

Question: I accidentally messed up (or removed) /etc/mtab file. How can I recreate the original /etc/mtab file which reflects the current mount information?

In case /etc/mtab file is lost or corrupted by accident, and you want to recover the original /etc/mtab file, you can use /proc/mounts, which shows an up-to-date list of all mounts currently used by Linux system.

To reset /etc/mtab file to reflect the current mount information, run the following command.

$ sudo sh -c 'grep -v rootfs /proc/mounts > /etc/mtab'

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *