# 04-F.13: Storage Issues - Find and Fix

## 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.
• 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.

### 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. Syntax: du [ OPTION ] [ FILE ]  Specifying a FILE on the command line is optional with the du command. Command Options: Optoins Option Meaning -0, –null End each output line with NULL. -a, –all Write count of all files, not just directories. –apparent-size Print apparent sizes, rather than disk usage. -B, –block-size=SIZE Scale sizes to SIZE before printing on console. -c, –total Produce grand total. -d, –max-depth=N Print total for directory only if it is N or fewer levels below command line argument. -h, –human-readable Print sizes in human readable format. -S, -separate-dirs For directories, don’t include size of subdirectories. -s, –summarize Display only total for each directory. –time Show time of last modification of any file or directory. –exclude=PATTERN 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/
311M    /home/pbmac/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.

Syntax:

df [ OPTION ] [FILE]


The file name is optional when using the df command. It is also permissible to enter multiple file names.

Command Options:

Options Option Meaning
-a, –all Includes pseudo, duplicate and inaccessible file systems.
-B, –block-size=SIZE Scales sizes by SIZE before printing them.
-h, –human-readable Print sizes in power of 1024.
-H, –si Print sizes in power of 1000.
-i, –inodes List inode information instead of block usage.
-l, –local Limit listing to local file systems.
-P, –portability Use POSIX output format.
–sync Invoke sync before getting usage info.
–total Elide all entries insignificant to available space, and produce grand total.
-t, –type=TYPE Limit listing to file systems of type TYPE.
-T, –print-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.