geoffthompson

Formatting a USB Flash Drive on Raspbian

I wanted to play around with Plex on my Raspberry Pi, to kick the tires on Plex, and also to see if Plex would run on a Pi vs. having to run it on a NAS or some other more powerful device that is optimized for transcoding files.

Of course, next time I want to do this, I will have forgotten everything, so here it is, documented for time eternal.

  1. Plug the USB drive into the Pi and boot it up.

  2. Once logged in, switch to Admin user, and list disks.

    $ sudo su
    $ fdisk -l
    

    Make a note of the external -- usually the last one, /dev/sdX ( X = drive letter)

  3. Format the disk

    $ fdisk /dev/sda
    

    Enter d to delete a partition Enter 1 to select the first partition Type d to delete another partition if it exists Type n to make a new partition Type p for primary Type 1 for first partition Hit Enter for default first sector Hit Enter for default last secotr Type w to write the new partition

  4. Unmount

    $ umount /dev/sda1
    
  5. Make linux filesystem

    $ mkfs.ext4 /dev/sda1
    
  6. Make directory under media

    $ mkdir /media/usb
    
  7. Mount

    $ mount /dev/sda1 /media/usb 
    
  8. Determine PARTUUID for auto mount

    $ blkid
    

    Copy the PARTUUID to add to fstab

  9. Edit fstab and paste in copied PARTUUID

    $ vi /etc/fstab
    

    PARTUUID=0ee3f9e3-334e-6547-a4a2-6563f0dd4bfc /media/usb ext4 defaults,noatime 0 1

    Not sure what all these values are? Just copied values from the / mount