How to get total disk space available in Solaris 10

1

How do I get the total disk space available in Solaris 10?

  • I used iostat -En, but it is not showing the correct data.
  • df -h contains duplicate information.

Is there any generic way to find the total disk space in Solaris 10?

prasanna

Posted 2013-08-05T05:40:12.843

Reputation: 121

iostat -En has no idea about how the disks are used (or not), it displays the whole device size. – jlliagre – 2013-08-05T05:59:14.253

Hi jlliagre, you are right, i have given it wrong. Correct command is df -k, But,it contains duplicate info. How to remove it and get exact disk space. – prasanna – 2013-08-19T09:30:17.270

Answers

2

Assuming that by duplicate information, you mean you are confused by df available space column reporting the same value for different ZFS file systems located in the same pool, I would suggest to use the zpool list command to get disk statistics similar to what df outputs for traditional file systems.

eg:

$ zpool list
NAME   SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zp    97.5G  46.0G  51,5G    47%  1.00x  ONLINE  -

Note that the reported numbers are directly usable only when a single backend device is used for the pool, or if it built on concatenated disks only. When using mirroring or any form of raidz, it is much more complex to estimate the actual free space, not to mention if compression and/or deduplication is activated...

jlliagre

Posted 2013-08-05T05:40:12.843

Reputation: 12 469

If the pool is using RAID vdevs, this doesn’t display the usable capacity/free but backend capacity/free, which is much greater, depending on RAID level. – Daniel B – 2016-01-26T16:26:56.853

@DanielB Double check, zpool does display the usable capacity regardless of the raid level, or lack of, not the backend one. – jlliagre – 2016-01-26T16:51:51.277

Usable, yes. It’s not the space available for data though. See here.

– Daniel B – 2016-01-26T21:43:15.427

@DanielB Got it, thanks. The reported numbers are indeed confusing when mirroring or raidz variants are used. The actual available space is only relatively accurate with a single device or when the backend devices are simply concatenated. Answer updated. – jlliagre – 2016-01-26T22:36:08.033

Thanks for the command, it worked well in 5.11, will check in some other versions of solaris. – prasanna – 2013-08-20T05:28:53.827

This command definitely works with all versions of Solaris supporting ZFS and more generally with any OS supporting ZFS. – jlliagre – 2013-08-20T05:49:41.747

0

df

Use the df command to show the amount of free disk space on each mounted disk.

df -k  

Use the df -k command to display disk space information in Kbytes.

user243290

Posted 2013-08-05T05:40:12.843

Reputation: 1

df -k command shows disk space in bytes, while summing up the size gives wrong data, since it lists every logical mount. The below command will not give the unique list, i need to get a unique mount list, so that, i can get the correct size df -k | awk 'NR>1' | awk '{x+=$2} END {print x}' – prasanna – 2013-08-05T06:32:11.863

0

You may use the -t <filesys> option of df, to limit its output to some types of file system, As an example, on my system df -h gives :

Filesystem      Size  Used Avail Use% Mounted on
rootfs           63G   19G   42G  31% /
/dev/sda3        63G   19G   42G  31% /
devtmpfs        2.0G     0  2.0G   0% /dev
tmpfs           2.0G  804K  2.0G   1% /run
shm             2.0G     0  2.0G   0% /dev/shm
cgroup_root      10M     0   10M   0% /sys/fs/cgroup
/dev/sda2        16G  4.0G   11G  27% /var
/dev/sda6       834G   52G  741G   7% /home

while df -h -t ext4 gives :

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        63G   19G   42G  31% /
/dev/sda2        16G  4.0G   11G  27% /var
/dev/sda6       834G   52G  741G   7% /home

If you want to sum over more than one type of partition, just add an other -t option, like :

df -h -t ext4 -t ext3 -t vfat

Levans

Posted 2013-08-05T05:40:12.843

Reputation: 2 010

This does not look like Solaris output. – jww – 2016-07-09T18:00:02.690