How to Mount an External Storage Device from the Command Line
Mount
-
Connect the drive to your machine and open the terminal.
-
Navigate to
mnt/and make sure there is an empty directory to act as the mount point.$ cd /mnt $ mkdir externaldrive -
Determine the name of your device with
lsblk(if you need to know the format of your drives filesystem, you can runlsblk -f). In my case, these were the results:
-
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 -
Done! You can now navigate to your mount point and access your external drive.
$ cd /mnt/externaldrive $ ls
Unmount
-
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 -
Power off the drive. This command will safely eject the drive and spin down the platters. Note: the command uses
/dev/sdbnot/dev/sdb1since 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 -
Done! You can now detach the usb connection.





