Make a partition read-only, and revert it

pl flag

Is there a way to flag a partition in a disk (internal, for the case in point, although I doubt this is relevant) to be read-only? I mean to do it from within Ubuntu (that's why I posted here). I imagine that if this is possible/not possible, it would be the same case from Windows

What I mean is to have that RO flag as something the partition table holds, so any OS accessing it (Windows, Linux) will see it as RO. I know how to mount a partition in Linux as RO, but that is a flag in the mount command, not in the partition table.

I don't mean to have the setting/changing of such flag password-locked, other than perhaps accessible only to admins (Win) or sudoers (Linux). So anyone with such access would be able to modify that flag.

For the case I am conceiving (which I am not sure it is possible), an attempt to mount the partition as RW would throw an error. The only way to mount as RW would be to set the corresponding flag in the partition table, and then mount.

If the answer depends on the partition type, I am more interested in ext4, but I am also interested in NTFS and others.

Hardware settings (e.g., jumpers) that apply to entire disks are not useful for my case, in addition to being impractical as compared to software alternatives.


  1. Make file system/partition Read-Only for archiving purposes
ar flag
With ext[234] filesystems, you could use `tune2fs` to set the "read-only" "feature": `tune2fs -O read-only /dev/sdXY`
mook765 avatar
cn flag
I think a partition flag is only available for gpt disks. Take a look at `man gdisk`, the experts menu provides a command to set such attributes, but it's stated that `In practice, most OSes seem to ignore these attributes`.
Raffa avatar
jp flag
`hdparm` might interest you for setting disk(*not partition*) read-only attributes.
sancho.s ReinstateMonicaCellio avatar
@Raffa - That *seems* to be a very similar question as mine. And its answer *seems* very useful (I didn't try it yet to confirm it works for me). OTOH, I am also interested in other types of partitions, as opposed to the linked OP. I think these subtleties have to be taken into account at the time of flagging potential dupes.
Raffa avatar
jp flag
Fair enough ... Retracted that flag.
Raffa avatar
jp flag
Related: [Make file system/partition Read-Only for archiving purposes](
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.