Discussion:
Partition table to parted script
Julien BLACHE
14 years ago
Permalink
Hi,

A few months ago I talked about generating a parted script during the
installation, either in setup-storage or using a dedicated tool/script.

The attached Python script does just that, using python-parted. It
outputs a shell script that recreates the partition table using parted.

Unfortunately, with msdos partition tables this doesn't yield the exact
same result due to alignment issues. Basically, I'm only using the
script for GPT partition tables aligned to 1 MiB boundary.

HTH,

JB.
--
Julien BLACHE <jblache at debian.org> | Debian, because code matters more
Debian & GNU/Linux Developer | <http://www.debian.org>
Public key available on <http://www.jblache.org> - KeyID: F5D6 5169
GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gpt2script
URL: <http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20110306/966974bd/attachment.pl>
Michael Tautschnig
14 years ago
Permalink
Hi Julien,

[...]
Post by Julien BLACHE
Unfortunately, with msdos partition tables this doesn't yield the exact
same result due to alignment issues. Basically, I'm only using the
script for GPT partition tables aligned to 1 MiB boundary.
[...]

I have no idea about the python-parted API, but isn't there some alternative to
using the geometry in

start = part.geometry.start * disk.device.sectorSize

? This sounds really dangerous as the C/H/S geometry (if that is what geometry
is about) isn't really useful anymore these days...

Best regards,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20110307/55bcd6b9/attachment.bin>
Julien BLACHE
14 years ago
Permalink
Michael Tautschnig <mt at debian.org> wrote:

Hi Michael,
Post by Michael Tautschnig
I have no idea about the python-parted API,
Well, it's largely suboptimal, just like parted itself, and don't get me
started on the d word :)
Post by Michael Tautschnig
but isn't there some alternative to using the geometry in
start = part.geometry.start * disk.device.sectorSize
? This sounds really dangerous as the C/H/S geometry (if that is what geometry
is about) isn't really useful anymore these days...
It's been a while since I wrote the script, so all I can tell you is
that if I used that, it's probably because I didn't find a better way...

That said, the sector size is there to stay and alignment must be a
multiple of the sector size, so that part is safe. As for the geometry
in part.geometry.start, it's just a naming thing and has no relation to
the CHS disk geometry IIRC.

But it does screw up partitions when used with msdos partition tables
and improper alignment, hence my warning about this in my initial mail :)

JB.
--
Julien BLACHE - Debian & GNU/Linux Developer - <jblache at debian.org>

Public key available on <http://www.jblache.org> - KeyID: F5D6 5169
GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169
Loading...