Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I make an fstab entry to try to first mount as read-write, and if it that fails, as read-only?

share|improve this question
    
If I try to mount a read-only block device, the mount command automatically falls back to mounting the file system read-only. This is the message printed by mount when I do so: mount: block device /dev/loop2 is write-protected, mounting read-only – kasperd Feb 22 at 17:10

You have to set options to errors=remount-ro your entry will look like:

<device>  <mount point> <fs type> errors=remount-ro <dump> <pass>
share|improve this answer
    
This does not sound exactly what was being asked for. remount-ro is used to turn a file system previously mounted read-write into one mounted (more or less) read-only in case any file system corruption is detected. The question to me sounds like it is asking for the file system to be mounted read-only if mounting read-write is not possible in the first place. – kasperd Feb 22 at 17:09
    
Yeah, this wasn't what I was asking after all. – Det Feb 25 at 21:42

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.