Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
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?

share|improve this question
2  
Can you share output of mount ? –  warl0ck Aug 7 '12 at 6:31

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer

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?

share|improve this answer

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.