rm: cannot remove file: Read-only file system


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers rm: cannot remove file: Read-only file system
# 1  
Old 12-22-2011
rm: cannot remove file: Read-only file system

I have a file on a usb stick which I cannot remove and the following error message shows:
rm: cannot remove `file-name': Read-only file system

The usb stick is mounted as read-only on an Ubuntu system:
Code:
$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/dev/sdb1 on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,uid=1000,umask=0077,shortname=winnt,utf8)

How can I mount it read and write without having to log in as root?
# 2  
Old 12-22-2011
If you don't have root and can't get root, you can't run mount -o remount,rw /media/disk. Any mount operation, even "user" ones, requires CAP_SYS_ADMIN. User ones only work because /bin/mount is a setuid executable. GUI's only get away with automounting by getting root permissions somehow. And so forth.

That said, how did this filesystem become read-only? Check your dmesg. Linux will force a filesystem read-only if an I/O error happens to it.
# 3  
Old 12-22-2011
When running dmesg I get lots of messages I have not seen before within dmesg:
Code:
[  313.420846] FAT: Filesystem error (dev sdb1)
[  313.420849]     fat_get_cluster: invalid cluster chain (i_pos 193270281)
[  268.192008] FAT: FAT read failed (blocknr 8688)
[  268.290867] FAT: Directory bread(block 12079392) failed

So it is a bit of a mystery as this happened suddenly. Also the situation did not change when running sudo mount -o remount,rw /media/disk
So perhaps best to restart the computer.
# 4  
Old 12-22-2011
It's having difficulty reading the flash drive, for sure. A reboot would be a good start.

Even if it starts working again, back up that drive just to be safe.
# 5  
Old 12-23-2011
I have done some rebooting already, which did not yield any change. Could this a sign of pending file corruption just because it is on a USB stick?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read value of a file, remove first 2 chars and put this value in a variable

Hi i have need of read a file value with cat command and remove first 2character for example cat /sys/class/rtc/day 0x12 Remove char 12 And put this value in a variable is possible with a script thanks for help (6 Replies)
Discussion started by: enaud
6 Replies

2. UNIX for Dummies Questions & Answers

chown: Read-only file system

Hi, I am logged in as super use and want to set owner of a root folder to a specific user. #chown -R user1:group1 /u01 This gives the message: chown: /u01: Read-only file system chown: lost+found: Read-only file system #ls -l drwxr-xr-x 3 root system 256 Mar 21 16:42... (2 Replies)
Discussion started by: shoefiend
2 Replies

3. Red Hat

Read only file system : File show as ? ? ? ?

I have a test system, user which I have my home directory. /home/hansini The files under this directory show as ?--------- ? ? ? ? ? sam.sh ?--------- ? ? ? ? ? DDD I know on the test system OS is corrupt and it is read only file system. If I go to some other... (2 Replies)
Discussion started by: hansini
2 Replies

4. OS X (Apple)

Read-only file system error

My first post :) I deleted all the files within /system/library/startupitems to the trash bin. Now my mac snow leopard won't boot at all. All I got is the gray screen, apple logo and the spinning wheel...just spinning forever. I was able to boot in single-user mode. I'm trying to copy cp command... (14 Replies)
Discussion started by: haxum
14 Replies

5. Shell Programming and Scripting

How to remove last character in a string read from file

Hello, The last character is a comma , I have tried the following: sed -e 's/\,$//' filename-to-read however - there are still commas at the end of each line...:confused: (5 Replies)
Discussion started by: learning
5 Replies

6. SCO

file system not getting mounted in read write mode after system power failure

After System power get failed File system is not getting mounted in read- write mode (1 Reply)
Discussion started by: gtkpmbpl
1 Replies

7. UNIX for Dummies Questions & Answers

/ file system mounts as read only

I have a Netra T1 server running Solaris 8, It was installed by jump start, it does not have a cdrom drive. Recetly it crashed so I rebooted it from >LOM poweron and it came to run level 3, all file systems listed in /etc/vfstab are mounted, but /dev and / root are not writeable though in... (3 Replies)
Discussion started by: Tirmazi
3 Replies

8. UNIX for Dummies Questions & Answers

read only file system

Hi, Has any one worked on IPSO operating system. I have a to add a file to /etc directory. When I create a file it comes up with read only file system. Is there any way of adding a file to this directory, without changing the etc directory parameters. Br, Eugene (1 Reply)
Discussion started by: eugene777
1 Replies

9. UNIX for Dummies Questions & Answers

Read file and remove max length

Hi all, I tried to write a shell to read huge file and eliminate max length record which is wrong generated record. But I get an error remove_sp.sh: line 27: syntax error near unexpected token `else' remove_sp.sh: line 27: ` else $LINE >> REJFILE' My shell is here: #!/bin/sh... (5 Replies)
Discussion started by: mr_bold
5 Replies

10. Solaris

How to remove a ufs file system?

Hello, On a box with Solaris 10 I created a ufs file system and now I need to remove that file system. How do I remove a ufs file system on Solaris 10? Thanks. (5 Replies)
Discussion started by: pmichner
5 Replies
Login or Register to Ask a Question