Skip to content

Instantly share code, notes, and snippets.

@todgru
Last active January 21, 2019 05:27
Show Gist options
  • Save todgru/bc6cf7b836955c45ac1248cba830e024 to your computer and use it in GitHub Desktop.
Save todgru/bc6cf7b836955c45ac1248cba830e024 to your computer and use it in GitHub Desktop.

raspberry pi auto mount usb drive

my drive is hfsplus usb 2TB

get the usb UUID from blkid

pretty print drive locations lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

followed this, with special attention to the order. Drive must be unmounted before running fsck.

sudo su
umount /dev/sda2
apt-get install hfsplus hfsprogs hfsutils
fsck.hfsplus /dev/sda2
mount /dev/sda2 /media/usbdrive
echo "UUID=802a74ed-8f65-3294-83d5-c4bdcf9e08d7 /media/usbDrive hfsplus force,rw 0 0" >> /etc/fstab

Since the drive was originally setup on osx, I needed to update the mount point chmod ug+wx /media/usbdrive. This allows my user to write to the drive. I also added my user to the disk group, usermod -a -G disk tod.

not sure this is needed

for hfsplus drives to work on linux as rw, need to mount drive on osx and run sudo diskutil disableJournal <drive name>.

Moving the drive back to the raspberry, chown -R 1000:pi /mnt/usb/. This is uid of the pi user.

And it works! drive is now read/writeable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment