Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

I have configured to automount my ntfs data partition on boot:

# /media/Win8 was on /dev/sda5 during installation
UUID=A47A42FF7A42CDAC /media/Win8     ntfs    defaults,umask=007,gid=46 0       0

this works fine, as long as the partition is cleanly unmounted and windows didn't go to suspend with it (which could be avoided if you wish).

If it is in suspend state it is still safe to mount it readonly with

sudo mount -o ro /media/Win8

How can I tell ubuntu to do this automatically if it cannot mount it rw?

share|improve this question
up vote 0 down vote accepted

You can run this script that will try to remount it read-only if a mount like ordered in /etc/fstab fails:

nano /usr/local/bin/mount-c-ro

and enter

# mount this device
# any folder that exists on that device 

echo try to mount $DEVICE...
sudo mount $DEVICE

if [ -d $CHECK ]; then 
    echo $DEVICE is mounted by /etc/fstab
    echo occurrences in fstab:
    sudo grep $DEVICE /etc/fstab
    echo mounting $DEVICE read-only...
    sudo mount -o ro $DEVICE
    echo done
echo mount status is:
mount |grep $DEVICE

then give it execute right:

chmod +x /usr/local/bin/mount-c-ro

Maybe you can run this automatically at the end of your boot process, but I don't know how and it probably will be a problem that its output is not catched. (maybe it also hat so return 0)

share|improve this answer

Your Answer


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.