# ext4 mounting ro HD is write protected

## gravy21

I've been reading bug and forum posts for over a day trying to fix this problem. Every tip I've come across somwhat changes things, but I still end up with the same problem. I'm assuming I'm missing a basic step here, but can't for the life of me track it down.

Shortly after boot, my root partition switches from read-write to read only. Any attempts to remount rw are met with an error that it is write protected.

First of all this is my setup:

/dev/sda1 - boot - ext2

/dev/sda2 - Win7 - ntfs

/dev/sda3 - swap

/dev/sda4 - / - ext4

As far as Gentoo is concerned, I emerge --synced yesterday and my system is up to date (I know that's not fully inclusive, more info as needed)

kernel - 2.6.33-gento-r2

in my fstab, root is being mounted as such:

/dev/sda4 / ext4 noatime 0 1

just to get a few questions out of the way right off the bat:

- I am not upgrading from ext3 to ext4

- I do have ext4 support built into my kernel 

- My SATA drivers are built in. I've been using the same hardware for 2 years with Gentoo, and upgrade my kernel with almost every release, so unless they changed something, I doubt that's it (plus the drivers built in match the modules loaded by the livecd)

- I have tried using another hard drive, creating a new ext4 fs and cp -rfp the other install over with the same results. For the time being, I'm assuming I don't have a drive hardware problem

- I have 3 SATA controllers, and have switched the drive to another slot with the same results - so again I'm ruling out a controller problem - for now

- I have never had a problem booting from a live cd and writing to the disk, or chrooting and working on it either

- I have tried passing rootfstype=ext4 to the kernel with no change in results

In my initial install, after creating the ext4 fs, expanding the stage3 and chrooting; parted tells me the fs is ext4. When I reboot sometimes it will mount rw and sometimes it will mount ro. When it mounts rw, I can log in, and for a short time write to the disk. After a short time (we're talking less than a minute usually) I guess it remounts readonly and won't let me remount,rw because it says it is write-protected. 

When it mounts ro at boot, I get the error message "couldn't mount because of unsupported optional features"

when I rebooted into a livecd, i noticed parted was now telling me that sda4 for ext3. 

I've never had a Gentoo problem that I couldn't solve or work around using bugzilla or the forums, so this one is really pissing me off. Hopefully I just muffed a setting or have a typo somewhere. Any help is appreciated.

----------

## gravy21

EDIT: That should say when I rebooted to the livecd, parted is telling me that my ext4 formatted drive (sda4) is now ext3. This has happened to me twice now.

----------

## Hu

If you can get sys-apps/smartmontools, use smartctl to query the drive's error log and run a longrun offline self-test.  You said you wanted to rule out hardware failure for now, but intermittent problems are often a hardware issue.  In particular, I am not aware of any software misconfigurations that could lead to a drive intermittently becoming write protected.  It could also be informative to look at the last 10 lines of dmesg before the line where the kernel announces the drive is now write protected.  I once had an uncleanly unmounted ext4 that would do this at boot and needed an external fsck to fix, but if I recall correctly, it was read-only immediately on every boot, rather than intermittently and sometimes after a short delay.

----------

## gravy21

Thanks for the reply.

I ran smartctl from the livecd. I'm not exactly sure what I'm looking for but, in short:

SMART supprt is Available

SMART support is Enabled

SMART overall-healt self-assesment test result: PASSED

Error logging supported

No Errors logged

Of course, the is much more here, and I'm not what is relevant. I did initiate a self test, and the short version completed without error. I am initiating an extended now.

I usually run fsck at boot and shutdown, and force check when i use the livecd. The weird thing is that when fsck runs, it does run ext4, even if parted is saying it is ext3

----------

## Ant P.

Run memtest86.

----------

## gravy21

 *Ant_P wrote:*   

> Run memtest86.

 

You would think running two other OS's and three different livecd's I would have come across something else by now. 

I guess anything's possible. Will run in a bit and post results later.

----------

## zvezdi

 *gravy21 wrote:*   

> 
> 
> /dev/sda4 - / - ext4
> 
> kernel - 2.6.33-gento-r2
> ...

 

The above made me think that you have the same problem as me. For the last couple of days I was cutting and pruning the kernel (2.6.32-gentoo-r7) making it as small and optimized for my system as possible. As a result not everything worked. I got  "Root filesystem could not be mounted read/write :( " which dropped me into  a maintenance shell. When trying to 

# mount -o remount,rw /

I couldn't as the disk was "write-protected" ?!?!

Turns out I have skipped quite an important option in my kernel configuration, without which Ext4 malfunctions -- check if you have it:

CONFIG_LBDAF and Check this post for more on the matter. 

----------

## Adwin

Just add "rw" to your kernel line in grub.conf/menu.lst

----------

## bjlockie

Run fsck

----------

