K-Fun Yu Home

How to mount a disk on Raspberry Pi

June 4 2020

Here is a summary on mount a USB disk on Raspberry Pi command prompt:

  1. Plug in the USB drive/disk, run follow command and determine which UUID and the shortcut for mount point:
    $ ls -l /dev/disk/by-uuid/
  2. Create mount point (optionally replace with your favorite name):
    $ sudo mkdir /media/usb
    $ sudo chown -R pi:pi /media/usb
  3. Mount the drive/disk (replace sda1 and mount point name accordingly):
    $ sudo mount /dev/sda1 /media/usb -o uid=pi,gid=pi
  4. To un-mount the drive/disk after use (replace with your chosen mount point name):
    $ umount /media/usb Or sudo if the drive is auto-mount with fstab file: $ sudo umount /media/usb
  5. To auto-mount with fstab file, to avoid re-mounting upon every reboot:
    $ sudo nano /etc/fstab Add to the end: UUID=[uuid of drive] /media/usb vfat auto,nofail,noatime,users,rw,uid=pi,gid=pi 0 0 Replace vfat (FAT32) with ntfs-3g, ext3, or ext4 if the drive is using another file system. $ sudo apt-get install ntfs-3g if needed.

    Then $ sudo reboot