How can I prevent Windows 10 from corrupting the ext4 superblock every time?

22,640

Solution 1

I have done some research and it seems that since ext2fsprogs 1.43 (Ubuntu 16.10), the 64bit and the metadata_csum features are enabled when a new ext4 filesystem is created. I did a fresh install of Ubuntu 16.10, but before installing, I started into the USB live session and removed the 64bit and metadata_csum features for ext4 from /etc/mke2fs.conf. After this I ran the installer out of the this live session and now I can start Windows 10 without corrupting my ext4 partitions (you have to reformat your ext4 partitions during the installation of Ubuntu 16.10).

The problem is related to ext2fsd which obviously does not support the 64bit feature and/or metadata_csum feature. It is sufficient to have ext2fsd installed to corrupt your ext4 partitions. No need for them to be mounted in Windows.

You can check if these features are enabled with the following command:

sudo tune2fs -l /dev/[sdXX]

where [sdXX] stands for the ext4-partition in question.

Solution 2

I have the same issue and for me it seems to be the Windows 10 ext2fsd file system driver. Maybe for you too? When I uninstall ext2fsd (version 0.68) I can start Windows 10 as often as I want and the ext4 partitions stay clean. With ext2fsd installed all ext4 partitions get corrupted no matter if they are mounted or not.

Solution 3

On my GPT hard drive Ubuntu 16.10 is running in parallel to Windows 7.

I ran into the superblock corruption issue documented here, as I had forgotten having installed ext2fs in the past and it was still running as a Windows service in the background.

The new ext2fs v0.69 says it fixes the superblock corruption bug and I installed it from http://www.ext2fsd.com/. However, the "ext2fs Manager" showed my ext4 formated drive as ext3 and it was not accessible after mounting under Windows.

So, I have uninstalled ext2fs completely and did

fsck.ext4 -p -b 884736 -B 4096 /dev/sdxyz

This solved the superblock issue and I am back to normal.

Solution 4

I have a solution that works for me (diskpart is my friend)

1) identify the linux partition in the cmd administrative windows :

diskpart
list volume

you can see your linux partition

  N° volume   Ltr  Nom          Fs     Type        Taille   Statut     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D   BIOS_RVY     NTFS   Partition     10 G   Sain
  Volume 1     E   System       NTFS   Partition    100 M   Sain       Système
  Volume 2     C   OS_Install   NTFS   Partition    131 G   Sain       Démarrag
  Volume 3     L                       Partition     18 G   Sain     

DISKPART>

In my case : Volume 3

2) create a diskpart script with notepad create the file volume3offline.txt

select volume 3
offline volume
exit

3) create a bat file with notepad create the file govolume3offline.bat in the same directory

cd \users\f35\documents
diskpart /s volume3offline.txt

4) create a scheduled task Open the windows tash scheduler Program a task that launch govolume3offline.bat at boot time

5) check if all is ok after a reboot in windows

diskpart
list volume

your linux volume should be offline

Reboot in linux

If no errors => it's good
if you have errors, 
    correct them
    reboot in windows
    reboot in linux 
       If no errors => it's good
       if you have errors, goto 1)
Share:
22,640

Related videos on Youtube

f35
Author by

f35

Updated on September 18, 2022

Comments

  • f35
    f35 almost 2 years

    I have a pc with dual-boot Ubuntu/Windows since more than 5 years. The last working configuration was : windows 10 and Ubuntu 16.04 LTS.

    I install Ubuntu 16.10 on the Linux partition and have some problems:

    • If I only boot on Linux, no problems, it works fine.
    • If I boot windows, no problem, windows works fine.
    • If I boot Linux after windows, I have a superblock error and drop to busybox.

    If I restore the superblock with

    fsck.ext4 -p -b 884736 -B 4096 /dev/sda5
    

    I can boot Linux but after another boot to Windows the same problems reoccurs.

    Of course I have tried solutions found:

    • chkdsk and testdisk while on windows.
    • I remove the extended partition and let the Linux installer recreate them.
    • Create by and, the extended partion + ext4 and swap and select these partition during the install process.

    The partition table (fdisk -lu):

    Disk /dev/sda: 298,1 GiB, 320072933376 bytes, 625142448 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x6bb7527c
    
    Device     Boot     Start       End   Sectors   Size Id Type
    /dev/sda1            2048  22783999  22781952  10,9G  7 HPFS/NTFS/exFAT
    /dev/sda2  *     22784000  22988799    204800   100M  7 HPFS/NTFS/exFAT
    /dev/sda3        22988800 375246847 352258048   168G  7 HPFS/NTFS/exFAT
    /dev/sda4       375246848 625141759 249894912 119,2G  f W95 Ext'd (LBA)
    /dev/sda5       383440896 617844735 234403840 111,8G 83 Linux
    /dev/sda6       617846784 625141759   7294976   3,5G 82 Linux swap / Solaris
    

    I did some more tests without success:

    • I removed the Linux extended partition
    • I extended the windows partition to the full disk
    • I launched a chkdsk /F /R on this new windows partition → after a couple of hours all is good
    • I reinstalled Ubuntu 16.10 and let the install program resize the disk and create the ext4 and swap part.
    • I boot Linux → no problem
    • I boot windows → no problem (I reach the windows menu that let me choose between Windows and Linux, I choose Windows)
    • I boot Linux: same problem again (superblock error)

    Update : the exact superblock error :

    fsck.ext4: Superblock checksum does not match superblock while trying to open /dev/sda5
    

    To repair it :

    fsck.ext4 -p -b 884736 -B 4096 /dev/sda5
    

    works fine, but after a Windows boot, the problem is there again ...

    Update 2 : From W10, I can mount the linux ext4 partition with the W10 ext2 tool. It works fine, I can see the files. But after that, same problem, when I boot on Linux: superblock errors.

    Of course if I just boot W10 (no login) and reboot linux, the problem is there too.

    The problem was present with W10 1511, I've upgraded to W10 1607 : same problem

    I saw that I was not alone on earth with this problem, but I did not see any solution.

    update2 : I removed the linux and swap partition and create a new partition from windows. Then I reinstalled Ubuntu 16.10 => same problem again

    update 3: The beginning of solution I have perhaps found a solution. When loggued in windows : With the command diskpart, when the linux volume is set offline there is no more problem when I boot linux.

    I now have to find how to set the volume offline automaticaly (regedit ?)

    • Admin
      Admin over 7 years
      Are Windows and Linux installed in UEFI BIOS or legacy BIOS mode? Do you change any BIOS settings when you switch between Windows and Ubuntu? Do you use some kind of RAID for your storage setup? Did you access the ext file system from Windows with a file system driver like Ext2fsd?
    • Admin
      Admin over 7 years
      UEFI bios : no, Change in BIOS: no, RAID no (it's a MSI u270 ), access linux partition from Windows: no. Just booting windows (no log in) and restart with ubuntu make the problem appear. Thanks to take attention to my problem
    • Admin
      Admin over 7 years
      What super block error ? Isn't it a time clock problem ? If the time stored in super block is less than the one reported by hardawre clock you might have that problem. Try to store time in UTC in hardware clock both on linux and windows.
    • Admin
      Admin over 7 years
      @solsTiCe : Check my update in the initial post for the exact superblock error. The clock in bios is UTC, the clock in Windows is UTC with localtime, the clock in Ubuntu : sudo dpkg-reconfigure tzdata Current default time zone: 'Europe/Paris' Local time is now: Sun Nov 20 21:55:16 CET 2016. Universal Time is now: Sun Nov 20 20:55:16 UTC 2016.
    • Admin
      Admin over 7 years
      @f35 I have the same problem. Dual booting with Dell XPS 13 9350 with ssd drive. Will boot into Ubuntu 16.10 after restoring superblock with fsck and no issues rebooting from Ubuntu. Will boot into Windows 10 from Ubuntu and reboot no issue. However, on reboot into Ubuntu same superblock error requiring fix as above. Tried answer below (disable block level backup service) but did not fix. Also confirm clocks are the same as per your above comment. Anyone know why this is happening?
    • Admin
      Admin over 7 years
      Confirm 16.04 LTS has no such problem
    • Admin
      Admin almost 7 years
      Learner here, how did you get the magic numbers for your fsck ?
    • Admin
      Admin almost 7 years
      I think this at least partially answers my question, actually...
    • Admin
      Admin almost 6 years
  • samleighton87
    samleighton87 over 7 years
    This did not work
  • f35
    f35 over 7 years
    I can confirm : with wbengine disabled, I still have the problem too
  • f35
    f35 over 7 years
    Thanks, it woks too and it's a better solution I think. We can do it without re install the linux system : from a live CD : sudo tune2fs -O ^metadata_csum,^64bit /dev/sdXX
  • krumpelstiltskin
    krumpelstiltskin over 7 years
    @f35: note that the live CD/USB must be Ubuntu 16.10, as earlier versions of Ubuntu don't know anything about metadata checksum.
  • Wyatt Ward
    Wyatt Ward about 7 years
    You can use earlier liveCD's/DVD's/whatever if you have another USB drive with a fat32 partition and you put e2fslibs 1.43 and e2fsprogs 1.43 debian packages on it and install them via either dpkg or udpkg too.
  • Yohanes Gultom
    Yohanes Gultom almost 7 years
    Thanks! Uninstalling ext2fsd from windows solved my problem
  • max pleaner
    max pleaner almost 7 years
    what a horrible program.
  • crackpotHouseplant
    crackpotHouseplant almost 7 years
    "No need for them to be mounted in Windows." Why does this problem occur every time I boot Windows?
  • crackpotHouseplant
    crackpotHouseplant almost 7 years
    over here they claim the issue is a windows utility that reads ext partitions... Is it that the Windows utility cannot understand the features introduced on the Ubuntu partition utility?
  • Zanna
    Zanna over 6 years
    Ubuntu 16.10 is unsupported, so you should upgrade!
  • Jonas
    Jonas about 6 years
    ext2fsd has in the 0.69 release notes that it has fixed bugs related to this, but I can tell you that it does still corrupt an Ubuntu 18.04 install. I thought I was careful by letting it work in read-only mode but apparently it is enough to merely install the driver...
  • Jonas
    Jonas about 6 years
    Same experience with 0.69 with Ubuntu 18.04. ext2fs clearly still has issues with current releases of Ubuntu.
  • K7AAY
    K7AAY almost 6 years
  • Darksworm
    Darksworm almost 6 years
    My linux root partition doesn't show up in diskpart. Any idea why?
  • kanha.vishva
    kanha.vishva over 5 years
    Thanks, it's the best solution than reinstalling linux :D