# parted - azure managed disks - unrecognized disk label

**URL:** <https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [February 10, 2020, 9:49am UTC](https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185 "2020-02-10T09:49:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![deewon](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@deewon](https://forum.ansible.com/u/deewon)\
**Post date:** [February 10, 2020, 9:49am UTC](https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185/1 "2020-02-10T09:49:58Z")

</div>

Hi all,

I’m pretty certain someone has figured this out so any hints will be appreciated

I’ve attached an azure managed disk to a linux vm but noticed it doesn’t have any disk label i.e.

Error: /dev/sdc: unrecognised disk label  
Model: Msft Virtual Disk (scsi)  
Disk /dev/sdc: 18.3GB  
Sector size (logical/physical): 512B/4096B  
Partition Table: unknown  
Disk Flags:

Consequently, the ansible parted module returns the below error when attempting to create a partition

TASK [role\_azure\_disk : Partition Azure Disk] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /etc/ansible/roles/role\_azure\_disk/tasks/main.yml:7  
fatal: [labserver]: FAILED! =\> {“changed”: false, “err”: “Error: Could not stat device /dev/sdc - No such file or directory.\n”, “msg”: “Error while getting device information with parted script: ‘/sbin/parted -s -m /dev/sdc – unit ‘KiB’ print’”, “out”: “”, “rc”: 1}

To achieve idempotence when re-running playbooks , I’m trying to avoid using fdisk passed to the shell module i.e. (echo n; echo p; echo 1; echo ; echo ; echo w) | sudo fdisk /dev/sdc

Will appreciate any ideas on how to get around this

Thanks

---

<div class="post-metadata">

**Author:** ![hugonz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/hugonz/32/503_2.png) [@hugonz](https://forum.ansible.com/u/hugonz)\
**Post date:** [February 10, 2020, 7:00pm UTC](https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185/2 "2020-02-10T19:00:33Z")

</div>

The disk label is the partition table, and will not be recognized for an unpartitioned disk. There is a parameter in the module called “label” with a default of “msdos” as the table format. So I guess you can pass it along your partition definitions. Just make sure it works idempotently, I haven’t tested it. Hugo G.

---

<div class="post-metadata">

**Author:** ![deewon](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@deewon](https://forum.ansible.com/u/deewon)\
**Post date:** [February 11, 2020, 10:41am UTC](https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185/3 "2020-02-11T10:41:43Z")

</div>

Thanks Hugo!

I gave this a go with the label explicitly specified and it returned the same error i.e.

`

- name: Partition Disk  
parted:  
device: /dev/sdc  
number: 1  
state: present  
label: msdos  
`

`TASK [role_azure_disk : Partition Azure Disk] *********************************************************************************************************************************************************************************************** task path: /etc/ansible/roles/role_azure_disk/tasks/main.yml:19 fatal: [dbbox8]: FAILED! => {"changed": false, "err": "Error: Could not stat device /dev/sdc - No such file or directory.\n", "msg": "Error while getting device information with parted script: '/sbin/parted -s -m /dev/sdc -- unit 'KiB' print'", "out": "", "rc": 1}`

I suppose the issue is more related to the disk profile as opposed to the parted module in itself? The disk itself was created as recommended by azure ([https://docs.microsoft.com/en-us/azure/virtual-machines/linux/add-disk](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/add-disk))

Regards

---

<div class="post-metadata">

**Author:** ![deewon](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@deewon](https://forum.ansible.com/u/deewon)\
**Post date:** [February 11, 2020, 12:23pm UTC](https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185/4 "2020-02-11T12:23:32Z")

</div>

I got to the bottom of this eventually 🙂

The task was running on the controller which didn’t have a /dev/sdc device 🙂

Simply delegating the task to the remote node fixed the problem

Thanks!

---

<div class="post-metadata">

**Author:** ![hugonz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/hugonz/32/503_2.png) [@hugonz](https://forum.ansible.com/u/hugonz)\
**Post date:** [February 12, 2020, 5:09pm UTC](https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185/5 "2020-02-12T17:09:24Z")

</div>

Whoa! careful there! 🙂

Hugo G.

---

<div class="post-metadata">

**Author:** ![deewon](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@deewon](https://forum.ansible.com/u/deewon)\
**Post date:** [February 13, 2020, 9:54am UTC](https://forum.ansible.com/t/parted-azure-managed-disks-unrecognized-disk-label/32185/6 "2020-02-13T09:54:12Z")

</div>

I know right 🙂

It was an isolated lab environment so no harm done.

appreciated!
