How to Mount an External Storage Device from the Command Line


February 1, 2025
Written by Sean David Reed
OS/Distro: Ubuntu 24.04.1 LTS

Mount

  1. Connect the drive to your machine and open the terminal.

  2. Navigate to mnt/ and make sure there is an empty directory to act as the mount point.

    $ cd /mnt
    $ mkdir externaldrive
  3. Determine the name of your device with lsblk (if you need to know the format of your drives filesystem, you can run lsblk -f). In my case, these were the results:

    ![/images/how-to-mount-an-external-storage-device-from-the-command-line/01.png](Screenshot of mounted block devices viewed with the lsblk command)

  4. Mount the drive to your empty directory. Note: when I first tried this step I ran sudo mount /dev/sdb /mnt/externaldrive, which didn't work. I had to specify the partition, not the disk.

    $ sudo mount /dev/sdb1 /mnt/externaldrive
  5. Done! You can now navigate to your mount point and access your external drive.

    $ cd /mnt/externaldrive
    $ ls

Unmount

  1. Unmount the drive. This is not the same as safely removing the drive, which comes next.

    $ sudo umount /mnt/externaldrive # OR the next command
    $ udisksctl unmount -b /dev/sdb1
  2. Power off the drive. This command will safely eject the drive and spin down the platters. Note: the command uses /dev/sdb not /dev/sdb1 since we are powering down the whole device, not just a partition - powering down a partition doesn't make sense anyway.

    $ udisksctl power-off -b /dev/sdb
  3. Done! You can now detach the usb connection.

Resources Used