In Linux, you must mount a disk or partition to a folder, called a mount point, to access its data. This makes the filesystem on the disk available for reading and writing. Mounting is required to use any disk or partition with the system.

You can mount disks and partitions manually as needed or configure them to mount automatically at startup by editing the /etc/fstab file. You can mount using the disk’s device name, label, or UUID.

Knowing how to mount disks in Linux is crucial for accessing and managing your storage devices. This guide explains the process for manual and automatic mounting.

Steps to mount a disk or partition in Linux:

  1. Open the terminal.
  2. Identify the disk or partition you want to mount.
    $ lsblk
    NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    loop0    7:0    0  55.4M  1 loop /snap/core18/1944
    loop1    7:1    0  55.4M  1 loop /snap/core18/1932
    loop2    7:2    0 217.9M  1 loop /snap/gnome-3-34-1804/60
    loop3    7:3    0   219M  1 loop /snap/gnome-3-34-1804/66
    loop4    7:4    0  64.8M  1 loop /snap/gtk-common-themes/1514
    loop5    7:5    0    51M  1 loop /snap/snap-store/518
    loop6    7:6    0  62.1M  1 loop /snap/gtk-common-themes/1506
    loop7    7:7    0    51M  1 loop /snap/snap-store/498
    loop8    7:8    0  31.1M  1 loop /snap/snapd/10707
    loop9    7:9    0  31.1M  1 loop /snap/snapd/10492
    sda      8:0    0    20G  0 disk 
    ├─sda1   8:1    0     1M  0 part 
    ├─sda2   8:2    0   513M  0 part /boot/efi
    └─sda3   8:3    0  19.5G  0 part /
    sdb      8:16   0    20G  0 disk 
    └─sdb1   8:17   0    20G  0 part 
    sr0     11:0    1  1024M  0 rom
  3. Determine the filesystem type of the disk or partition.
    $ blkid /dev/sdb1
    /dev/sdb1: UUID="ccab0f8d-3b5b-4189-9da3-23c49159c318" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="c088a647-01"
  4. Create a directory for the mount point if it does not exist.
    $ mkdir disk
  5. Temporarily mount the disk or partition.
    $ sudo mount -t ext4 /dev/sdb1 disk
    [sudo] password for user:

    Replace ext4 with the actual filesystem type if different.

  6. Verify that the disk or partition is mounted.
    $ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    tmpfs           391M  1.8M  389M   1% /run
    /dev/sda3        20G  7.1G   12G  39% /
    tmpfs           2.0G     0  2.0G   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           4.0M     0  4.0M   0% /sys/fs/cgroup
    /dev/sda2       512M  7.8M  505M   2% /boot/efi
    tmpfs           391M  112K  391M   1% /run/user/1000
    /dev/sdb1        20G   45M   19G   1% /home/user/disk
  7. Unmount the previously mounted drive.
    $ sudo umount /dev/sdb1
  8. To mount the disk automatically at startup, edit the /etc/fstab file.
    $ sudo vi /etc/fstab
  9. Add an entry in /etc/fstab for the disk or partition.
    /dev/sdb1       /home/user/disk ext4    defaults        0       0
  10. Apply the changes by mounting all filesystems.
    $ sudo mount -a
  11. Confirm the disk or partition is mounted.
    $ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    tmpfs           391M  1.8M  389M   1% /run
    /dev/sda3        20G  7.1G   12G  39% /
    tmpfs           2.0G     0  2.0G   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           4.0M     0  4.0M   0% /sys/fs/cgroup
    /dev/sda2       512M  7.8M  505M   2% /boot/efi
    tmpfs           391M  112K  391M   1% /run/user/1000
    /dev/sdb1        20G   45M   19G   1% /home/user/disk
Discuss the article:

Comment anonymously. Login not required.