{"id":405,"date":"2011-01-28T00:30:38","date_gmt":"2011-11-03T21:51:50","guid":{"rendered":"http:\/\/kraftek.com\/blog\/metafree\/"},"modified":"2011-01-28T00:30:38","modified_gmt":"2011-11-03T21:51:50","slug":"metafree","status":"publish","type":"post","link":"\/blog\/index.php\/metafree\/","title":{"rendered":"Metafree"},"content":{"rendered":"<pre>If you want to know how much space you have free for soft partitioning use Adrian Ball's script \"metafree\", get it at:\nhttp:\/\/majords.co.uk\/scripts\/metafree\nor just copy\/paste this:\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n168\/433\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n==\"-p\" {print }' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n*### It's a metadevice, use metastat to find the size\n*cap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n169\/433\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n*### It's a real device, work out size assuming full disk\/LUN is used\n*cap=$(prtvtoc $c | nawk '\nkraftek.html POSTS rescue rescued.html rescued.txt x y z \/bytes\/sector\/ {bs=\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n170\/433\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n}\nkraftek.html POSTS rescue rescued.html rescued.txt x y z \/sectors\/cyl\/ {sc=\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n171\/433\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n}\nkraftek.html POSTS rescue rescued.html rescued.txt x y z \/accessible cyl\/ {as=\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n172\/433\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n}\nkraftek.html POSTS rescue rescued.html rescued.txt x y z END kraftek.html POSTS rescue rescued.html rescued.txt x y z {print bs*sc*as\/1024^3}')\nelse\n*### Assume we have a cXtX form of device, use prtvtoc to work out\n*### the size of the slice\n*cap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nkraftek.html POSTS rescue rescued.html rescued.txt x y z BEGIN {split(c,a,\"s\"); s=a[2]}\nkraftek.html POSTS rescue rescued.html rescued.txt x y z \/bytes\/sector\/ {bs=\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n173\/433\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n}\nkraftek.html POSTS rescue rescued.html rescued.txt x y z ==s {print *bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\nkraftek.html POSTS rescue rescued.html rescued.txt x y z\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\n174\/433\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n==\"-p\" &amp;&amp; ==c {split(\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft\nPartitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n175\/433\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct %\n\"$devs\"\ndone\n,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }*\nEND** { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print -\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft Partitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n176\/433\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct % \"$devs\"\ndone\n,\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft Partitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\n177\/433\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct % \"$devs\"\ndone\n\/*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '==c &amp;&amp;\n#!\/bin\/ksh\n#\n# metafree - Adrian Ball (ade@majords.co. uk)- 2007\/01\n#\n# Finds all devices containing soft partitions and shows\n# size\/allocation, unallocated space, devices etc\n#\n# NB: This is\nnot\nthe script that is listed on Sun's BigAdmin site\n# I had written this before knowing of that one's existence, but\n# subsequently found all the links to that one to be broken, so\n# I have not seen it.\n# Strangely I had picked the same name for the script...\n# Maybe someone will find this one useful.\nif [[ ! -x \/usr\/sbin\/metastat ]] ; then\necho \"Can't run metastat binary, bogus...\"\nexit 1\nfi\nprintf \"%-20s %9s %9s %10s %10s %sn\" Device GB Used Available Capacity \"Soft Partitions\"\nfor c in $(metastat -p | nawk '$2==\"-p\" {print $3}' | sort -u) ; do\nif [[ ${c%%[0-9]*} == d ]] ; then\n### It's a metadevice, use metastat to find the size\ncap=$(metastat $c 2&gt;\/dev\/null| nawk '\/Size:\/ {print $2\/2048\/1024;exit}')\nelif [[ ${c#\/} != $c ]] ; then\n### It's a real device, work out size assuming full disk\/LUN is used\ncap=$(prtvtoc $c | nawk '\n\/bytes\/sector\/ {bs=$2}\n\/sectors\/cyl\/ {sc=$2}\n\/accessible cyl\/ {as=$2}\nEND {print bs*sc*as\/1024^3}')\nelse\n### Assume we have a cXtX form of device, use prtvtoc to work out\n### the size of the slice\ncap=$(prtvtoc \/dev\/rdsk\/$c | nawk -v c=$c '\nBEGIN {split(c,a,\"s\"); s=a[2]}\n\/bytes\/sector\/ {bs=$2}\n$1==s {print $5*bs\/1024^3}')\nfi\nused=$(metastat -p | nawk -v c=$c '\n$2==\"-p\" &amp;&amp; $3==c {split($0,a,\"-o\")\nfor (frag in a) { split(a[frag], sz,\"-b\"); used+=sz[2] } }\nEND { print used\/2048\/1024 }\n')\necho $cap $used | nawk '{print $1-$2, $2\/$1*100}' | read avail pct\ndevs=$(metastat -p | sort | nawk -v c=$c '$3==c &amp;&amp; $2=\"-p\" {printf \"%s \", $1}')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct % \"$devs\"\n178\/433\ndone\n=\"-p\" {printf \"%s \", }')\nprintf \"%-20s %9.2f %9.2f %10.2f %9.1f%1s %sn\" $c $cap $used $avail $pct % \"$devs\"\ndone<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you want to know how much space you have free for soft partitioning use Adrian Ball&#8217;s script &#8220;metafree&#8221;, get it at: http:\/\/majords.co.uk\/scripts\/metafree or just copy\/paste this: #!\/bin\/ksh # # metafree &#8211; Adrian Ball (ade@majords.co. uk)- 2007\/01 # # Finds all devices containing soft partitions and shows # size\/allocation, unallocated space, devices etc # # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-405","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=405"}],"version-history":[{"count":0,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/405\/revisions"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}