- Added detailed instructions for checking and managing USB devices - Included commands for: - Viewing system information related to USB devices - Identifying mount points and device information - Checking filesystem and data integrity - Testing for bad blocks and running SMART diagnostics - Benchmarking read speed and safely removing devices This commit provides a comprehensive guide for handling USB devices in Linux environments.
2.0 KiB
Linux
Table of Contents
System information
Basic Commands
USB Devices
Test USB Key
Device Information Check if the system recognizes the device and show the latest system messages related to USB devices being connected.
lsusb
dmesg | tail -n 20
Find Mount Points and Device Information Identify mount points, partitions, and other relevant details of mounted devices.
lsblk -f
df -h | grep /dev/sdc
findmnt /dev/sdc1
mount | grep /dev/sd
Print Detailed Information About the USB Key View detailed partition and disk information.
fdisk -l /dev/sdc
Test the File System Check and repair the filesystem on the USB key.
fsck /dev/sdc1
Test Data Integrity Perform read/write tests to ensure the integrity of the USB key.
- Unmount the USB Key (if mounted):
umount /media/fabrice/BD48-F8BB - Write Test:
dd if=/dev/zero of=/dev/sdc bs=4M count=256 status=progress - Read Test:
dd if=/dev/sdc of=/dev/null bs=4M count=256 status=progress
Check for Bad Blocks Identify any bad sectors on the USB key.
-
Read-only test:
badblocks -v /dev/sdc -
Non-destructive read-write test:
badblocks -nsv /dev/sdc -
The -n option performs a non-destructive read-write test.
-
The -s option shows progress.
-
The -v option is for verbose output.
Perform a SMART Test Run SMART diagnostics to test the health of the USB key.
- Start a short SMART test:
smartctl -t short /dev/sdc - View test results:
smartctl -a /dev/sdc
Benchmark the Speed Measure the read speed of the USB key.
hdparm -t /dev/sdc
Unmount and Safely Remove Unmount the USB key and safely remove it from the system.
umount /mnt/usb
eject /dev/sdc