Device Management Command
Linux exposes hardware through the filesystem, so most devices appear as files under /dev. Effective administration therefore begins with identifying the correct device, checking how the kernel recognizes it, and only then mounting or modifying it. A set of compact command-line tools makes this process both fast and reliable.
Use lsblk to inspect disks, partitions, and logical volumes. Its tree-style output reveals device relationships, sizes, and current mount points:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part /
sdb 8:16 0 50G 0 disk
This is often the best first command when a new drive has been connected. The NAME, SIZE, TYPE, and MOUNTPOINT columns help distinguish an entire disk from one of its partitions. Add options such as -f to display filesystem information or -p to include a full device path.
For a closer look at the partition table, use fdisk:
$ sudo fdisk -l /dev/sda
The output includes disk geometry, partition boundaries, and partition types. It is useful before planning a new partition layout, although any destructive operation should be performed with extreme care.
Inspecting PCI, USB, and CPU Hardware
The lspci command lists devices connected through the PCI bus, including network adapters, graphics cards, and storage controllers. Detailed driver information can be filtered with grep:
$ lspci -k | grep -A 3 Ethernet
Use lsusb to inspect USB devices:
$ lsusb
Bus 001 Device 003: ID 0951:1666 Kingston Technology
This quickly confirms whether a USB flash drive, keyboard, or other peripheral has been detected. For processor details, lscpu displays the architecture, core count, thread count, model name, and virtualization capabilities.
These commands answer different questions: lspci identifies internal expansion devices, lsusb reports USB devices, and lscpu summarizes the processor itself.
Mounting and Unmounting Storage
A storage device must have a filesystem mounted before its contents can be accessed. First create a suitable directory, then mount the device:
$ sudo mkdir -p /mnt/usb
$ sudo mount /dev/sdb1 /mnt/usb
Confirm the result with findmnt or by checking lsblk again. When finished, unmount the filesystem cleanly:
$ sudo umount /mnt/usb
Unmounting releases the device and reduces the risk of data loss. If the system reports that the device is busy, identify the processes using the mount point:
$ sudo lsof /mnt/usb
$ sudo fuser -vm /mnt/usb
Review the listed processes before stopping them. Blindly terminating services can interrupt unrelated work.
To mount a filesystem automatically at boot, add an entry to /etc/fstab:
/dev/sdb1 /mnt/usb ext4 defaults,nofail 0 2
The fields represent the device, mount point, filesystem type, mount options, dump flag, and filesystem check order. Test the configuration before rebooting:
$ sudo mount -a
Using stable device paths such as /dev/disk/by-id/... can be preferable when the system contains multiple storage devices, because /dev/sda and /dev/sdb may change between boots.
Monitoring Device Events
When hardware is connected or removed, the kernel and udev receive device events. udevadm monitor displays those events in real time:
$ udevadm monitor
To inspect the properties assigned to an existing device, use:
$ udevadm info --query=all --name=/dev/sdb
The result may include device permissions, ownership, symlinks, and the rules used to create them.
Kernel messages are available through dmesg:
$ sudo dmesg --follow
Or, to view only the latest entries:
$ sudo dmesg | tail -20
Messages about disk detection, driver loading, I/O errors, and USB connection failures often appear here. Kernel device names can vary, so look for the model or bus information rather than assuming that every new disk will be named sdb.
Collecting Low-Level Hardware Information
dmidecode reads SMBIOS data supplied by the firmware. It can reveal the motherboard model, BIOS version, chassis details, and installed memory modules:
$ sudo dmidecode -t memory
$ sudo dmidecode -t bios
For a broader inventory, lshw presents the hardware configuration in a hierarchical format:
$ sudo lshw
$ sudo lshw -short
The shorter form is especially useful for scanning a large system, while the full output provides more extensive component information.
A Practical Troubleshooting Workflow
A dependable device-management workflow follows four stages:
- Identify the device with
lsblk,lspci,lsusb, orlscpu. - Confirm kernel detection by reviewing
dmesgor watchingudevadm monitor. - Inspect or mount the device with tools such as
blkid,mount, orfdisk -l. - Clean up and verify by unmounting the filesystem and checking the final device state.
For example, when attaching a USB drive, confirm its appearance in lsusb, locate the corresponding block device with lsblk, mount the correct partition, and unmount it when the transfer is complete. This identify-first approach prevents one of the most common administration mistakes: acting on the wrong device path.