Troubleshooting Storage Device Issues
We have covered a lot of details in regards to setting up storage systems. With something this complex, it is not unheard of to have problems. There are numerous situations that may arise as we add and configure storage capacity to a system. It might be that the device isn't showing up on the system, or perhaps volumes that were created are not showing up. Some of the configuration files may have been improperly edited, and contain errors - this has to be found and resolved.
To troubleshoot issues it is a good thing to go back and verify each step, to ensure that all the steps actually accomplished the necessary task.
When troubleshooting the various storage issues that present themselves there is a process to follow:
- Be sure the devices are physically connected to the system. Check that cables, both communication cables and power cables, are securely attached on both ends. Perhaps test your cables to ensure they are working.
- Ensure the devices are powered on. Is the power cable good? Is it securely connected on both ends? Check for breaks in the wiring - use a tester if possible.
- Ensure the devices are turned on, if applicable. Some devices have a power switch that must be turned on prior to use.
- Verify the system recognizes the device by checking the /proc/ directory. Use either the fdisk command or the parted to verify that the partitions are present on the disk you think they are on.
- Confirm that the configuration files do not contain any typographical errors. Files such as the /etc/fstab are very particular about entries that are made or edited. Be sure that any edits you made were correct.
- Reload any configuration files that have had changes made to them.
- Ensure that there is enough storage capacity for what you are attempting to do.
- Confirm that the I/O workload is not overwhelming the device. Other problems such as a failed RAID device might also be causing issues with I/O performance.
- Use the partprobe command to cause the system to scan for new storage devices and partitions.
- Check system settings to make sure that you are not reaching limits imposed by system configuration.
The video covers some of the storage system managment commands that you need to properly manage your Linux system.
Storage System Configuration and Monitoring
Linux provides a set of tools that can be used to assist us in finding issues and resolving them, allowing the system to function at the most proficient level.
The ulimit Command
This command is actually built into the bash shell, so you won't find a ulimit man page on most distributions. It is often addressed in the bash man page; you will have to search for ulimit and the options are listed there.
Using the ulimit command with the -a option shows you all of the current user's limits:
pbmac@pbmac-server $ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 47525
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 47525
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Before you start changing your limits make sure you know what the limit refers to and how the value is interpreted.
The du Command
du summarizes disk usage of the set of FILEs, recursively for directories.
du [ OPTION ] [ FILE ]
Specifying a FILE on the command line is optional with the du command.
|End each output line with NULL.
|Write count of all files, not just directories.
|Print apparent sizes, rather than disk usage.
|Scale sizes to SIZE before printing on console.
|Produce grand total.
|Print total for directory only if it is N or fewer levels below command line argument.
|Print sizes in human readable format.
|For directories, don’t include size of subdirectories.
|Display only total for each directory.
|Show time of last modification of any file or directory.
|Exclude files that match PATTERN.
A simple example, specifying a file/directory, and the output shows the size of that directory, including all sub-directories:
pbmac@pbmac-server $ du -hs ~/Documents/
Without the -s option it would list each file recursively from this point of the file system, specifying the file name and the size of the file. Other options can be found on the man page.
The df Command
df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
df [ OPTION ] [FILE]
The file name is optional when using the df command. It is also permissible to enter multiple file names.
|Includes pseudo, duplicate and inaccessible file systems.
|Scales sizes by SIZE before printing them.
|Print sizes in power of 1024.
|Print sizes in power of 1000.
|List inode information instead of block usage.
|Limit listing to local file systems.
|Use POSIX output format.
|Invoke sync before getting usage info.
|Elide all entries insignificant to available space, and produce grand total.
|Limit listing to file systems of type TYPE.
|Print file system type
pbmac@pbmac-server $ df /home
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 310238080 125360048 169095788 43% /home
No options...defaults to all devices
pbmac@pbmac-server $ df
/dev/sda1 8940016 5730240 2732592 68% /
/dev/sda2 80503616 11943000 64448232 16% /usr
/dev/sda6 310238080 133552864 160902972 46% /home
/dev/sda5 80503616 24386528 52004704 32% /var
The output shows which file system this mount point is on, how many 1K blocks are in this partition, how many are used, how many are yet available and the percent of use, as well as the mount point of this file system.
"du command in Linux with examples" by msdeep14, Geeks for Geeks is licensed under CC BY-SA 4.0
"df command in Linux with Examples" by msdeep14, Geeks for Geeks is licensed under CC BY-SA 4.0