blob: 1a4ca7ecc01a5656c893f25f1d391a581ad8ed69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/sh
# Query a disk for partitions and display them
#############################
. ${PROGDIR}/backend/functions.sh
. ${PROGDIR}/backend/functions-disk.sh
if [ -z "${1}" ]
then
echo "Error: No disk specified!"
exit 1
fi
if [ ! -e "/dev/${1}" ]
then
echo "Error: Disk /dev/${1} does not exist!"
exit 1
fi
DISK="${1}"
get_disk_cyl "${DISK}"
CYLS="${VAL}"
get_disk_heads "${DISK}"
HEADS="${VAL}"
get_disk_sectors "${DISK}"
SECS="${VAL}"
echo "cylinders=${CYLS}"
echo "heads=${HEADS}"
echo "sectors=${SECS}"
# Now get the disks size in MB
KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
MB=$(convert_byte_to_megabyte ${KB})
echo "size=$MB"
# Now get the Controller Type
CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`"
echo "type=$CTYPE"
|