# How to verify all disk size equal

**URL:** <https://forum.ansible.com/t/how-to-verify-all-disk-size-equal/33841>\
**Category:** Ansible Project\
**Created:** [September 17, 2020, 12:23pm UTC](https://forum.ansible.com/t/how-to-verify-all-disk-size-equal/33841 "2020-09-17T12:23:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jenisha\_T](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@Jenisha\_T](https://forum.ansible.com/u/Jenisha_T)\
**Post date:** [September 17, 2020, 12:23pm UTC](https://forum.ansible.com/t/how-to-verify-all-disk-size-equal/33841/1 "2020-09-17T12:23:33Z")

</div>

Hi Team

I need to verify if all disk size equal

I have n number of disk. I have written a loop that gives size of disk. Now how do I verify all disks are equal size?

- name: Check the size of the disk  
shell: |  
bootinfo -s “{{ item }}”  
with\_items: “{{ rootvg.stdout\_lines }}”  
register: disk\_size

Output of bootinfo command is size of disk  
$ bootinfo -s hdisk0  
70006  
$ bootinfo -s hdisk1

70006

Thankyou!

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 17, 2020, 1:59pm UTC](https://forum.ansible.com/t/how-to-verify-all-disk-size-equal/33841/2 "2020-09-17T13:59:16Z")

</div>

add those numbers to a list, apply the 'unique' filter, then check the length.  
If it is 1, then the numbers were all the same.  
If it is greater than 2, then there were differences.

---

<div class="post-metadata">

**Author:** ![Antony\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Antony\_Stone](https://forum.ansible.com/u/Antony_Stone)\
**Post date:** [September 17, 2020, 2:11pm UTC](https://forum.ansible.com/t/how-to-verify-all-disk-size-equal/33841/3 "2020-09-17T14:11:44Z")

</div>

I'm a pedant, so I'll suggest that "if it's greater than 1, then there were  
differences" 🙂

Antony.
