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.
-
Plug the USB drive into the Pi and boot it up.
-
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)
-
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
-
Unmount
$ umount /dev/sda1
-
Make linux filesystem
$ mkfs.ext4 /dev/sda1
-
Make directory under media
$ mkdir /media/usb
-
Mount
$ mount /dev/sda1 /media/usb
-
Determine PARTUUID for auto mount
$ blkid
Copy the PARTUUID to add to fstab
-
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