Advertisement

Cannot delete directory -- Linux thinks it is mounted/read-only

Started by December 14, 2005 03:22 PM
5 comments, last by Halsafar 18 years, 9 months ago
Okay I got this HD in my comp (hdb1). It is mounted just fine, I have a set of users who can modify it (rw) just fine. I got hold of the drive full of crap on it so I decided to delete everything. Everything deleted fine except for the old "windows" directory on the drive. Apparently Linux thinks the "windows" directory is a "Read-Only file system". If I try rm -r -f -d windows It says: rm: cannot remove 'windows/': Read-only file system There is so many things wrong with that... - First, that directory is NOT EVEN MOUNTED! Just the entire drive is... - How on earth did a windows directory get labelled read-only? (maybe it is why the person gave me the HD cuz they accidently made there whole windows directory ro). - How come Linux cannot change it back?! Not even the root can modify it. My only guess: - When Ubuntu was installing itself and GRUB is saw the windows directory on the hdb1 drive and added windows 98/ME to the boot screen, maybe somewhere else it is internally protecting the directory now? Please help me on this one, I could sure use the near 1GB the directory is sucking up. Edit: Just to add, it let me move it to the .Trash-User directory on the same drive but I cannot remove it from the trash.
It sounds like a harddrive error.

check the output of 'mount', I'm guessing the hardrive is actually mounted as 'ro'. If it is try remounting it as rw,
like this: 'mount -o remount,rw /dev/hdb1'

/Nico
Advertisement
Is your partition NTFS ?
if so ... no luck

NTFS is not fully supported by LINUX for the moment.
you can easily read but not write.

you wrote that you erased some files ? that's strange...

you can find libraries that add support for NTFS
using windows drivers.
Use them at your own risk.


I can't give you any name because i didn't try any of them.
google will help.

I hope I helped too :)
Quote: Original post by Halsafar
Okay I got this HD in my comp (hdb1). It is mounted just fine, I have a set of users who can modify it (rw) just fine.


You've verified that files can be added/removed from this filesystem while it's mounted in Linux then?

Quote:
I got hold of the drive full of crap on it so I decided to delete everything.


Why not reformat it then (Actually, just mkfs it which is similar to reformatting).

Quote:
Everything deleted fine except for the old "windows" directory on the drive. Apparently Linux thinks the "windows" directory is a "Read-Only file system".


No. That message does not mean that the "windows" directory IS a readonly filesystem, it means that it's on a filesystem which is mounted readonly at the time you tried to do it.

Quote:
rm: cannot remove 'windows/': Read-only file system

There is so many things wrong with that...
- First, that directory is NOT EVEN MOUNTED! Just the entire drive is...


As I said, it's because it's *on* a readonly filesystem. That error can happen for any file or directory if it's on a readonly fs. For example, you'd get that when trying to remove a file from a cdrom.

Quote:
- How on earth did a windows directory get labelled read-only? (maybe it is why the person gave me the HD cuz they accidently made there whole windows directory ro).


It's not the windows directory. It's the filesystem which is mounted readonly. That error does not happen on a per-file basis.

Quote:
- How come Linux cannot change it back?! Not even the root can modify it.


No, that error is not a permissions problem.

One possibility is that there is some corruption on the fs, which is causing it to be remounted readonly.

In some circumstances, if there's a really bad corruption Linux will sponaneously remount the fs readonly. This indicates a problem.

Have a look at the kernel system log (typically /var/log/messages). If there is filesystem corruption which causes this, it will definitely shout loudly about it there.

Mark
First, its a FAT32 drive that used to run Windows 98.

Second, I am not fully sure if it is (rw) altho during the boot process it claims to be mounting it as rw. See that is where my trouble started but I fixed it:

Added this line to /etc/fstab:

/dev/hdb1 /media/hdb1 vfat uid=0,gid=1002,umask=007 0 0


gid 1002 is a group which I belong to. Once I made those changes, on the next boot I was able to copy/delete files on the hdb1 mount as any user part of gid1002 and not just the root. Maybe this is the heart of my problem?


Third, I delete successfully delete 90% of the drive exlcuding the windows directory which was sent to the trash. Now it is sitting in the trash unable to be deleted.

Forth, by running:
sudo mount -o remount,rw /dev/hdb1
I am able to delete ONE file then the next file claims to be Read-Only file system again, at which time I have to run the remount again... It feels like I'm back to step one, not able to mount the drive properly as RW. So I am going to reformat it and see what happens. I'd love it if someone could maybe point out a proper way to fstab the mount as RW at boot all the time.
Have a look at the system log.

It seems highly likely that there's some corruption on this FAT32 FS which is causing it to be remounted readonly, which is why you can't delete any more files after the first one.

In any case, if you want rid of it, why not just format (i.e. mkfs) the partition?

Mark
Advertisement
Okay I used fdisk to repartition the drive.
Then used mkfs.vfat to reformat it.

Apparently it is all working just fine now, infact all 'ro/rw' issues got resolved from that as well.

Thanks for the advice,

This topic is closed to new replies.

Advertisement