BytesOfProgress

Wiki


Mounting a disk in Linux

This method was tested in Debian 12.


Step 1: Identify your disk in lsblk.


  # lsblk
    

For example, if you Identify it as "sdb", its path would be "/dev/sdb".

Step 2: Creating a mounting point. For example:


  # mkdir /mnt/HDD1
    

Step 3: Format the partition in ext4. Please note that all data on it will be gone.


  # mkfs.ext4 /dev/sdb
    

Step 4: Mount the disk:


  # mount /dev/sdb /mnt/HDD1
    

Step 5: Check if the disk was mounted correctly, by running "lsblk" again. The output should look something like this:

  NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
  sdb                                             8:0    0 232.9G  0 disk  /mnt/HDD1

Making it mount automatically after a reboot

We can achieve this by using fstab.

Step 1: Find out the UUID of the disk with the command "blkid". Copy it.

Step 2: Add following line to the file "/etc/fstab":

Make sure to replace "ID" with the actual UUID of the disk. "auto" determines the used filesystem. It tries to find out the right filesystem by itself, but you can specify the filesystem your are using, in this case "ext4".


  UUID=1234abcd-12ab-34cd-56ef-1234567890ab /mnt/HDD-1 auto nofail 0 2
    

Step 3: Check if the automated mounting via fstab worked by running following command:


  # mount -a
    



back