Recover A Read-Only File System


This article describes how to use utilities to correct filesystem errors.

Prerequisites

To get the most from this guide, you should be familiar with the following articles:

Create a Block Storage Volume

Attaching a Block Storage Volume

Accessing a Block Storage Volume

Introduction

If your volume ever ends up in a read-only state, you can use this guide to fix errors and remount the volume.

Choose the appropriate tab for Linux® or Microsoft® Windows®:

Recover a read-only file system in Linux

We’ll use /dev/xvdb1 as the read-only file system and /mnt as the mount point in this walk-through. Make sure to substitute your volumes wherever needed.

Step 1: Verify read-only status

You can use the touch or the file command to verify that you are actually in read-only mode.

  
      

cd /mnt
touch a-test-file
(out)touch: cannot touch 'a-test-file': Read-only file system


  

Step 2: Unmount the file system

  
      

cd ~
umount /dev/xvdb1
  

  

Step 3: Run a file system check and fix all errors

  
      

fsck /dev/xvdb1
(out)fsck from util-linux 2.31.1
(out)e2fsck 1.44.1 (24-Mar-2018)
(out)/dev/xvdb1: clean, 12/6553600 files, 557849/26214144 blocks
  

  

Note

Note that the fsck output above does not show fsck fixing any errors, since the test volume did not actually have any errors. Your output may differ.

Step 4: Remount your file system

  
      

mount /dev/xvdb1 /mnt


  

Step 5: Verify read-write status

Again, you can use the touch or the file command to verify that you are no longer in read-only mode.

  
      

cd /mnt
file a-test-file
(out)a-test-file: ASCII text, with very long line


  

Recover a read-only file system in Windows

Step 1: Open Explorer

Open the File Explorer utility by clicking the icon on the bottom panel of the desktop.

Windows File Explorer Utility

Step 2: Select Properties

Right click on your volume and select Properties.

Volume Properties

Step 3: Run check

Under Tools, run an error check.

Error Check Tool

Step 4: Correct any errors

Follow the prompts to check for and fix any errors found.

Error Check Prompt

Related Content