0

I want to remount /dev/sr0 (/media/cdrom0) with the exec option, while leaving all other options as-is.

In the below example, it's clear that sudo mount -o remount,exec attempts to change the ro option to rw, although I only explicitly specify exec.

How can I remount a device without changing options not specified explicitly?

$ mount | grep cdrom
/dev/sr0 on /media/cdrom0 type iso9660 (ro,nosuid,nodev,noexec,relatime,nojoliet,check=s,map=n,blocksize=2048,user)
$ sudo mount -o remount,exec /media/cdrom0
mount: /media/cdrom0: cannot remount /dev/sr0 read-write, is write-protected.
$ sudo mount -o remount,exec,ro /media/cdrom0
$

Is the solution merely to copy paste the list of options output by mount | grep cdrom and provide them in -o remount ...?

0
1

Run man mount and type: /^ +remount$ and hit enter to find the relevant section of the man page, the third paragraph of which says:

The remount functionality follows the standard way the mount command works with options from fstab. This means that mount does not read fstab (or mtab) only when both device and dir are specified.

In other words, if you don't specify both the device and the mount-point, mount -o remount will read /etc/fstab and use the other options found there for that device/mount-point.

i.e. try:

sudo mount -o remount,exec /dev/sr0 /media/cdrom0 

or just use add ,ro as you already did. It's less typing.

2
  • Thanks. I haven’t configured fstab, so will mount read mtab in that case and use the mount options there as defaults for -o remount, only replacing the options explicitly specified?
    – Shuzheng
    May 29 '21 at 18:29
  • When both device and mount point are specified, which options are used by default in that case? The mount default set of options? If so, shouldn’t your command fail, since rw is part of the default set AFAIK?
    – Shuzheng
    May 29 '21 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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