[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

know my storage devices, (df -h)

i need to know the available space that i have on my linux machine, so i used df -h command
and it gave me the following:
/dev/sdb2             21G      5.8G       15G    .....       /
udev                     2.0G     152K       2.0G   ......     /dev
/dev/sdb3             444G    2.2G        442G  .....      /home

i need to know if those are the storage devices that i have on the machine?

another thing is: executing iostat -k generated the following:
sda       0.00          0.00     ....
sdb       4.95          0.12    

the question:
so what are sda and sdb and what are sdb2, sdb3 and udev ?
which of those are my storage devices?
thanks in advance
3 Solutions
sdX - are scsi disks, where scsi means scsi, sata, usb, etc (and ata disks as well in very fresh kernel)
sdaX - are partition numbers within first scsi disk
udev is special virtual(in-memory only) device mounted on /dev folder.

Seems like first disk is unused (not mounted anywhere).
mte01Author Commented:
so, if i want to calculate my storage size, and the used size, do i simply run the command: df -h
and then calculate the total values?
what about the dvd or cd rooms will they be displayed?
thanks a lot for the fast reply.
> what about the dvd or cd rooms will they be displayed?
Only if they are used (loaded and [auto]mounted).

Basically df shows currently known(in-use) storage. In the provided output there's no partition from /dev/sda mounted. Since it's unused, it's not shown along df output.
Also check /proc/partitions file, it contains all known block devices/partitions along with total sizes.
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

As said above, 'df' will only show you mounted partitions.

You can look what partitions the disks have by (carefully) using the 'fdisk' command.

So, if you want to see the partitions on /dev/sda you would do (as root):

fdisk /dev/sda

That will tell you the total size of the disk, plus partition sizes (in KB, I think).

If there are partitions on /dev/sda, then you would have to mount them to see how much free space they have.
> fdisk /dev/sda
> p
even safer: fdisk -l /dev/sd[a-z]
Duncan RoeSoftware DeveloperCommented:
Also, "swapon -s" will show you partitions being used for swap

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now