5

I'm looking for a tool that will scan my GUI-less server and create an easy to digest rough overview of all the block devices and their relationship (disk partitions, mdadm devices, LVM PVs & LVs etc) in some rich visual format (html, pdf, svg, png...).

Here's a simple example visualization:

    +--------+---------------------+ +-------------------+
    | sda1   |                     | |       sdc1        |
    +--------+---------------------+ +-------------------+
        +               +                      +
    +--------+---------------------+ +-------------------+
    | sdb1   |                     | |       sdd1        |
    +--------+---------------------+ +-------------------+
        |               |                      |
        v               v                      v
    +---+---+ +---------+----------+ +--------+----------+
    |  md0  | |        md1         | |       md2         |
    +-------+ +---------+----------+ +--------+----------+
    | /boot |                    \     /
      ext4                        \   /
                                   \ /
                                    +
                                    |
                                    v
              +------------------------------------------+
              |                vgmain                    |
              +------+-----------------+-----------------+
              |/root |  /home          |   /var          |
                ext4    btrfs              ext4

I don't need detail (I can get that from the CLI tools like lsbls, fdisk, mdadm, pvdisplay, lvdisplay, df)

ndemou
  • 1,215
  • 2
  • 16
  • 27
  • This is really a Unix-Linux question, and has been answered in that stack. http://unix.stackexchange.com/questions/125429/tracking-down-where-disk-space-has-gone-on-linux – Jeter-work Nov 23 '16 at 19:41
  • @Xalorous You think I should delete this question and re-post at unix.se? (BTW it's not the same subject as the question you're linking to becase I care about free space on the block device level not the filesystem level -- e.g. space left unused on a Physical Volume of LVM - and I also want a rich visualization not a text report) – ndemou Nov 23 '16 at 19:47
  • Might migrate the question there. It's in the area where the two stacks overlap. Since you're talking about one server, and haven't said that you'll be monitoring the report (which implies single use), the folks at Unix-Linux may have a better answer for you. If you need to do this hourly/daily/weekly on a bunch of servers, you need a script, and this may be the right place. You could always export the results of LVM and put it in a graph. BTW, why do you need it graphed? Also, free space on LVM physical volumes doesn't change unless you extend a logical volume. – Jeter-work Nov 23 '16 at 20:09
  • @Xalorous, regarding the graphing: in one recent case where I was checking a badly configured server it took me more than half an hour to notice that I had plenty of unpartitioned space in one of the disks. That happens when you're looking at the numbers reported by CLI tools like fdisk, pvdisplay, mdadm etc. In a graph it would stand out from the first look. – ndemou Nov 23 '16 at 20:18
  • Our environment uses Gnome. If I wanted a graphical view, assuming RHEL 7+, I'd use gnome-disks. I spend my time in a terminal window, mostly. If I had a local partition out of space on one of my servers, I would check for unused physical volume space (not there on servers that I set up with LVM, too easy to move around space). Then I would look for disk hogs. Disk usage analyzer is the coolest looking utility I've seen in a while. However, the `du|sort` options listed here and on the unix.se do an excellent job of this. – Jeter-work Nov 23 '16 at 20:46
  • I posted the question to unix/linux SE but can't delete it from here! – ndemou Nov 24 '16 at 14:34

2 Answers2

0

Your best friend here is a simple lsblk command. It will give you an output similar to that:

[root@somehost ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda    252:0    0  7.8G  0 disk
├─vda1 252:1    0  6.9G  0 part /
└─vda2 252:2    0  999M  0 part [SWAP]

For more information, feel free to read its excellent man page

shodanshok
  • 44,038
  • 6
  • 98
  • 162
  • `lsblk`is my starting point now but it's output is not even close to the style I'm looking for (_"some rich visual format (html, pdf, svg, png...)"_). See how the example in the question presents each block device only once and conveys at a glance a rough estimation of block device size and free space. lsblk will show a RAID1 md device with 3 disk partitions 3 times, will give me detailed size information but not something you can digest at a glance and will not display anything about free space (e.g. unpartitioned space in a disk). – ndemou Nov 25 '16 at 06:16
  • You are confusing a *visualization* style (eg: ascii chart) with a *file format* (eg: svg). I really think that with a GUI-less server `lsblk` is the best thing you can use, as it output is very clear and compact. Moreover, even graphical tools as `gnome-terminal` will give you a quite similar representation of connected disks. – shodanshok Nov 25 '16 at 06:46
-1

Perhaps you've already used it, but the du command can be used with the --max-depth=1 parameter to understand how the used space is distribuited in the file system tree, for example:

root@server:/# du --max-depth=1 -h .|sort -h
0       ./dev
0       ./proc
0       ./sys
4.0K    ./boot
4.0K    ./lib64
4.0K    ./media
4.0K    ./srv
28K     ./tmp
5.0M    ./etc
5.1M    ./sbin
9.9M    ./bin
30M     ./home
33M     ./run
44M     ./lib
1.2G    ./var
1.4G    ./opt
2.1G    ./usr
3.9G    ./root
8.6G    .

In this way you can visually recognize where most of the data are, change into that directory and recursively reuse the du command to find where you can free some data.

Mat
  • 1,783
  • 4
  • 22
  • 39
  • 4
    This will only display mounted filesystems. `lsblk' will display a tree of all of the block devices in the system, no matter what kind they are. Combining the two makes a fairly complete disk usage report. – Spooler Nov 18 '16 at 16:28
  • @SmallLoanOf1M: Indeed `lsblk` and `df` are my favorite tools for the task (`du` goes deeper and gives more detail than I need at this point). However on systems with mdadm and LVM it's time consuming to get a good overall picture of disk usage. The output of lsblk is 100% partition oriented. The output of df is 100% filesystem oriented. Between these two ends you can have complex relations. Last time I finally got paper and pencil to draw sketches like those you get from gparted with a bit more stuff to visualize mdadm, LVM devices. – ndemou Nov 20 '16 at 17:03