273 lines
7.4 KiB
HTML
273 lines
7.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; base-uri 'self'; form-action 'self' https://defcon.social https://bsky.app;">
|
|
<meta http-equiv="X-Content-Type-Options" content="nosniff">
|
|
<link rel="stylesheet" href="../assets/css/style.css">
|
|
<link rel="icon" type="image/x-icon" href="../favicon.ico">
|
|
<script>
|
|
// Apply theme immediately to prevent flash
|
|
(function() {
|
|
const theme = localStorage.getItem('theme') ||
|
|
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
})();
|
|
</script>
|
|
<title>lsblk Cheatsheet - Cheatsheets - Launch Pad</title>
|
|
</head>
|
|
<body>
|
|
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode">
|
|
<svg class="theme-icon theme-icon-moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
|
<svg class="theme-icon theme-icon-sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: none;"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
|
|
</button>
|
|
<br/><br/>
|
|
<div class="name">
|
|
__ _______________________ _________._________________________
|
|
\_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/
|
|
| __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_
|
|
| \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \
|
|
\___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ /
|
|
\/ \/ \/ \/ \/ \/ \/
|
|
</div>
|
|
<div class="blog-page-header">
|
|
<div class="blog-header-content">
|
|
<a href="/cheatsheets" class="back-link" title="Back to Cheatsheets">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="home-icon"><path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
|
|
</a>
|
|
<h1 class="blog-page-title">lsblk Cheatsheet</h1>
|
|
</div>
|
|
</div>
|
|
<div class="blog-post-container">
|
|
<div class="blog-posts-container" style="max-width: 900px; margin: 0 auto;">
|
|
<div class="blog-post">
|
|
<div class="blog-post-content">
|
|
<p><a href="index.html">← Back to cheatsheets</a></p>
|
|
<p><a href="../index.html">← Home</a></p>
|
|
<hr>
|
|
<p>lsblk (list block devices) displays information about block devices in a tree format. Shows disks, partitions, and their mount points in an easy-to-read hierarchy.</p>
|
|
<hr>
|
|
<h2>Basic Usage</h2>
|
|
<ul>
|
|
<li>lsblk - List all block devices</li>
|
|
</ul>
|
|
<ul>
|
|
<li>lsblk -a - Show all devices</li>
|
|
</ul>
|
|
<ul>
|
|
<li>lsblk -f - Show filesystem information</li>
|
|
</ul>
|
|
<ul>
|
|
<li>lsblk -m - Show mount points</li>
|
|
</ul>
|
|
<ul>
|
|
<li>lsblk -o column1,column2 - Custom output</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Options</h2>
|
|
<ul>
|
|
<li>-a - Show all devices</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-f - Show filesystem information</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-m - Show mount points</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-l - Use list format instead of tree</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-n - No headings</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-o columns - Specify output columns</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-b - Print sizes in bytes</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-d - Don't print holder devices</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-e list - Exclude devices by major number</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-i - ASCII characters only</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-p - Print full device paths</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-r - Raw output</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-s - Inverse dependencies</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-S - Sort by size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-t - Show topology information</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-x column - Sort by column</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Output Columns</h2>
|
|
<ul>
|
|
<li>NAME - Device name</li>
|
|
</ul>
|
|
<ul>
|
|
<li>KNAME - Kernel device name</li>
|
|
</ul>
|
|
<ul>
|
|
<li>MAJ:MIN - Major and minor numbers</li>
|
|
</ul>
|
|
<ul>
|
|
<li>FSTYPE - Filesystem type</li>
|
|
</ul>
|
|
<ul>
|
|
<li>MOUNTPOINT - Mount point</li>
|
|
</ul>
|
|
<ul>
|
|
<li>LABEL - Filesystem label</li>
|
|
</ul>
|
|
<ul>
|
|
<li>UUID - Filesystem UUID</li>
|
|
</ul>
|
|
<ul>
|
|
<li>PARTUUID - Partition UUID</li>
|
|
</ul>
|
|
<ul>
|
|
<li>PARTLABEL - Partition label</li>
|
|
</ul>
|
|
<ul>
|
|
<li>SIZE - Size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>TYPE - Device type</li>
|
|
</ul>
|
|
<ul>
|
|
<li>RO - Read-only flag</li>
|
|
</ul>
|
|
<ul>
|
|
<li>RM - Removable device flag</li>
|
|
</ul>
|
|
<ul>
|
|
<li>MODEL - Device model</li>
|
|
</ul>
|
|
<ul>
|
|
<li>SERIAL - Serial number</li>
|
|
</ul>
|
|
<ul>
|
|
<li>STATE - State</li>
|
|
</ul>
|
|
<ul>
|
|
<li>OWNER - Device owner</li>
|
|
</ul>
|
|
<ul>
|
|
<li>GROUP - Device group</li>
|
|
</ul>
|
|
<ul>
|
|
<li>MODE - Device node permissions</li>
|
|
</ul>
|
|
<ul>
|
|
<li>ALIGNMENT - Alignment offset</li>
|
|
</ul>
|
|
<ul>
|
|
<li>MIN-IO - Minimum I/O size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>OPT-IO - Optimal I/O size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>PHY-SEC - Physical sector size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>LOG-SEC - Logical sector size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>ROTA - Rotational device flag</li>
|
|
</ul>
|
|
<ul>
|
|
<li>SCHED - I/O scheduler</li>
|
|
</ul>
|
|
<ul>
|
|
<li>RQ-SIZE - Request queue size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>DISC-ALN - Discard alignment offset</li>
|
|
</ul>
|
|
<ul>
|
|
<li>DISC-GRAN - Discard granularity</li>
|
|
</ul>
|
|
<ul>
|
|
<li>DISC-MAX - Discard max bytes</li>
|
|
</ul>
|
|
<ul>
|
|
<li>DISC-ZERO - Discard zeroes data</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Common Examples</h2>
|
|
<h3>Basic List</h3>
|
|
<pre><code>lsblk</code></pre>
|
|
<p>Show all block devices in tree format.</p>
|
|
<h3>With Filesystems</h3>
|
|
<pre><code>lsblk -f</code></pre>
|
|
<p>Include filesystem information.</p>
|
|
<h3>With Mount Points</h3>
|
|
<pre><code>lsblk -m</code></pre>
|
|
<p>Show mount points.</p>
|
|
<h3>List Format</h3>
|
|
<pre><code>lsblk -l</code></pre>
|
|
<p>Use list instead of tree.</p>
|
|
<h3>Custom Columns</h3>
|
|
<pre><code>lsblk -o NAME,SIZE,TYPE,MOUNTPOINT</code></pre>
|
|
<p>Show specific columns.</p>
|
|
<h3>Full Paths</h3>
|
|
<pre><code>lsblk -p</code></pre>
|
|
<p>Show full device paths.</p>
|
|
<h3>Sort by Size</h3>
|
|
<pre><code>lsblk -S</code></pre>
|
|
<p>Sort devices by size.</p>
|
|
<h3>All Information</h3>
|
|
<pre><code>lsblk -f -m -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT</code></pre>
|
|
<p>Comprehensive view.</p>
|
|
<hr>
|
|
<h2>Tips</h2>
|
|
<ul>
|
|
<li>Use -f to see filesystem types</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use -m to see mount points</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use -o to customize output</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use -l for script-friendly output</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use -p for full device paths</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Tree format shows hierarchy clearly</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Essential for disk management</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Great for understanding partition layout</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script async type="text/javascript" src="../blog/analytics.js"></script>
|
|
<script src="../theme.js"></script>
|
|
</body>
|
|
</html>
|
|
|