29
chmod 777  -R  /mnt  
rm -rf /mnt/*  

rm: cannot remove 'omitted': Read-only file system  
rm: cannot remove 'omitted': Read-only file system  

Please show me how I can do this?

1
  • 2
    Can you share output of mount ?
    – daisy
    Commented Aug 7, 2012 at 6:31

4 Answers 4

29

As the error message says: the filesystem on which omitted is located is read-only. You can't do anything to modify that filesystem, including removing files.

You can check the mount point of the filesystem by running df omitted. It is probably /mnt given the command you're running.

You can remount the filesystem as read-write by running

mount -o remount,rw /mnt

However it would be a good idea to find out why the filesystem was mounted as read-only in the first place. This may be an indication that you should not be deleting those files.

Run mount | grep /mnt to see what options were specified when mounting that filesystem. For an ext2/ext3/ext4 filesystem, if the options did not include ro (read-only) but included errors=remount-ro, it looks like the filesystem was damaged and was automatically remounted as read-only to limit the damage; you will find more information in the kernel logs.

Note that your command attempts to remove the mount point itself, but this is harmless you won't have permission to do it anyway.

By the way, I strongly urge you not to use chmod 777. It is extremely rare to actually need these permissions, and they can cause a lot of harm (especially when you typo the argument, but even when not). If you try to remove a file and get a “permission denied” error, all you need to do is give yourself permission to write to the containing directory: generally, that's chmod -R u+w /path/to/toplevel/directory.

6

You have a device mounted in /mnt/... that is read only

try to umount every folder in /mnt and then try again.

a CD mounted here would cause this problem but are you root?

1

Re-mount did not work for me--but directly unmounting the fifesystem did get rid of it. I was trying to get rid of a directory tree called /Volumes/InstallMe/ on a mac.

/Volumes$ ls -l
total 8
drwxr-xr-x@ 4   204  6 Apr 07:43 InstallMe
lrwxr-xr-x  1   1  1 Feb 21:12 Macintosh HD -> /

/Volumes$ mount -o remount,rw InstallMe/
mount: InstallMe/: unknown special file or file system.

/Volumes$ sudo diskutil unmount InstallMe/
Password:
Unmount successful for InstallMe/

/Volumes$ ls
Macintosh HD
1

I solve that issue going to 'Disks' and repairing the filesystementer image description here

Click on 'Additional partition option'

Then click on 'repair filesystem' and OK.

1
  • This solution worked for me. In my case the file was on a USB thumb drive that is always connected to a KVM switch. Occasionally, switching PC's on the switch will introduce errors on the USB drive and I have to repair the filesystem.
    – Self Dot
    Commented Oct 29, 2023 at 10:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .