Use parted (If available) to partition disk, else fallback to sfdisk.#191
Use parted (If available) to partition disk, else fallback to sfdisk.#191shishir-a412ed wants to merge 1 commit intoprojectatomic:masterfrom
Conversation
|
ping @rhvgoyal |
| local dev="$1" size | ||
|
|
||
| create_partition_sfdisk(){ | ||
| local dev="$1" size |
|
|
||
| create_partition_parted(){ | ||
| local dev="$1" | ||
| parted $dev --script mklabel gpt mkpart primary 0% 100% |
There was a problem hiding this comment.
add 2 spaces before start of line.
There was a problem hiding this comment.
sfdisk creates dos type partition table by default. I think we should do same for parted. At some point of time we want to switch to GPT but this is not the patch to do so.
We might experience surprises when we move to GPT. So use mklabel dos
d1a09d6 to
44a5559
Compare
|
@rhvgoyal PTAL. |
|
|
||
| create_partition_parted(){ | ||
| local dev="$1" | ||
| parted $dev --script mklabel dos mkpart primary 0% 100% |
There was a problem hiding this comment.
it should be mklabel msdos and not mklabel dos
There was a problem hiding this comment.
Where is it documented that parted accepts start and end value in %. Can you point me to it
There was a problem hiding this comment.
May be we should use 0 as start value which means start at 0 MB and use -1s as end value to tell parted to create partition till end of disk.
I think it will still do the right alignment and create partition beginning at 2048 sector.
There was a problem hiding this comment.
I was following your comment for mklabel dos :)
#191 (comment)
I found the mkpart primary 0% 100% syntax on stack overflow. I tested it and it works. We can also do 0 and -1, that should work too.
There was a problem hiding this comment.
I see in man page that one can specify unit and % is one of the supported units. so may be parted is parsing 0% and 100% properly.
There was a problem hiding this comment.
I have changed mklabel from dos to msdos based on this documentation:
https://www.gnu.org/software/parted/manual/html_node/mklabel.html
44a5559 to
28ef228
Compare
|
|
||
| create_partition_parted(){ | ||
| local dev="$1" | ||
| parted $dev --script mklabel msdos mkpart primary 0% 100% |
There was a problem hiding this comment.
sfdisk sets this partition type to lvm. For the sake of keeping it same,, lets do the same in parted too. Something like.
parted $dev --script mklabel msdos mkpart primary 0% 100% set 1 lvm
There was a problem hiding this comment.
I forgot the keyword on at the end. So it should be.
arted $dev --script mklabel msdos mkpart primary 0% 100% set 1 lvm on
There was a problem hiding this comment.
parted $dev --script mklabel msdos mkpart primary 0% 100% set 1 lvm on
28ef228 to
faa3756
Compare
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
faa3756 to
2da4cfa
Compare
|
LGTM |
|
☀️ Test successful - status-redhatci |
Signed-off-by: Shishir Mahajan shishir.mahajan@redhat.com