Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am not talking about tweaking fstab or about the use of the "mount" program... I was thinking of tune4fs, btrfstune and the like : I'd like to know if you've heard of any filesystem being able to declare itself as "read-only by default" to the host system.

I know the read-only attribute is defined and applied on the OS side, but for instance, BTRFS has a "read-only" attribute for snapshots. I could use that (and I might) but I'm not sure this would work and if a more stable FS could do the same, it'd be better.

Regards

EDIT

I know about chmod a-w, of course. But I am not sure chmoding would help to prevent data loss upon power loss.

share|improve this question
2  
If your filesystems are on LVM LVs, you can make the LV read-only (with lvchange -p r). If the underlying block device is read-only, the filesystem has no choice but to become read-only. –  Celada Jan 9 '13 at 16:39
    
Not bad ! I think I'll try this. My only concern about this is that LVM adds a layer between the hardware and my data. That extra layer might not be that resilient to corruption, but still, the idea is appealing. Thanks. –  Gael Jan 10 '13 at 8:17
    
The LVM/device-mapper layer is really quite thin. I don't think it has even the potential to mess with the data. It's akin to using a partition (like /dev/sda1) as opposed to the whole block device (like /dev/sda): it's the same disk blocks, just shifted over by an offset equal to the offset of the start of the partition. –  Celada Jan 10 '13 at 15:04
add comment

1 Answer 1

up vote 0 down vote accepted

Have you considered making the filesystem a btrfs read-only 'seed device'?

# btrfstune -S 1 /dev/device

I have not tried this myself, but the btrfs wiki has more information about how to do this and use case.

share|improve this answer
    
Yes, that was included in "read-only BTRFS snapshots" even if this is about the device, not a simple snapshot. But thank you for pointing that out. I'll wait a couple of days to give the opportunity to others to talk about similar capabilities in other (more stable) FS. –  Gael Jan 10 '13 at 8:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.