error trying to restore gpt table
-
Hi,
I have a weird partitioning problem on an image which prevents me from deploying it on a smaller disk :
On this image, windows shows 4 partition (as always) but there are 5 partitions on my Fog image (d1p1 to d1p5.img) and the 3 d1.partitions files are strictly identical :
d1.fixed_size_partitions
1:2:3:5:4
d1.minimum.partitions
label: gpt label-id: C02F8167-B511-4E11-A662-38C514DE2003 device: /dev/nvme0n1 unit: sectors first-lba: 34 last-lba: 250069646 sector-size: 512 /dev/nvme0n1p1 : start= 2048, size= 1021952, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=1A290936-33CC-4F05-8D8E-3E92521F07C2, name="Basic data partition", attrs="RequiredPartition GUID:63" /dev/nvme0n1p2 : start= 1024000, size= 204800, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=FE60AE84-7CD7-4C13-A3E4-3DC6F929153A, name="EFI system partition", attrs="GUID:63" /dev/nvme0n1p3 : start= 1228800, size= 32768, type=E3C9E316-0B5C-4DB8-817D-F92DF00215AE, uuid=DE00D172-008C-4725-A3E7-AD8039CC5376, name="Microsoft reserved partition", attrs="GUID:63" /dev/nvme0n1p4 : start= 1261568, size= 247618048, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=36EAFD7B-F30E-4225-9C8A-1DC8C1092A48, name="Basic data partition" /dev/nvme0n1p5 : start= 248879616, size= 1189888, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=39BC0E02-4429-49D5-80D1-F989B4A929A7, attrs="RequiredPartition GUID:63"
d1.partitions :
label: gpt label-id: C02F8167-B511-4E11-A662-38C514DE2003 device: /dev/nvme0n1 unit: sectors first-lba: 34 last-lba: 250069646 sector-size: 512 /dev/nvme0n1p1 : start= 2048, size= 1021952, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=1A290936-33CC-4F05-8D8E-3E92521F07C2, name="Basic data partition", attrs="RequiredPartition GUID:63" /dev/nvme0n1p2 : start= 1024000, size= 204800, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=FE60AE84-7CD7-4C13-A3E4-3DC6F929153A, name="EFI system partition", attrs="GUID:63" /dev/nvme0n1p3 : start= 1228800, size= 32768, type=E3C9E316-0B5C-4DB8-817D-F92DF00215AE, uuid=DE00D172-008C-4725-A3E7-AD8039CC5376, name="Microsoft reserved partition", attrs="GUID:63" /dev/nvme0n1p4 : start= 1261568, size= 247618048, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=36EAFD7B-F30E-4225-9C8A-1DC8C1092A48, name="Basic data partition" /dev/nvme0n1p5 : start= 248879616, size= 1189888, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=39BC0E02-4429-49D5-80D1-F989B4A929A7, attrs="RequiredPartition GUID:63"
d1.shrunken.partitions
label: gpt label-id: C02F8167-B511-4E11-A662-38C514DE2003 device: /dev/nvme0n1 unit: sectors first-lba: 34 last-lba: 250069646 sector-size: 512 /dev/nvme0n1p1 : start= 2048, size= 1021952, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=1A290936-33CC-4F05-8D8E-3E92521F07C2, name="Basic data partition", attrs="RequiredPartition GUID:63" /dev/nvme0n1p2 : start= 1024000, size= 204800, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=FE60AE84-7CD7-4C13-A3E4-3DC6F929153A, name="EFI system partition", attrs="GUID:63" /dev/nvme0n1p3 : start= 1228800, size= 32768, type=E3C9E316-0B5C-4DB8-817D-F92DF00215AE, uuid=DE00D172-008C-4725-A3E7-AD8039CC5376, name="Microsoft reserved partition", attrs="GUID:63" /dev/nvme0n1p4 : start= 1261568, size= 247618048, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=36EAFD7B-F30E-4225-9C8A-1DC8C1092A48, name="Basic data partition" /dev/nvme0n1p5 : start= 248879616, size= 1189888, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=39BC0E02-4429-49D5-80D1-F989B4A929A7, attrs="RequiredPartition GUID:63"
Create on a 128GB SSD, i can deploy on larger disk but not smaller, how can I modify d1 partitions files ton remove this 5th partition and adapt d1.minimum.partitions ?
Thanks
Matthieu -
@Matthieu-Jacquart With the latest FOS inits you use with dev-branch there should be no need to remove the 5th partition because they handle moving of partitions after the resize.
The issue here to me seems to be that partition 4 is not being shrunk. Looks like FOS detects it as fixed and won’t shrink it.
Probably best if you schedule another capture of the image but tick the checkbox for debug this time. Step through the capture process and pay attention to where it says something about partition number 4. Take pictures and post here.
-
@sebastian-roth Hi, OK thanks I’ll try it tomorrow. I found another image with these 5 partitions but this time d1.fixed_size_partitions
1:2:3:5
so Windows partition is shrunk for this one, any way to force it for the bad one ?
Matthieu
-
@matthieu-jacquart said in error trying to restore gpt table:
any way to force it for the bad one ?
We better find out why FOS thinks it cannot shrink this partition. There is usually a reason for it.
-
@sebastian-roth Hi, That’s a bad photomontage of debug capture task, I think “Not shrinking (/dev/nvme0n1p4) trying fixed size” is interesting :
-
@Matthieu-Jacquart Ok, see the message
Not shrinking (/dev/nvme0n1p4) trying fixed size
. At this stage FOS tried to find out how much it can shrink this partition but failed to get the information.Please schedule another debug capture on that machine and when you get to the command shell just run
ntfsresize -fivP /dev/nvme0n1p4
, take a picture of the screen and post that here. -
@sebastian-roth Hi, result for first trial :
And after chkdsk /F
-
OMG shame on me, it was just a chkdsk problem, never thought to that…
sorry for this, I’ll tried to keep in mind for next time ! -
@Matthieu-Jacquart No problem. Good we figured that out so quickly. We might think about adding some debug output in FOS in case the ntfsresize check fails. Though I have very little time at the moment. Not sure if and when I will get to this. Anyone else keen to look into this? @Wayne-Workman ?
-
@sebastian-roth Is there a link with this feature in general settings ?
For the second option (change hostname early), can i activate it ? because after deployment the temporary name of the workstation appears in WSUS instead of the real name and I have to delete it.
Matthieu -
@Matthieu-Jacquart I didn’t even know about that FOG setting. Something that was part of FOG long before I joined the dev team and I never stumbled upon this myself by the looks.
The help text is as follows: “This is an experimental feature that will can be used to not set the dirty flag on a NTFS partition after resizing it. It is recommended to you run chkdsk.”
From what I see in the code this setting is piped through to FOS (the FOG Linux OS doing the imaging work) but not use by it. To make a long story short, I have no idea.
For the second option (change hostname early), can i activate it ? because after deployment the temporary name of the workstation appears in WSUS instead of the real name and I have to delete it.
Yes, enable it and give it a try. FOS will try to mount the Windows partition and manipulate registry entries at the end of a deployment to change the hostname before the first Windows boot. Works like a charm from what I have tested not too long ago.
-
There’s also this article:
https://wiki.fogproject.org/wiki/index.php?title=Windows_Dirty_Bit