Version 0 of Linux Disk Functions

Updated 2018-01-06 22:24:26 by CecilWesterhof

A handy proc and a script that uses it. The proc to see the mounted partitions. The script to see which partitions are becoming to full.

mounted

On a Linux system there are a lot of mounted partitions that are virtual. Sometimes I am just interested in which partitions are physical. For this I wrote the proc mounted.

proc mounted {} {
    set mount   [open "|mount" RDONLY]
    set mounted [list]
    # Skip header
    gets ${mount}
    while {-1 != [gets ${mount} line]} {
        if {[string index ${line} 0] == "/"} {
            lappend mounted [lindex [split ${line}] 2]
        }
    }
    close ${mount}
    lsort -nocase ${mounted}
}

A real partition starts with a '/', so all the lines that do not start with a '/' are skipped. The third entry is the mountpoint, so this is added to the list. When all entries are processed the sorted list is returned.