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.

During an ill-fated attempt to get tinycore linux to boot from a USB drive I managed to create a bunch of files that I now cannot remove.

fortino@rebel:/media/working/boot/isolinux$ rm *.*
rm: cannot remove `boot.cat': Read-only file system
rm: cannot remove `boot.msg': Read-only file system
rm: cannot remove `isolinux.bin': Read-only file system
rm: cannot remove `isolinux.cfg': Read-only file system

I tried giving myself w and x permission for the files but that didn't appear to work.

What is the best way to clean these files off of this USB drive?

Thank you

share|improve this question
    
Did you try just wiping out the filesystem via format? –  ennuikiller May 15 '11 at 22:38
    
@ennuikiller - that is what I ultimately had to do. I was trying to see if there was a more subtle or elegant way of doing it in an effort to better understand what was going on. In the end that was all that worked though. –  KennyPeanuts May 16 '11 at 14:05

3 Answers 3

up vote 2 down vote accepted

First try to umount and mount is again as read write.

If that don't work create a new filesystem and/or partitiontable, and for that you can use fdisk and mkfs.ext4 or mkfs.vfat.

share|improve this answer
    
thanks for the suggestion. Mounting as rw alone doesn't work - it looks like I may have to go with your second suggestion to just remake the file system. –  KennyPeanuts May 16 '11 at 13:17

Did you put an ext2/ext3/ext4 filesystem on the drive? If so, it can automatically become mounted read-only if there are input/output errors. This comes from the remount-ro mount option (however, I think this option doesn't exist for (v)fat, which is usually used on boot media). Check in your kernel logs (typically /var/log/kern.log) for errors concerning /dev/sdb (or whatever /dev/* is that USB drive).

You can try mount -o remount,rw /mount/point to access the drive as read-write again, or simply unmount and remount. However, note that if this is the cause of the read-only mount, then the system did it because there was an error, to stop the situation from becoming worse, so there's a small chance the filesystem might not be salvageable anymore. Also, if the error was due to a hardware defect, you should replace the hardware, of course.

share|improve this answer
    
thanks for the suggestion. It appeared to remount as rw but it still didn't allow me to remove it... even with rm -f as root. –  KennyPeanuts May 16 '11 at 13:09
    
@Kenny - When the say read-only they really mean it eh? –  boehj May 16 '11 at 13:19
    
@boehj - seriously! I am glad I didn't have anything else on that USB so I could just go with the nuclear option. –  KennyPeanuts May 16 '11 at 13:30

How about becoming root and doing:

# rm -f *

in the proper directory of course.

EDIT

It just occurred to me that some flash drives have a physical 'ro' switch. I wonder if that's the cause of your problem.

share|improve this answer
    
thanks for the suggestion. I think I intentionally purged the idea of running rm -f as root from my brain for my own good but unfortunately it didn't work it still gives me the Read-only file system error –  KennyPeanuts May 16 '11 at 13:06

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.