Making the entire filesystem or a specific partition read-only on Ubuntu 20.04 can be a useful security measure or a precautionary step to prevent unintended modifications. The read-only setting ensures that no write operations can be performed on the designated filesystem, safeguarding its integrity and reducing the risk of accidental data loss or unauthorized changes. This process involves modifying the /etc/fstab file, which holds crucial information about disk drives and partitions.

Step 1:

Open the /etc/fstab file using a text editor.

$sudo nano /etc/fstab
$sudo vi /etc/fstab

Step 2:

Identify the line corresponding to the filesystem or partition we want to make read-only. It typically contains information such as device, mount point, filesystem type, and other options.

Step 3:

Add the ro (read-only) option to the list of mount options. Place it after other options, separated by commas.

/dev/sda1 / ext4 errors=remount-ro,ro 0 1

Note: Replace /dev/sda1, /, and ext4 with your actual device, mount point, and filesystem type.

Step 4:

Save the changes made to the /etc/fstab file and exit the text editor.

Step 5:

Remount the filesystem to apply the changes.

$ sudo mount -o remount /


Configuring a filesystem or partition as read-only provides an added layer of protection against accidental modifications or unauthorized write operations. When making the root filesystem read-only, it is essential to carefully consider the implications.

Leave a Reply