Extended/Logical Partitions Proposed Solution
-
In order to support extended and logical partitions, I’ve made changes to the fog.upload and fog.download scripts. The modified versions are attached. I’ve tested these on some simple setups, and they appear to be working.
Please consider incorporating this change into the release. I think this will avoid lots of rookie mistakes for people doing dual-boot and Linux systems, since so many Linux systems are installed with logical partitions from the start.
Detailed notes:
fog.upload:- Moved the detection of gpt or mbr to inside the “mps” and “mpa” portions, so that the test can be performed per-disk.
- Added per-disk sfdisk -l to detect if Extended partition exists or not.
- On MBR disks, with Linux image type (osid == 50), save the partition table to d?.partitions, using sfdisk -d
- In “mpa” image type, for MBR disks, with Linux image type, capture full (63 sectors) of mbr, not just first disk. (OK, this isn’t strictly necessary, but some systems to have grub2 installed on additional disks). It was also necessary to keep the code clean for capturing extended and logical partitions on drives other than the first.
- In “mpa” section, fixed GPT mbr to capture from $disk. Was capturing from $hd (the first drive) for all drives.
fog.download:
- In both “mps” and “mpa” sections, if the MBR is full (63 sectors) and image type is Linux, and if the d?.partitions file exists, use sfdisk to restore the partition table (after the dd to restore the d?.mbr file).
- In the “mpa” section, make the MBR restoration occur for all disks, not just the first one. (This is to reflect the similar change in the upload script.)
[url=“/_imported_xf_attachments/0/807_fog.download.extended-partitions.txt?:”]fog.download.extended-partitions.txt[/url][url=“/_imported_xf_attachments/0/808_fog.upload.extended-partitions.txt?:”]fog.upload.extended-partitions.txt[/url]
-
Thanks fractal13
-
[quote=“fractal13, post: 27830, member: 24300”]In order to support extended and logical partitions, I’ve made changes to the fog.upload and fog.download scripts. The modified versions are attached. I’ve tested these on some simple setups, and they appear to be working.
Please consider incorporating this change into the release. I think this will avoid lots of rookie mistakes for people doing dual-boot and Linux systems, since so many Linux systems are installed with logical partitions from the start.
Detailed notes:
fog.upload:- Moved the detection of gpt or mbr to inside the “mps” and “mpa” portions, so that the test can be performed per-disk.
- Added per-disk sfdisk -l to detect if Extended partition exists or not.
- On MBR disks, with Linux image type (osid == 50), save the partition table to d?.partitions, using sfdisk -d
- In “mpa” image type, for MBR disks, with Linux image type, capture full (63 sectors) of mbr, not just first disk. (OK, this isn’t strictly necessary, but some systems to have grub2 installed on additional disks). It was also necessary to keep the code clean for capturing extended and logical partitions on drives other than the first.
- In “mpa” section, fixed GPT mbr to capture from $disk. Was capturing from $hd (the first drive) for all drives.
fog.download:
- In both “mps” and “mpa” sections, if the MBR is full (63 sectors) and image type is Linux, and if the d?.partitions file exists, use sfdisk to restore the partition table (after the dd to restore the d?.mbr file).
- In the “mpa” section, make the MBR restoration occur for all disks, not just the first one. (This is to reflect the similar change in the upload script.)[/quote]
Added to the init’s, will update the src files with the information as well.
-
Thanks.
-
I checked out the latest from SVN and tried to use these updates and they didn’t work. I noticed a few things were changed when you integrated the extended partitions into the scripts. I’d like to submit another set of changes to make things work again, but I have a few questions first.
The variable ${imgPath} isn’t a magic variable I’m unaware of is it?
Is there a reason we don’t want to try to save the extended partitions (and GRUB/MBR) on other than the primary disk? It doesn’t hurt anything does it?
When sgdisk is used to save the MBR on multi-disk systems, wouldn’t we want to save the MBR per disk, and not from the first disk only?Again, thanks.
-
As we discussed earlier, I’m human so I make mistakes
Anyway, this should all be corrected for now. As always, just let me know of issues and I’ll try to correct them in as timely a fashion I can.
Thank you,
-
Thanks Tom. I appreciate your persistence in getting this integrated. It’ll save a lot of hassles for first time dual-boot users.
PS. Coming soon: patch to make capture of GRUB2 work in more cases.