Number of partitions report?

roiegat
Contributor III

So in the storage section of a computer there is the number of partitions. But I'm trying to create a report to see who has more then 1 paritions on there machines.

Anyone know if it can be done casper itself, or do I need to write an extension attrbute for it? Anyone create something similar to this?

3 REPLIES 3

tomgideon2003
Contributor

I am wanting to do this also. I can't seem to find a way yet. If anyone has an idea, let us know. Thanks!

tthurman
Contributor III

This is kind of a pain for a few reasons.

  1. The if the user has a DMG mounted - it will show up in the storage report and in diskutil.
  2. APFS is kind of funny.

You may be able to do something like this (10.13.3)

#!/bin/sh


bootVolume=$(system_profiler SPSoftwareDataType | grep "Boot Volume" | awk -F': ' '{print $2}')


diskNum=$(diskutil info "$bootVolume" | grep -i "Part of Whole" | awk '{print $4}')

diskPartList=$(diskutil list $diskNum)

echo "$diskPartList"

EDIT
This would output all of the partitions on the parent disk of the boot volume. You could add a | wc -l at the end of the echo to see the count, but that will give to the number of lines.

tomgideon2003
Contributor

Thank you @tthurman , I am going to work with this some. I have a way to find active Bootcamp partitions but that doesn't tell me if someone sets up a partition for a separate Mac OS or Linux machine. I think our end answer will be setting up EFI firmware passwords on everything.