Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GPT partition gets corrupted often
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 134

PostPosted: Tue Jan 25, 2022 1:24 pm    Post subject: GPT partition gets corrupted often Reply with quote

I have an issue with my primary disk and I'm not sure where to look in order to see why its happening or how to solve it. I have GRUB 2 installed and Gentoo + Windows as dual boot and every now and then, when I try to load the Windows partition, GRUB fails with the following message:
Code:
Booting <entry name in GRUB>

error: no such device: <uuid of /dev/sda1>
error: disk `hd0,gpt1` not found.

Press any key to continue...


/dev/sda1 is the EFI partition where GRUB resides.

If I boot Gentoo and check the disk with gdisk, I get the following greeting:
Code:
# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.7

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Warning: Invalid CRC on main header data; loaded backup partition table.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.

Warning! Main partition table CRC mismatch! Loaded backup partition table
instead of main partition table!

Warning! One or more CRCs don't match. You should repair the disk!
Main header: ERROR
Backup header: OK
Main partition table: ERROR
Backup partition table: OK

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Doing the standard 'r', 'b', 'w', I use the backup header to restore the main. From this point onward, if I reboot the PC I can launch the other OS without issues. What confuses me is that I don't know why the partition gets damaged or how to check what could be the problem... :(

Not sure if its relevant, but this is the partition layout of the main disk, which is the one that gets corrupted from time to time:
Code:
Disk /dev/sda: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: 
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: gpt
Disk identifier:

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    206847    204800   100M EFI System
/dev/sda2     206848    239615     32768    16M Microsoft reserved
/dev/sda3     239616 487358580 487118965 232.3G Microsoft basic data
/dev/sda4  487360512 488394751   1034240   505M Windows recovery environment


From the time being its kinda random, sometimes it works, sometimes it doesn't, but I haven't found a common action that could trigger it.
Does anyone have any idea on what to check in order to see if I'm able to fix this behavior?


Last edited by Dwosky on Wed Jan 26, 2022 8:52 am; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the USA

PostPosted: Tue Jan 25, 2022 11:06 pm    Post subject: Reply with quote

This is a GPT partition not GPG (fix your post title)?

What are you doing to the partition table, someone trying to install viruses on the mbr?
Accidentally copying files to /dev/sda ?
Having other media inserted and messing up the disk order?

You'll need to carefully document what you do before and after you notice that the partition table gets screwed up from booting windows or something else. This shouldn't happen, something nefarious (or silly) is going on...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2894
Location: Edge of marsh USA

PostPosted: Wed Jan 26, 2022 4:33 am    Post subject: Reply with quote

Look the drives over with sys-apps/gsmartcontrol. Run tests. Be careful.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/17.1/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 134

PostPosted: Wed Jan 26, 2022 9:40 am    Post subject: Reply with quote

eccerr0r wrote:
What are you doing to the partition table, someone trying to install viruses on the mbr?
Accidentally copying files to /dev/sda ?
Having other media inserted and messing up the disk order?

That's the difficult thing, I'm not doing anything with gdisk/fdisk or any other tool that would alter the partition. Just swapping from time to time between one OS and another. The only thing I could think of that its the same every time is that this happens when I last booted Gentoo. I mean, I don't think I've suffered this behavior if I boot Windows and work normally, then another day boot Win again. It usually happens when I end on Gentoo and the next day boot Windows.

figueroa wrote:
Look the drives over with sys-apps/gsmartcontrol. Run tests. Be careful.

SMART test seems to be ok. I don't think its a drive failure, since it could end affecting more items, not just the MBR.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2894
Location: Edge of marsh USA

PostPosted: Wed Jan 26, 2022 4:13 pm    Post subject: Reply with quote

Are you sure Windows does a full shutown and not some wonky MS hibernate?
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/17.1/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 134

PostPosted: Wed Jan 26, 2022 5:03 pm    Post subject: Reply with quote

figueroa wrote:
Are you sure Windows does a full shutown and not some wonky MS hibernate?

I think not, I think its by default, which does a wonky thing as you say, since sometimes I can't write to the Windows dedicated drives because ntfs3g complains the filesystem hasn't been shutdown correctly and can only mount them in read only.

I'll take a look to see if I can set it to full shutdown and see if it doesn't happen anymore.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2894
Location: Edge of marsh USA

PostPosted: Wed Jan 26, 2022 5:13 pm    Post subject: Reply with quote

Probably not the best resource, but it has the right stuff.
https://www.top-password.com/blog/turn-on-or-off-fast-startup-missing-in-windows-10/
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/17.1/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Wed Jan 26, 2022 6:06 pm    Post subject: Reply with quote

@Dwosky
If you would widen the lagest partition basic data
I can calculate sector size of 2048:
Code:
 bc -l <<<" ( 487360511 - 239615 ) / 2048  "
237852.00000000000000000000

But now there is some oddity:
Code:
bc -l <<<" ( 487358580 - 239615 ) / 2048  "
237851.05712890625000000000
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 134

PostPosted: Thu Jan 27, 2022 4:52 pm    Post subject: Reply with quote

So it happened again... The main difference is that last OS booted was Windows itself and I changed the power options on Windows to disable the hibernation and force a full shutdown. On last session I've just scanned some documents, didn't do anything regarding OS configuration nor partitions...

@ulenrich, I think partiton layout of /dev/sda wasn't done by me, but I let Windows installer partition the disk to avoid it complain about stuff during installation. I think I need to destroy the last partition to be able to do that, but I'm not sure if that might be the cause of my issue.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Thu Jan 27, 2022 9:22 pm    Post subject: Reply with quote

Windows partitioning against all GPT standard?
But if you just widen the odd partition to the limit of the following you don't have to change anything more nor delete anything. And your result is an aligned partition table.
Just a guess that this works preventing any further errors.
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 134

PostPosted: Fri Jan 28, 2022 10:42 am    Post subject: Reply with quote

ulenrich wrote:
Windows partitioning against all GPT standard?
But if you just widen the odd partition to the limit of the following you don't have to change anything more nor delete anything. And your result is an aligned partition table.
Just a guess that this works preventing any further errors.

I tried updating the partition table, since as you've pointed out, there is some free space between partitions 3 and 4. The only problem is that Windows doesn't like the new partition layout and I can't boot it, I just end in the recovery startup with Windows telling me it can't fix anything...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum