# Using parted module ..I am unable to create multiple partitions on the disk.

**URL:** <https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759>\
**Category:** Ansible Project\
**Created:** [October 17, 2017, 4:09am UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759 "2017-10-17T04:09:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![coach.rhca](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@coach.rhca](https://forum.ansible.com/u/coach.rhca)\
**Post date:** [October 17, 2017, 4:09am UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759/1 "2017-10-17T04:09:20Z")

</div>

Hi,

I have a query here and request your help .I am trying to create multiple partition on the disk with parted module , but it only creates one partition. Is parted module creates only one partition of the entire disk or is there is way to achieve this.

- name: create of partitions  
parted: “label=gpt device=/dev/sdb state=present number=2 unit=MiB part\_end=1GiB”

when try to create on more partition on the disk gives the below error.

[student@puppetclient ~]$ ansible 192.168.3.157 -m parted -a “device=/dev/sdb number=3 state=present part\_end=1GB”  
192.168.3.157 | FAILED! =\> {  
“changed”: false,  
“err”: “Error: You requested a partition from 0.00kiB to 976563kiB (sectors 0…1953125).\nThe closest location we can manage is 17.0kiB to 1024kiB (sectors 34…2047).\n”,  
“failed”: true,  
“msg”: “Error while running parted script: /sbin/parted -s -m -a optimal /dev/sdb – unit KiB mkpart primary 0% 1GB”,  
“out”: “”,  
“rc”: 1

Thank you for looking into it.

---

<div class="post-metadata">

**Author:** ![mcsontos](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@mcsontos](https://forum.ansible.com/u/mcsontos)\
**Post date:** [October 19, 2017, 8:09am UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759/2 "2017-10-19T08:09:45Z")

</div>

This looks like you are trying to create overlapping partitions. I have not tried it, but to me looks like you need to add `part_start=1GB part_end=2GB`

---

<div class="post-metadata">

**Author:** ![coach.rhca](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@coach.rhca](https://forum.ansible.com/u/coach.rhca)\
**Post date:** [October 21, 2017, 4:15am UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759/3 "2017-10-21T04:15:35Z")

</div>

Thank you for looking into it. but i am unable to create multiple partitions.Although I gave the part\_start and part\_end as mentioned by you (( **ansible test -m parted -a "device=/dev/sdb number=3 part\_start=3GB part\_end=4GB**")) but it doesnot create a new partition. already have two partitions on the test host on /dev/sdb…below snippet. I am trying to create a third partition sdb3 with parted module…does work …

**# lsblk**  
**NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT**  
**sda 8:0 0 30G 0 disk**  
**├─sda1 8:1 0 300M 0 part /boot**  
**├─sda2 8:2 0 3G 0 part [SWAP]**  
**└─sda3 8:3 0 26.7G 0 part /**  
**sdb 8:16 0 5G 0 disk**  
**├─sdb1 8:17 0 953M 0 part**  
**└─sdb2 8:18 0 1G 0 part**  
**└─oravg-oralv 253:0 0 1000M 0 lvm /oradata1**  
**sr0 11:0 1 53.3M 0 rom**  
**sr1 11:1 1 4G 0 rom /mnt**

---

<div class="post-metadata">

**Author:** ![coach.rhca](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@coach.rhca](https://forum.ansible.com/u/coach.rhca)\
**Post date:** [October 21, 2017, 5:35am UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759/4 "2017-10-21T05:35:40Z")

</div>

`Thank you for help…I was able to figure out…

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 21, 2017, 8:22am UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759/5 "2017-10-21T08:22:06Z")

</div>

In open source community it's custom to share the answer you find, we are here to help each other.

Think about it, if you are the one searching for the answer and find someone else with the exact same problem, only to find "got it" as an answer.

---

<div class="post-metadata">

**Author:** ![dwilli9359](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@dwilli9359](https://forum.ansible.com/u/dwilli9359)\
**Post date:** [October 23, 2017, 6:33pm UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759/6 "2017-10-23T18:33:34Z")

</div>

Haven’t found much on Google about creating multiple partitions. You will have to workout the disk dimensions, but this worked for me:

---

<div class="post-metadata">

**Author:** ![coach.rhca](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@coach.rhca](https://forum.ansible.com/u/coach.rhca)\
**Post date:** [October 24, 2017, 11:45am UTC](https://forum.ansible.com/t/using-parted-module-i-am-unable-to-create-multiple-partitions-on-the-disk/25759/7 "2017-10-24T11:45:35Z")

</div>

Sure…I did not mentioning the number correctly which is required for the partitioning…the partition already created was giving error…so changing the number did the work for me…also

I am looking for how to add a logical partitions in the extended ones…Thank you for highlighting and looking into it…
