04-F.13: Storage Issues - Find and Fix
- Page ID
- 26858
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)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.
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.
Adapted from:
"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