> For the complete documentation index, see [llms.txt](https://ghoulsec.gitbook.io/ghoulsec-vault/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ghoulsec.gitbook.io/ghoulsec-vault/server-are-fun/managing-partitions/mounting-disk-on-startup.md).

# Mounting disk on startup

To mount a disk on startup in Linux, you need to modify the `/etc/fstab` file, which manages automatic mounting of file systems at boot time.

#### Steps to Mount a Disk on Startup:

1. **Find the Disk's UUID**:
   * First, you need to find the UUID of the partition you want to mount. You can use the `blkid` command:

     ```bash
     sudo blkid
     ```
   * This will list all the partitions and their UUIDs. Look for the partition you want to mount, e.g., `/dev/sda1`, and note down its UUID.
2. **Create a Mount Point**:
   * You need a directory where the disk will be mounted. You can create a mount point, for example, `/mnt/mydisk`:

     ```bash
     sudo mkdir /mnt/mydisk
     ```
3. **Edit the `/etc/fstab` File**:
   * Open the `/etc/fstab` file in a text editor:

     ```bash
     sudo nano /etc/fstab
     ```
   * Add an entry at the end of the file with the following format:

     ```
     UUID=<your-disk-uuid> <mount-point> <filesystem-type> <options> <dump> <pass>
     ```

     For example, to mount `/dev/sda1` as an ext4 filesystem to `/mnt/mydisk`, add:

     ```
     UUID=your-disk-uuid /mnt/mydisk ext4 defaults 0 2
     ```

     * Replace `your-disk-uuid` with the actual UUID you found in step 1.
     * Replace `/mnt/mydisk` with the mount point you created in step 2.
     * The `ext4` should be the correct filesystem type (you can check this with `blkid`).
     * `defaults` are the typical options (you can change them if needed).
     * `0` means no backup for the partition.
     * `2` indicates the order in which filesystems are checked by `fsck` at boot (root filesystem is usually `1`, and others are `2`).
4. **Test the Mount**:
   * After saving the `/etc/fstab` file, you can test the mount without rebooting:

     ```bash
     sudo mount -a
     ```
   * This command mounts all filesystems listed in `/etc/fstab`, including the one you just added. If there is no error, the disk should mount successfully.
5. **Reboot and Verify**:
   * Reboot your system:

     ```bash
     sudo reboot
     ```
   * After rebooting, check if the disk is mounted correctly:

     ```bash
     df -h
     ```
