Skip to content

How to craete logical partition with MBR? #1296

Answered by vojtechtrefny
Yurii-huang asked this question in Q&A
Discussion options

You must be logged in to vote

You can specify partition type with part_type=parted.PARTITION_LOGICAL.

Example of creating both the extended and logical partition:

import blivet
import parted

b = blivet.Blivet()
b.reset()

sdf = b.devicetree.get_device_by_name("sdf")
b.format_device(sdf, blivet.formats.get_format("disklabel", label_type="msdos"))

epart = b.new_partition(parents=[sdf], size=blivet.size.Size("100 MiB"), part_type=parted.PARTITION_EXTENDED)
b.create_device(epart)

lpart = b.new_partition(parents=[sdf], size=blivet.size.Size("50 MiB"), part_type=parted.PARTITION_LOGICAL)
b.create_device(lpart)

blivet.partitioning.do_partitioning(b)

b.do_it()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Yurii-huang
Comment options

Answer selected by Yurii-huang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants