257 lines
7.4 KiB
HTML
257 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>mount 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">mount 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>mount attaches a filesystem to the directory tree. Essential for accessing disks, partitions, network shares, and other storage devices.</p>
|
|
<hr>
|
|
<h2>Basic Usage</h2>
|
|
<ul>
|
|
<li>mount - List all mounted filesystems</li>
|
|
</ul>
|
|
<ul>
|
|
<li>mount /dev/sda1 /mnt - Mount device</li>
|
|
</ul>
|
|
<ul>
|
|
<li>mount -t type /dev/sda1 /mnt - Specify filesystem type</li>
|
|
</ul>
|
|
<ul>
|
|
<li>umount /mnt - Unmount filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>umount -l /mnt - Lazy unmount</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Common Options</h2>
|
|
<ul>
|
|
<li>-t type - Filesystem type (ext4, ntfs, vfat, etc.)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-o options - Mount options (comma-separated)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-a - Mount all filesystems in /etc/fstab</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-r - Mount read-only</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-w - Mount read-write</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-v - Verbose output</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-n - Don't write to /etc/mtab</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-f - Fake mount (don't actually mount)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-l - Show labels</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-h - Show help</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Mount Options</h2>
|
|
<ul>
|
|
<li>ro - Read-only</li>
|
|
</ul>
|
|
<ul>
|
|
<li>rw - Read-write</li>
|
|
</ul>
|
|
<ul>
|
|
<li>noexec - Don't allow execution</li>
|
|
</ul>
|
|
<ul>
|
|
<li>nosuid - Ignore setuid bits</li>
|
|
</ul>
|
|
<ul>
|
|
<li>nodev - Don't interpret device files</li>
|
|
</ul>
|
|
<ul>
|
|
<li>sync - Synchronous I/O</li>
|
|
</ul>
|
|
<ul>
|
|
<li>async - Asynchronous I/O</li>
|
|
</ul>
|
|
<ul>
|
|
<li>atime - Update access time</li>
|
|
</ul>
|
|
<ul>
|
|
<li>noatime - Don't update access time</li>
|
|
</ul>
|
|
<ul>
|
|
<li>relatime - Relative access time</li>
|
|
</ul>
|
|
<ul>
|
|
<li>remount - Remount filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>bind - Bind mount</li>
|
|
</ul>
|
|
<ul>
|
|
<li>loop - Loop device</li>
|
|
</ul>
|
|
<ul>
|
|
<li>user - Allow users to mount</li>
|
|
</ul>
|
|
<ul>
|
|
<li>users - Allow any user to mount/unmount</li>
|
|
</ul>
|
|
<ul>
|
|
<li>nouser - Only root can mount</li>
|
|
</ul>
|
|
<ul>
|
|
<li>defaults - Default options (rw,suid,dev,exec,auto,nouser,async)</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Common Examples</h2>
|
|
<h3>List Mounts</h3>
|
|
<pre><code>mount</code></pre>
|
|
<p>Show all mounted filesystems.</p>
|
|
<h3>Mount Device</h3>
|
|
<pre><code>mount /dev/sda1 /mnt</code></pre>
|
|
<p>Mount partition to directory.</p>
|
|
<h3>Mount with Type</h3>
|
|
<pre><code>mount -t ext4 /dev/sda1 /mnt</code></pre>
|
|
<p>Specify filesystem type.</p>
|
|
<h3>Mount Read-Only</h3>
|
|
<pre><code>mount -r /dev/sda1 /mnt</code></pre>
|
|
<p>Mount as read-only.</p>
|
|
<h3>Mount with Options</h3>
|
|
<pre><code>mount -o ro,noexec /dev/sda1 /mnt</code></pre>
|
|
<p>Mount with specific options.</p>
|
|
<h3>Bind Mount</h3>
|
|
<pre><code>mount --bind /old/path /new/path</code></pre>
|
|
<p>Create bind mount.</p>
|
|
<h3>Mount Loop Device</h3>
|
|
<pre><code>mount -o loop image.iso /mnt</code></pre>
|
|
<p>Mount ISO file.</p>
|
|
<h3>Remount</h3>
|
|
<pre><code>mount -o remount,ro /mnt</code></pre>
|
|
<p>Remount with new options.</p>
|
|
<h3>Mount All</h3>
|
|
<pre><code>mount -a</code></pre>
|
|
<p>Mount all filesystems from /etc/fstab.</p>
|
|
<h3>Unmount</h3>
|
|
<pre><code>umount /mnt</code></pre>
|
|
<p>Unmount filesystem.</p>
|
|
<hr>
|
|
<h2>Filesystem Types</h2>
|
|
<ul>
|
|
<li>ext2, ext3, ext4 - Linux extended filesystems</li>
|
|
</ul>
|
|
<ul>
|
|
<li>xfs - XFS filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>btrfs - Btrfs filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>vfat, fat32 - FAT filesystems</li>
|
|
</ul>
|
|
<ul>
|
|
<li>ntfs - NTFS filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>iso9660 - CD/DVD filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>nfs - Network File System</li>
|
|
</ul>
|
|
<ul>
|
|
<li>cifs, smbfs - SMB/CIFS filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>tmpfs - Temporary filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>proc - Proc filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>sysfs - Sysfs filesystem</li>
|
|
</ul>
|
|
<ul>
|
|
<li>devtmpfs - Device filesystem</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Tips</h2>
|
|
<ul>
|
|
<li>Use mount to list current mounts</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use -t to specify filesystem type</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use -o for mount options</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use umount to unmount (not unmount)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use -l for lazy unmount if busy</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Check /etc/fstab for permanent mounts</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Essential for disk management</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use mount -a to mount all from fstab</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script async type="text/javascript" src="../blog/analytics.js"></script>
|
|
<script src="../theme.js"></script>
|
|
</body>
|
|
</html>
|
|
|