[GTALUG] war story: upgrading Win8.1 to Win10 on a triple-boot system

D. Hugh Redelmeier hugh at mimosa.com
Sun Jul 3 17:49:05 EDT 2016


This is about partition table surgery.  Dangerous!

After I installed Fedora 24, I noticed that Ubuntu was missing.  In
fact, it was missing when I was initially configuring partitions for
F24.  I think that the Windows operations ate that partition table entry.

Perhaps the Windows utilities don't believe in partitions "out of
order".  The ubuntu partition was the first in the extended partition
but it had the last partition number.

Luckily I had information about the sector allocations for Ubuntu.
I fixed it using these steps:

- booted the F24 live USB stick (changing the partition table
  using sfdisk doesn't seem to work if any partition is active
  so I could not use the installed F24)

- "sudo swapoff -a" so that the swap partition on the HDD
  was not active

- "sudo sfdisk --dump /dev/sda >sda.dump"

	label: dos
	label-id: 0xe3102a4b
	device: /dev/sda
	unit: sectors

	/dev/sda1 : start=        2048, size=    52428800, type=1c
	/dev/sda2 : start=    52430848, size=   204800000, type=7, bootable
	/dev/sda3 : start=   257230848, size=    40960000, type=83
	/dev/sda4 : start=   298192894, size=   326948866, type=5
	/dev/sda5 : start=   339154944, size=    32768000, type=82
	/dev/sda6 : start=   371924992, size=   253216768, type=83

- "cp -p sda.dump sda.dump.bak"

- added a new line to sda.dump (careful: size is in sectors not blocks)

	/dev/sda7 : start=   298192896, size=    40962048, type=83

- "sudo sfdisk /dev/sda <sda.dump"

- "sudo sfdisk --dump /dev/sda >sda.dump2"

- "cmp sda.dump sda.dump2": success!

- Boot Fedora 24 from hdd

- "grub2-mkconfig -o grub2.cfg.new".
  This will include a stanza for Ubuntu now that its partition has
  been restored.
  After inspecting, install grub2.cfg.new as /boot/grub2/grub.cfg

- I have booted Ubuntu -- it all worked.  The contents of the
  partition seem fine.

False Starts (Don't try this):

I tried to do this from the Fedora 24 installed on the HDD.  The
changes didn't take (and sfdisk gave warnings).  There may be a way to
get this to work but piling risk on risk is not worth it.

I tried to reorder the partition numbers by editing the sda.dump file.
I renamed 5-6 to be 6-7 and added the lost partition as 5.  When I did
this, sfdisk stole the first sector on the former sda5.  Why?  Perhaps
for the logical partition table entry (they are a linked list of
sectors).  I gave up and just restored 7 the way it had been before it
was attacked by Windows.


More information about the talk mailing list