
New dedicated server: acceptance and verification
- Tutorial

Starting work with a new server, it is worth checking if it matches the declared configuration. Many novice users have difficulty when they need to view server information using commands available only in the console.
In this article, we will talk about how you can get the Linux server specification on the command line.
General System Information
You can get information about the system using the uname command, which writes the name of the operating system used to standard output. If you specify one of the options described below, the console will display more specialized information about the characteristics of the system:
# uname -a Linux srv1 3.8.0-35-generic # 50-Ubuntu SMP Tue Dec 3 01:24:59 UTC 2013 x86_64 x86_64 x86_64 GNU / Linux
Operating system name, kernel compilation date, version and bit: Tue Dec 3 01:24:59 UTC 2013, 3.8.0-35-generic, i386 - 32 bits, x86_84 - 64 bits.
- -a display all possible information;
- -i show kernel identifier information;
- -m show the type of current hardware platform;
- -n show system name;
- -p show the type of processor architecture of the server;
- -r show operating system release information;
- -s show the name of the operating system used;
- -v show version information of the operating systems used.
Information about the operating system distribution used can also be displayed using the cat / etc / issue command:
# cat / etc / issue Ubuntu 13.04 \ n \ l
There is another way to view distribution information:
# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 13.04 Release: 13.04 Codename: raring
Hardware Information
Lshw utility
The lshw utility displays the complete list of hardware components of the system along with device information on the console. lshw is included in many modern Linux distributions by default; if it is missing, it can be installed with the standard package manager:
# apt-get install lshw
To display information about hardware on the console, enter the following command:
# lshw
You can display this information in abbreviated form using the -short option:
# lshw -short
Using lshw, you can also view information about the individual hardware components of the system. To do this, use the -C key, after which the device is indicated, information about which should be displayed on the console:
- processor:
# lshw -C cpu
- memory:
# lshw -C memory
- disk subsystem:
# lshw -C disk
Lspci utility
Using the lspci utility, you can view information about all PCI buses and devices connected to them. It is included in the pciutils package, which is included in most modern Linux distributions; if it is missing for any reason, it can be installed using the standard package manager.
By default, lspci shows a short list of devices; more detailed information can be obtained using numerous options.
The -t option displays information about buses and connected devices in a tree format. Only digital device identifiers will be indicated in the output:
# lspci -t - [0000: 00] - + - 00.0 + -01.0- [01] - + - 00.0 | \ -00.1 + -03.0- [02] - + - 00.0 | \ -00.1 + -07.0- [04] - + -09.0- [05] - + -14.0 + -14.1 + -1c.0- [03] ---- 00.0 + -1d.0 + -1e.0- [06] ---- 03.0 + -1f.0
You can view device digital codes using the -n option:
# lspci -n 01: 00.1 0200: 14e4: 1639 (rev 20) 02: 00.0 0200: 14e4: 1639 (rev 20) 02: 00.1 0200: 14e4: 1639 (rev 20) 03: 00.0 0104: 1000: 0079 (rev 05) 06: 03.0 0300: 102b: 0532 (rev 0a)
At the beginning of each line, the output indicates the device code in the format ":.", And then the code in the format::.
To include not only codes, but also the names of the devices corresponding to them, the -nn option is specified:
# lspci -nn 01: 00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet [14e4: 1639] (rev 20) 03: 00.0 RAID bus controller [0104]: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] [1000: 0079] (rev 05) 06: 03.0 VGA compatible controller [0300]: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 [102b: 0532] (rev 0a)
You can determine the name of the device by the code “:.” Using the -s option:
# lspci -s 03: 00.0 03: 00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
To determine the device by the code “:,” you need to use the -d option:
# lspci -d 1000: 0079 03: 00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
After the -d switch, you can specify only the vendor code or device code, for example:
# lspci -d 8086: # lspci -d: 0532
In this case, a list of all devices corresponding to the entered code will be shown.
To view information about the kernel drivers responsible for specific devices, use the -k option:
# lspci -k 00: 1f.2 IDE interface: Intel Corporation 82801IB (ICH9) 2 port SATA Controller [IDE mode] (rev 02) Subsystem: Dell PowerEdge R610 SATA IDE Controller Kernel driver in use: ata_piix Kernel modules: ata_generic, pata_acpi, ata_piix 02: 00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20) Subsystem: Dell PowerEdge R610 BCM5709 Gigabit Ethernet Kernel driver in use: bnx2 Kernel modules: bnx2 03: 00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05) Subsystem: Dell PERC H700 Integrated Kernel driver in use: megaraid_sas Kernel modules: megaraid_sas
Pseudo File System / proc
Information about hardware components in Linux systems is stored in the so-called pseudo-file system / proc. It is called pseudo file because it is virtual and does not take up space on the drive at all. Most pseudo files stored in / proc are presented in human-readable form. The / proc tree is used by many programs that display information about the system.
CPU
Processor information is stored in the / proc / cpuinfo pseudo-file. To view its contents, enter the following command:
# cat / proc / cpuinfo
The output of this command contains a lot of different information: about the processor model, the number of cores, supported hardware virtualization technologies, etc.
The most voluminous and difficult to understand output section is, of course, flags. They are also contained in the output of the lshw command.
Consider the values of the most important flags:
- ht (HyperThreading) - support for simultaneous multithreading technologies; It is present in the series of processors Intel Xeon, Pentium 4, Atom, Core i3, Core i5, Core i7;
- lm (long mode) - is indicated if the processor is executed on 64-bit technology;
- vmx (for Intel), svd (for AMD) - the processor supports hardware virtualization technologies; means the availability of instructions for providing direct access to processor resources from guest systems;
- aes - support for expanding the AES command system;
- hypervisor - indicates if the OS is running under a hypervisor;
- smx - support for TXT technology (TPM).
Detailed information on the meaning of all flags can be found here and here .
Memory
You can view information about the total amount of free and used memory, including swap, using the free command. The output of this command may look, for example, like this:
# free -m total used free shared buffers cached Memory: 3627 3216 410 0 107 1157 - / + buffers / cached: 1950 1676 Swap: 3762 31 3731
The -m option indicates that the amount of free and used memory should be displayed in megabytes. To display the volume in gigabytes, you must specify the -g switch; this is convenient for servers with large (in the tens, or even hundreds of gigabytes) RAM capacity.
Even more detailed information is stored in the / proc / meminfo pseudo-file.
The output from the cat / proc / meminfo command includes the following main parameters:
- MemTotal - available amount of RAM;
- MemFree - shows how much memory is currently not used and available for allocation to processes;
- Buffers - an area of memory in which data is stored waiting to be written to disk;
- Cached - the volume occupied by the cache for reading pages from disk;
- SwapCached - the amount that was transferred to the swap area, and then moved back to RAM;
- Active - the amount of memory occupied by the most frequently used pages;
- Inactive - the amount of memory occupied by pages that are currently not in use;
- Swap {total, free} - the total volume of the swap area;
- Dirty - the so-called “dirty” pages (that is, those in RAM, but not yet flushed to disk);
- Writeback - pages currently flushed to disk;
- AnonPages - anonymous pages (data used by programs, but not associated with any file);
- Mapped - the total amount of memory transferred to the virtual address space of processes using mmap;
- Committed_AS - the amount of memory allocated to all processes (even if they do not use it in full).
Disk subsystem
To check the partition and number of disks, use the command:
# fdisk -l
The size of free and used disk space in all mounted file systems can be found using the df command. The following options are used with the command:
- -a display information about all file systems;
- -h display information in a human-readable format;
- -T show file system type;
- -t print only information about the specified types of file systems.
Consider the example output from the df -h command in more detail:
# df -h Filesystem Size Used Avail Use% Mounted on / dev / mapper / vg0-vg0root 50G 15G 32G 32% / tmpfs 5.9G 0 5.9G 0% / dev / shm / dev / sda1 1008M 62M 895M 7% / boot / dev / mapper / vg0-var 2.7T 839G 1.7T 33% / var
Information about the size of the actual free space is displayed in the Available section. If you add the numbers indicated in the Available and Used sections, the resulting amount will not be equal to the figure in the Size section. This is due to the fact that part of the disk space is reserved for system files and metadata.
You can view detailed information about the status of the hard disk using the smartctl utility included in the official repositories of most modern Linux distributions. To view the full information you need to enter the command:
# smartctl -a / dev / sda
The interpretation of the output of the command can be found in this article .
The pvdisplay, pvs, and pvscan commands are used to display information about physical volumes.
The pvscan command checks all block devices in the system for physical volumes:
# pvscan PV / dev / md0 VG vg0 lvm2 [462.96 GiB / 205.22 GiB free] Total: 1 [462.96 GiB] / in use: 1 [462.96 GiB] / in no VG: 0 [0]
Using the pvdisplay command, you can view detailed multi-line output for each physical volume:
# pvdisplay --- Physical volume --- PV Name / dev / md0 VG Name vg0 PV Size 462.96 GiB / not usable 1.87 MiB Allocatable yes PE Size 4.00 MiB Total PE 118517 Free PE 52536 Allocated PE 65981 PV UUID Idm6eZ-5vS0-IJCo-RDQq-WZNk-nJ22-eb7aDd
Using the pvs command, you can configure the data display format (one line for each volume). This is useful, for example, when writing scripts.
To view information about the logical volumes of the hard disk, the lvs, lvscan and lvdisplay utilities included in the lvm2 package are used. lvm2 is installed using the standard package manager:
# apt-get install lvm2
The lvscan command displays on the console a list of all logical volumes available in the system (listing the output fragment):
# lvscan ACTIVE '/ dev / vg0 / root' [18.62 GiB] inherit ACTIVE '/ dev / vg0 / www' [200.00 GiB] inherit
Using the lvdisplay command, you can display the list of attributes of logical volumes (name, size, layout) on the console. You can view information about the attributes of a specific logical volume by using the -v option and specifying its name (listing the output fragment):
# lvdisplay --- Logical volume --- LV Name / dev / vg0 / root VG Name vg0 LV UUID yPtVFt-BON5-agWC-jXSr-cU4x-Tcu9-NRiwMF LV Write Access read / write LV Status available # open 1 LV Size 18.62 GiB Current LE 4768 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253: 0 --- Logical volume --- LV Name / dev / vg0 / www VG Name vg0 LV UUID reCzuE-5dgN-A4eB-LubM-VtUA-Lclq-MUt5v6 LV Write Access read / write LV Status available # open 1 LV Size 200.00 GiB Current LE 51200 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253: 2
The lvs command is similar to the pvs command discussed above: it allows you to configure the data display format and displays one volume per line.
# lvs LV VG Attr LSize Origin Snap% Move Log Copy% Convert root vg0 -wi-ao 18.62g www vg0 -wi-ao 200.00g
Information about the status of active software RAID arrays is stored in the / proc / mdstat pseudo-file. You can view its contents using the cat / proc / mdstat command:
# cat / proc / mdstat Personalities: [raid1] read_ahead 1024 sectors md1: active raid1 hda3 [0] hdc3 [1] 522048 blocks [2/2] [UU] md0: active raid1 hda2 [0] hdc2 [1] 4192896 blocks [2/2] [UU] md2: active raid1 hda1 [0] hdc1 [1] 128384 blocks [2/2] [UU]
In the example we are considering, the system contains three arrays. For each of them, the / proc / mdstat pseudo-file has a separate section containing the following information:
- RAID name
- RAID state
- array level;
- names of the physical partitions that make up the array;
- the number of configured devices and the number of working devices in the array;
- the state of each working device (U means that the device is working, and _ - that the device failed, sync - synchronization is in progress).
You can check whether hardware RAID is used on the server using the lspci command we already know:
# lspci -nn | grep RAID
If RAID is used, a response of the type will be displayed on the console:
02: 00.0 RAID bus controller [0104]: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] [1000: 0079] (rev 04)
Information about the state of hardware RAID cannot be obtained using the standard tools of the operating system. There are special utilities for this: MegaCLI for LSI controllers and Adaptec Storage Manager (asm) for adaptec. They are not included in the official repositories of Linux systems. You can download megacli from here , a ASM from the Adaptec website .
Network interfaces
Information about all network interfaces connected to the system is contained in the / proc / net / dev pseudo-file. When you enter the command cat / proc / net / dev, a list of all active and inactive network interfaces will be displayed on the console.
The status of all current interfaces can be viewed using the ip link show up command.
The ip address command displays information about all network interfaces:
# ip address 1: lo: mtu 16436 qdisc noqueue state UNKNOWN link / loopback 00: 00: 00: 00: 00: 00 brd 00: 00: 00: 00: 00: 00 inet 127.0.0.1/8 scope host lo inet6 :: 1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link / ether 00: 30: 48: f2: 7a: a0 brd ff: ff: ff: ff: ff: ff inet 5.178.83.252/29 brd 5.178.83.255 scope global eth0 inet6 fe80 :: 230: 48ff: fef2: 7aa0 / 64 scope link valid_lft forever preferred_lft forever 3: eth1: mtu 1500 qdisc noop state DOWN qlen 1000 link / ether 00: 30: 48: f2: 7a: a1 brd ff: ff: ff: ff: ff: ff
UP means the interface is working; NO CARRIER means no cable or transceiver in the network card port. The ip route command (abbreviated as ip r) displays the routing tables on the console.
# ip r default via 88.93.16.185 dev br0 50.178.87.0/24 via 192.16.122.1 dev br0 10.0.0.0/8 via 192.16.122.1 dev br0 1.131.251.0/24 via 192.16.122.1 dev br0 192.16.122.0/24 dev br0 proto kernel scope link src 192.16.122.2 88.93.16.184/29 dev br0 proto kernel scope link src 88.93.16.186
Conclusion
This article is the first in a series of publications devoted to the problems of configuring and administering web services. In the near future, we plan to publish articles on the features of installing and optimizing server software, troubleshooting, etc.
We will be glad if in the comments you express your wishes and suggestions on the topics of the following publications of the cycle.
Readers who for one reason or another cannot comment on posts on Habré are welcome to our blog .