Score:1

How could I check total free storage capacity left on my system among multiple hdd's?

cn flag

I have 15 SATA hard drives attached to my computer and having to go through them one by one, writing down the free space and then summing everything up is not ideal.

Is there a command or a combination of commands that could do that? Ideally where I could pass something like /dev/sd* since I do not want to include the nvme drives.

Score:1
cn flag

EDIT: I should read man pages more often. It is as simple as

df --total -h /dev/sd*

Okay I figured out something

df --output=avail  /dev/sd* | tail -n +2 | datamash sum 1

What this basically does is listing mounted disks and displaying only the available space as output, then using tail for removing the first line which is the column title Avail then finally summing the numbers with datamash.

Score:0
ar flag

Keep in mind with the df command in order to exclude virtual RAM disk entries such as /dev, use the -x parameter:

df -x tmpfs -x devtmpfs --total -h

Another way to do this is with the lsblk command

  • -l output in list format
  • -n skip the header line
  • -b print in bytes
  • -o outputs specified column(s)
  • FSAVAIL print file-system size available/free
lsblk -l -n -b -o FSAVAIL | grep -v ^$ | \
awk '{sum+=$1} END{print sum}' | numfmt --to=iec

Use grep to exclude empty lines, awk to sum the first column, and finally numfmt to convert bytes to "human readable" format.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.