sfdisk: Problem with -N and resizing extended partitions
Hi,
I've run into a problem with sfdisk where resizing an extended partition doesn't do the right thing. I have an extended partition at /dev/sda4 that has four partitions, so the last partition is /dev/sda8, and I want to extend /dev/sda8 to the maximum possible size. So I issue these two commands:
echo ,+, | sfdisk -N4 /dev/sda
echo ,+, | sfdisk -N8 /dev/sdaThis grows /dev/sda4 to the maximum size, but /dev/sda8 is unchanged. This also occurs if I calculate the sizes by hand instead of using +.
The problem happens during the first command. The size of /dev/sda4 is updated in the MBR, but none of the EBRs are changed, so the lengths of each of the extended partitions in the EBRs are wrong.
You can work around this problem by issuing the following after resizing the extended partition:
sfdisk -d /dev/sda | sfdisk /dev/sda
This will rebuild the EBRs so that they're consistent with the length of the extended partition in the MBR.
Let me know if you need any more info or if my explanation of the problem isn't clear.
Signature · 1 line
Justin Bogner