File: task_sysinfo

package info (click to toggle)
fai 6.5.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,084 kB
  • sloc: sh: 6,774; perl: 5,665; makefile: 138
file content (125 lines) | stat: -rwxr-xr-x 3,426 bytes parent folder | download | duplicates (2)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#! /bin/bash

# display some information about the system and save it to the logserver

if inside_nfsroot; then
    # activate all software RAID arrays
#    echo DEVICE partitions > /etc/mdadm/mdadm.conf

    # start software raid
    /usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf
    udevadm trigger
fi

# first show some hardware info
echo Showing system information.

# too much details [ -x "$(command -v dmidecode >&/dev/null)" ] && dmidecode
(
    cd /sys/class/dmi/id || exit
    grep . {board_,bios_,product_}* 2>/dev/null| sed -e 's/:/: /'| grep -E -iv '123456789|To Be Filled|: Not |N/A|:[[:blank:]]+$'
)

if command -v lshw >&/dev/null; then
    lshwtmp=$(mktemp)
    lshw -short -quiet -C system,memory,processor,display,storage,disk | tee $lshwtmp
    echo
    grep processor $lshwtmp| sed -e 's/[^ ]*//' | uniq -c | perl -pe 's/\s+(\d+)\s+(.+)/$1 $2/;'
    rm $lshwtmp
fi

echo -n "Counting all CPU cores: "
grep "model name" /proc/cpuinfo | sort | uniq -c | sed -e 's/model name.*://' -e 's/(R)//g' -e 's/(TM)//g' -e 's/^[[:blank:]]\+//'

echo "NUMA configuration:"
numactl -H

if [ -f /usr/bin/upower ]; then
    upower -e | grep 'BAT' | xargs -n1 upower -i | egrep 'native-path|vendor|model|energy-full'
fi

echo
if command -v hwinfo >&/dev/null; then
    hwinfo --short --cpu --sys
    hwinfo --short --smp
    hwinfo --short --bios
    hwinfo --short --storage-ctrl --netcard --framebuffer --gfxcard
    hwinfo --short --disk --cdrom --network
    hwinfo --short --sound --wlan
fi

echo
# print info about audio device
lspci | grep -i audio
[ -f /proc/asound/card0/codec#0 ] && grep Codec /proc/asound/card*/codec#*

echo
# show network device parameters of devies which are UP
devices=$(ip -br ad show up| awk '/UP / {print $1}' | tr '\n' ' ')
for dev in $devices; do
    ip addr show up $dev
done

echo '=================================================='
echo "Now more detailed information"
echo '=================================================='

lspci

if [ -d /sys/firmware/efi ]; then
    efibootmgr
fi

for device in /dev/sd?; do
    [ -b "$device" ] || continue # make sure device exists and is valid block device
    [ $(stat -c %G $device) = "disk" ] || continue
    hdparm -I $device | grep -E -v '^$' | head -5 | sed -e 's/^[[:blank:]]*//'
done

# pretty print disks by id and device names
find /dev/disk/by-id ! -type d -printf "%-40f\t->  %l\n" | grep -v part | sort -k3 | awk -F'->' '{print $2 ":  " $1}' | sed -e 's#../##g'

echo
cat /proc/partitions

command -v lsblk >&/dev/null && lsblk -i
command -v blkid >&/dev/null && blkid

# very detailed
echo "========================================"
for disk in $disklist; do
    smartctl -i /dev/$disk | tail +4
    echo "----------------------------------------"
    fdisk -lu /dev/$disk
    echo "----------------------------------------"
    parted -s /dev/$disk print
    echo "----------------------------------------"
    sfdisk -d /dev/$disk
    echo "----------------------------------------"
    LC_ALL=C file -s /dev/$disk?* | grep -v ": empty"
done

if command -v nvme >&/dev/null; then
    nvme list
fi

fdisk -lu

dmsetup ls

# show lvm information
pvs;vgs;lvs

if command -v btrfs >&/dev/null ; then
    btrfs fi show
fi

if inside_nfsroot; then
     fai-mount-disk -fr
     [ -f $target/etc/fstab ] && cp -p $target/etc/fstab $LOGDIR
fi

df -PTh | grep -E ':|^/|^Filesystem'
# - - - - - - - - - - -
save_dmesg
task_savelog