• Home
  • Disclaimer
  • Contact
  • Archives
  • About
  • Subscribe
  • Support
  • Advertise

Kernel Talks

Unix, Linux, & Cloud!

  • How-to guides
    • Howto
    • Disk management
    • Configurations
  • OS
    • HPUX
    • Linux
  • Commands & tools
    • Commands
    • Software & Tools
    • System services
  • Cloud computing
    • AWS CSA preparation guide!
    • Cloud Services
  • Tips & Tricks
  • Linux commands
You are here: Home / Howto

How to remount filesystem in the read-write mode under Linux

Published: January 10, 2018 | Modified: June 25, 2020 | 30,734 views



Learn how to remount the file system in the read-write mode under Linux. The article also explains how to check if the file system is read-only and how to clean the file system

Re-mount filesystem as read-write

Most of the time on newly created file systems of NFS filesystems we see an error like below :

root@kerneltalks # touch file1
touch: cannot touch ‘file1’: Read-only file system

This is because the file system is mounted as read-only. In such a scenario you have to mount it in read-write mode. Before that, we will see how to check if the file system is mounted in read-only mode and then we will get to how to remount it as a read-write filesystem.

How to check if file system is read only

To confirm file system is mounted in read only mode use below command –

# cat /proc/mounts | grep datastore
/dev/xvdf /datastore ext3 ro,seclabel,relatime,data=ordered 0 0

Grep your mount point in cat /proc/mounts and observer third column which shows all options which are used in the mounted file system. Here ro denotes file system is mounted read-only.

You can also get these details using mount -v command

root@kerneltalks # mount -v |grep datastore
/dev/xvdf on /datastore type ext3 (ro,relatime,seclabel,data=ordered)

In this output. file system options are listed in braces at last column.

Re-mount file system in read-write mode

To remount file system in read-write mode use below command –

root@kerneltalks # mount -o remount,rw /datastore

root@kerneltalks # mount -v |grep datastore
/dev/xvdf on /datastore type ext3 (rw,relatime,seclabel,data=ordered)

Observe after re-mounting option ro changed to rw. Now, the file system is mounted as read-write and now you can write files in it.

Note : It is recommended to fsck file system before re mounting it.

You can check file system by running fsck on its volume.

root@kerneltalks # df -h /datastore
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda2       10G  881M  9.2G   9% /

root@kerneltalks # fsck /dev/xvdf
fsck from util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
/dev/xvdf: clean, 12/655360 files, 79696/2621440 blocks

Sometimes there are some corrections that need to be made on a file system that needs a reboot to make sure there are no processes are accessing the file system.

⇠ Previous article
How to list YUM repositories in RHEL / CentOS
Next article ⇢
Documentary films on Linux!

Related stuff:

  • How to configure SFTP with restricted directory access
  • Execute command at shutdown and boot in Suse Linux
  • How to safely remove disk from LVM
  • Step by step procedure to take ignite tape backup in HPUX
  • How to install EC2 Linux server in AWS with screenshots
  • Create nice text banner in HPUX
  • How to execute command inside Docker container
  • How to remove password expiry in linux
  • How to disable direct root login on Linux & HPUX
  • How to enable repository using subscription-manager in RHEL
  • How to save top command output in file
  • How to install patch/software in HPUX

Filed Under: Howto Tagged With: how to check file system options, how to fsck file system, how to mount read only filesystem as read write, how to scan file system

If you like my tutorials and if they helped you in any way, then

  • Consider buying me a cup of coffee via paypal!
  • Subscribe to our newsletter here!
  • Like KernelTalks Facebook page.
  • Follow us on Twitter.
  • Add our RSS feed to your feed reader.

Comments

  1. Rohit says

    January 21, 2021 at 1:29 pm

    I have tried the above solution but it’s didn’t work in my case. This problem arises because windows doesn’t unmount the disks properly on shutdown just for the sake of faster boot of windows. The solution is turning off the optiion of fast startup from Right Click Windows Button>Power Options>Additional Power Settings>Change settings which are not available>Uncheck the fast start up option > Save changes.
    And you are done.

    Reply

Share Your Comments & Feedback: Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get fresh content from KernelTalks

  • Email
  • Facebook
  • RSS
  • Twitter

Popular posts

  • How to start, stop & restart MariaDB server in Linux
  • How to rescan disk in Linux after extending VMware disk
  • How to reset iptables to the default settings
  • 4 ways to check the size of physical memory (RAM) in Linux
  • How to list YUM repositories in RHEL / CentOS
  • mount.nfs: requested NFS version or transport protocol is not supported
  • How to configure login banners in Linux (RedHat, Ubuntu, CentOS, Fedora)
  • How to remount filesystem in the read-write mode under Linux
  • MobaXterm X11 proxy: Authorisation not recognised
  • What are the huge pages in Linux?

Get Linux & Unix stuff right into your mailbox. Subscribe now!

* indicates required

This work is licensed under a CC-BY-NC license · Privacy Policy
© Copyright 2016-2020 KernelTalks · All Rights Reserved.
The content is copyrighted to Shrikant Lavhate & can not be reproduced either online or offline without prior permission.