File: disk-info

package info (click to toggle)
fai 3.1.8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,144 kB
  • ctags: 164
  • sloc: sh: 3,410; perl: 1,780; makefile: 113
file content (22 lines) | stat: -rw-r--r-- 729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /bin/sh

### BEGIN SUBROUTINE INFO
# Provides-Var:    none
# Requires-Var:    none
# Short-Description: <task desc.>
### END SUBROUTINE INFO
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diskandsize() {

    local isdisk major minor blocks device suffix

    while read major minor blocks device suffix; do
	isdisk=1
	# skip ide cdrom
	[ -f /proc/ide/$device/media ] && grep -q cdrom /proc/ide/$device/media && isdisk=0
	[ $isdisk -eq 1 ] && echo "$device $blocks"
    done
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# echo a space separated list of devices and their block size
egrep ' cciss/c.d.\b| ida/c.d.\b| rd/c.d.\b| hd.\b| sd.\b|/disc\b' /proc/partitions | diskandsize