Test on a Virtual Server in Hetzner (sudo dmidecode --type system)
lshw
lshw - list hardware
First see all available options, sample output:
Four useful ones are cpu, memory, disk, network which we can see using -class arguments
here we are more interested in network and disk, first for network find how many interfaced we have:
then check that one which is up.
here -sanitize is for removing sensitive information like serial numbers, etc.
ethtool
ethtool - query or control network driver and hardware settings
It is more userful for network interface card check , an example of a home machine with home router
and we are interested in Speed: 100Mb/s which shows the speed
on a clould server Speed: Unknown! , so it is not always available
first check the NIC name
then check it by ethtool
On a dedicated server
What if we could not install ethtool or it did not show the port speed?
We can look at /sys/class/net/{nic-name}/speed which can show in the speed
lsblk
lsblk - list block devices
lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information.
If this command was not installed by default , install it
Simple example
Check for type disk , if it is HDD or SSD with lsblk is simple
even if the disk is SSD or NVMe the result seems to be HDD which is misleading and the reason is because it is a VM and it depends of bus type which has been chosen for the VM.
Also we can check th disk type by checking sys file
smartctl
smartctl - Control and Monitor Utility for SMART Disks
smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into most ATA/SATA and SCSI/SAS hard drives and solid-state drives.
sudo dmidecode --type system
System Information
Manufacturer: Hetzner
Product Name: vServer
Version: ...
Serial Number: ...
...
Family: Hetzner_vServer
sudo lshw -class cpu
sudo lshw -class memory
sudo lshw -class network
sudo lshw -class disk
ip -br a
lo UNKNOWN 127.0.0.1/8 ::1/128
enp3s0f0 UP <ip4>/24 <ip6>/64
enp3s0f1 DOWN
enp4s0f0 DOWN
enp4s0f1 DOWN
sudo lshw -sanitize -class network
*-network:0
description: Ethernet interface
product: NetXtreme II BCM5709 Gigabit Ethernet
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0f0 # the interface name which is UP
version: 20
serial: [REMOVED]
size: 1Gbit/s # this is what we looked for
capacity: 1Gbit/s # this is what we looked for
width: 64 bits
clock: 33MHz
...
...
*-network:1
description: Ethernet interface
product: NetXtreme II BCM5709 Gigabit Ethernet
vendor: Broadcom Inc. and subsidiaries
...
...
ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: on (auto)
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
ip -br a
lo UNKNOWN 127.0.0.1/8 ::1/128
eth0 UP 192.168.1.3/24 fe80::85b0:c2fb:fcba:9c0d/64
ethtool eth0
Settings for eth0:
Supported ports: [ ]
Supported link modes: Not reported
Supported pause frame use: No
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Port: Other
PHYAD: 0
Transceiver: internal
Auto-negotiation: off
Link detected: yes
ethtool enp3s0f0
Settings for enp3s0f0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: off
Supports Wake-on: g
Wake-on: g
Link detected: yes
# or just check the speed
enp3s0f0 | grep -i speed
Speed: 1000Mb/s
# see the NIC names
ls /sys/class/net
eth0 lo
# then we use eth0
cat /sys/class/net/eth0/speed
100
# with ethtool
sudo ethtool eth0 | grep -i speed
[sudo] password for shu:
Speed: 100Mb/s
# debian based
sudo apt install util-linux
# red hat based
sudo yum install util-linux
# arch
sudo pacman -S util-linux
# on a virutal sever
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
└─sda1 8:1 0 50G 0 part /
sr0 11:0 1 1024M 0 rom