Is there any way EASY(CLI) to see ALL partitions on ALL drives and Space Used

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Well, the only way you're going to know about space used is if you are aware of the FS used on the partition/drive, so I'm unaware of anyway to get disk usage without having the drive mounted.

Straight from the man page for df on my ubuntu install

This version of df cannot show the
space available on unmounted file systems, because on most kinds of
systems doing so requires very nonportable intimate knowledge of file
system structures.


So perhaps there's a branch of df that has FS specific tasks, should be easy to find if there are.
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
Hmmmm.... how about without showing space used on unmounted partitions? Now that I think about it, I don't know if there's a GUI tool that will show space on UNmounted partitions either, so I was asking for a bit much.

Ultimately, I'm looking for something in a non-GUI environment that will show at least all attached drives and all the partitions on them.

A command for that might exist?

Joe
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
I don't know of a simple all-in-one command to do it, but fdisk(and it's variants) will show all the information you could want from a drive regarding it's partitions and boot status, smartctl will be able to give you all the metric information from the drives given they support S.M.A.R.T., and you could use mount to show all active drives. Depending on the environment you could browse dmesg to try and figure out what drives are detected by the kernel or browse around /dev and/or /proc(all dependent on your environment) to try and figure out connected but not mounted drives.
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Originally posted by: sourceninja
why does df -h not fit the bill. Is there something I"m missing?

df -h doesn't show unmounted partitions.

The problem with showing free space on unmounted file systems is that 'free space' is defined by the file system and therefore the file system has to be active to know about the mount in the first place.

There is another kind of 'free space' -- unpartitioned space, that you can look at via cfdisk, but I don't think that's what the OP had in mind.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
oh, I didn't realize he wanted to look at unmounted file systems. Seems like it would be easier to just mount everything and look at it.
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
So... anything in addition to what Crusty posted for seeing everything WITHOUT seeing free space?

Joe
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
Originally posted by: hki
fdisk -l should do what you want.

YES!!!

That is exactly the command I wanted! I had been using fdisk and then "guessing" through all the drives to see if it worked, e.g.:

fdisk /dev/hda
fdisk /dev/hdb
etc
fdisk /dev/sda
fdisk /dev/sdb
etc

and writing down the results of the ones that didn't say:

Unable to open /dev/???

This is perfect! Thanks so much!

Joe
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Well you know you can also do ls /dev/ | grep hd or ls /dev/ | grep sd

That'll show you the connected drives assuming Linux.
 

SleepWalkerX

Platinum Member
Jun 29, 2004
2,649
0
0
Like others have said, fdisk -l will tell you every storage device that your OS will pick up. If you type the mount command it'll output a list of the mounted devices along with their mountpoints.

There are awesome gui tools which will visually display your hard drive's contents, size blocks proportionally to the size of the files, and essentially give you a picture of what's eating up your hard drive's space. Kdirstat and Baobab (in Ubuntu its packaged under gnome-utils) are two such tools.
 

lucky9

Senior member
Sep 6, 2003
557
0
0
For KDE fans KDiskFree will give all mountable partitions/disks visually.
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
Kdirstat is sort of a Linux analog of "TreeSize" for Windows (which I use a TON on client boxes to see where they've WASTED all the space). I didn't try Baobab. KDiskFree is, as far as I can tell, just a GUI'ed "df -h" sort of thing.

I've already used 'fdisk -l' a half dozen times where it's helped me out in just the last week.

Thanks again everyone!

Joe