/ html / wiki / linux / HowDoI / mount-disk.html
mount-disk.html
  1  <!DOCTYPE html>
  2  <html lang="de">
  3     <head>
  4        <meta charset="UTF-8" />
  5        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6        <meta http-equiv="onion-location" content="http://bopbopl6lohkl2rts3ltesjnag4hzs4jrx2h6k6etgq5xasbpqekzlqd.onion" />
  7        <title>BOP Wiki: Mounting a disk in Linux</title>
  8        <link rel="stylesheet" href="/assets/stylesheet.css" />
  9        <link rel="icon" type="image/x-icon" href="/assets/img/favicon.png">
 10     </head>
 11     <body>
 12        <header>
 13           <!-- --------------------------------------------------------------------------------------------------------------------------------- -->
 14           <script src="/assets/js/navbar-OpenClose.js"></script>
 15           <script src="/assets/js/lightbox.js"></script>
 16            <script src="/assets/js/copyCodeButton.js"></script>
 17           <link rel="stylesheet" href="/resources/js-libraries/highlightJS/atom-one-dark.min.css">
 18           <script src="/resources/js-libraries/highlightJS/highlight.min.js"></script>
 19           <script src="/resources/js-libraries/highlightJS/highlightjs-line-numbers.min.js"></script>
 20           <script>hljs.highlightAll();</script>
 21           <script>hljs.initLineNumbersOnLoad();</script>
 22           <!-- --------------------------------------------------------------------------------------------------------------------------------- -->
 23           <div class="branding">
 24              <button class="toggle-btn-navbar" id="navbarOpenButton">☰</button>
 25              <a href="/">
 26              <img class="logo" src="/assets/img/logo.png">
 27              </a>
 28              <div class="typing-animation">BytesOfProgress</div>
 29           </div>
 30        </header>
 31        <div id="navbarContainer" class="navbar-container">
 32           <iframe class="navbar-iframe" src="/assets/navbar/navbar.html" frameBorder= "0"></iframe>
 33        </div>
 34        <main>
 35           <!-- --------------------------------------------------------------------------------------------------------------------------------- -->
 36           <article class="site-post">
 37              <header class="post-header">
 38                 <h1 class="post-title">Mounting a disk in Linux</h1>
 39                 <div class="post-meta">
 40                 </div>
 41              </header>
 42           </article>
 43           <nav class="breadcrumb">
 44              <a href="/">Home</a>
 45              <span class="divider">›</span>
 46              <a href="/wiki/">Wiki</a>
 47              <span class="divider">›</span>
 48              <a href="/wiki/linux/A1linux.html">GNU / Linux</a>
 49              <span class="divider">›</span>
 50              <a href="/wiki/linux/HowDoI/A1HowDoI.html">HowDoI</a>
 51              <span class="divider">›</span>
 52              <span class="current">Mounting a disk in Linux</span>
 53           </nav>
 54           <section class="post-content">
 55              <!-- --------------------------------------------------------------------------------------------------------------------------------- -->
 56              <p>
 57                 This method was tested in Debian 12.
 58              </p>
 59              <p>
 60                 Step 1: Identify your disk in lsblk.
 61              </p>
 62              <blockquote># lsblk</blockquote>
 63              <p>
 64                 For example, if you Identify it as "sdb", its path would be "/dev/sdb".
 65              </p>
 66              <p>
 67                 Step 2: Creating a mounting point. For example:
 68              </p>
 69              <blockquote># mkdir /mnt/HDD1</blockquote>
 70              <p>
 71                 Step 3: Format the partition in ext4. Please note that
 72                 all data on it will be gone.
 73              </p>
 74              <blockquote># mkfs.ext4 /dev/sdb</blockquote>
 75              <p>
 76                 Step 4: Mount the disk:
 77              </p>
 78              <blockquote># mount /dev/sdb /mnt/HDD1</blockquote>
 79              <p>
 80                 Step 5: Check if the disk was mounted correctly, by
 81                 running "lsblk" again. The output should look something
 82                 like this:
 83              </p>
 84              <div class="code-box">
 85                 <pre><code>NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
 86  sdb                                             8:0    0 232.9G  0 disk  /mnt/HDD1</code></pre>
 87              </div>
 88              <span style="color:#ff6600">
 89                 <h1 style="font-size:30px">Making it mount automatically after a reboot</h1>
 90              </span>
 91              <p>
 92                 We can achieve this by using fstab.
 93              </p>
 94              <p>
 95                 Step 1: Find out the UUID of the disk with the command "blkid". Copy it.
 96              </p>
 97              <p>
 98                 Step 2: Add following line to the file "/etc/fstab":
 99              </p>
100              <p>
101                 Make sure to replace "ID" with the actual UUID of the disk. "auto" determines
102                 the used filesystem. It tries to find out the right filesystem by itself, but
103                 you can specify the filesystem your are using, in this case "ext4".
104              </p>
105              <blockquote>UUID=1234abcd-12ab-34cd-56ef-1234567890ab /mnt/HDD-1 auto nofail 0 2</blockquote>
106              <p>
107                 Step 3: Check if the automated mounting via fstab worked by
108                 running following command:
109              </p>
110              <blockquote># mount -a</blockquote>
111              <!-- --------------------------------------------------------------------------------------------------------------------------------- -->
112           </section>
113           <footer class="post-footer">
114              <a href="/wiki/linux/HowDoI/A1HowDoI.html" class="cta-button">← Back</a>
115           </footer>
116        </main>
117     </body>
118  </html>