Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 27th March 2019
jayblingham jayblingham is offline
Real Name: Jay
Port Guard
Join Date: Mar 2019
Location: Toronto, Ontario, Canada
Posts: 15
Default Mounting exFAT USB Stick

Firstly, I'd like to thank everyone for the warm welcome. I knew daemonforums was going to be a great place to share information, but I never thought that through my "Intro" post, I'd already be off to the races with people willing to jump in and answer questions.

Now, since that info will eventually be buried in an Intro post no one will ever look at again here is my experience, along with the excellent help and information I received from jggimi to get what I needed working.

First, the problem...

I was new to OpenBSD but not to *NIX type operating systems, so I was trying to use my existing skills to mount a 128GB USB Drive that had been originally formatted in Windows 10.

Determining the device name:

As I found that familiar commands like lsblk and fdisk -l were not present.

I took to a search engine and found:
sysctl hw.disknames

This command doesn't need to be run as root, so you can leave out the doas or sudo.

As you can see from the output above, I have two disks.

sd0:d4460e17cba6fe3c - which is my primary boot drive (A Samsung 250GB SSD)
sd1 - which is my USB stick.

The trick is to run this command twice and compare the output before/after inserting the USB stick.

Finding the Partition ID:

Next, I needed to find what OpenBSD saw as the partition name, so I could mount it.

This is done using the disklabel utility:
disklabel sd1

This can also be done using the full /dev/sd1 - but I discovered it isn't required. This command needs to be run as root using either doas or sudo as you prefer (I prefer sudo because I haven't trained my fingers to automagically type doas yet).

# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: USB 3.0 FD
duid: 0000000000000000
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 15053
total sectors: 241827840
boundstart: 0
boundend: 241827840
drivedata: 0

16 partitions:
# size offset fstype [fsize bsize cpg]
c: 241827840 0 unused
i: 241796608 31232 NTFS
The output above may look squished, but essentially you need the section after 16 partitions:. This shows that there are two visible partitions. While helping me to troubleshoot this information, jggimi added some great detailed information about how Windows manages disks which you can read here, but suffice it to say that by looking at the above you can plainly see the larger partition as well as the file system type - or do you?

This is where things got really confusing to me, as I was attempting to mount this partition using NTFS. Why not right? Clearly it says that it's NTFS right there in the disklabel output! Except it's not

Again, jggimi shed a bit of light on why it is possibly reporting incorrectly based on Windows partition types, and not knowing if Windows uses the same partition type for both NTFS and exFAT. You can read jggimi's response yourself here.

Either way, the pro tip here is if it looks like NTFS, but doesn't mount like NTFS... it's possibly exFAT.

Now, let's move on to the meat of how to mount exFAT in OpenBSD.

Install exFAT FUSE:

OpenBSD doesn't come shipped with the tools needed to mount exFAT out of the box. This is a simple fix though, as the package required is available through the PKG_ADD command:

sudo pkg_add exfat-fuse

Finally, mounting the USB Stick:

We're in the home stretch! This part should be familiar to anyone with experience mounting drives on *NIX systems.

First, create your mount point (the directory or folder that you want to see the files in once they are mounted):

sudo mkdir /mnt/usbstick

Now, the only difference between say, Linux and OpenBSD is that you aren't using the vanilla mount command. You're going to use the command that first tells FUSE (Filesystem in Userspace Utility) what filesystem you are mounting, and then mounts it for you.

sudo mount.exfat-fuse /dev/sd1i /mnt/usbstick

When you run this command, if successful, you'll either get no error and be sent back to your command prompt, or you'll see something like FUSE exfat 1.2.8.

You can now view your files and folders on the USB stick by navigating/browsing to that folder!

Unmounting the USB Stick:

Just to make sure I close the loop, when you're done using the stick - you will want to unmount it before removing it from the system. If you don't, you risk filesystem corruption on the usb stick - and in some systems (not OpenBSD) - I've had full system crashes from yanking out a drive that wasn't properly dismounted.

sudo umount /mnt/usbstick

That's it! I know that was a long post, but my intention was to give explanation along with the steps for those who like to learn why things do things. Hopefully I've bolded/highlighted the important parts for the tldr folks out there.
Reply With Quote
  #2   (View Single Post)  
Old 27th March 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
Join Date: May 2008
Location: USA
Posts: 7,635

Originally Posted by jayblingham View Post
The trick is to run this command twice and compare the output before/after inserting the USB stick.
You can also view disk drive assignment in the kernel output when you insert the stick. You can see it on the console, or in an xconsole(1). It's also logged in your dmesg(8), in /var/run/dmesg.boot, and in /var/log/messages.
...I haven't trained my fingers to automagically type doas yet...
I know a lot of people use a shell alias so they don't have to worry about their muscle memories.
Clearly it says that it's NTFS right there in the disklabel output! Except it's not
Yup. MBR/GPT partition type x'07' is used for NTFS. And also for exFAT. And, for HPFS/IFS, for QNX, and something called "Advanced Unix" too.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
input/output error | mounting usb stick bluemorph OpenBSD General 11 7th December 2014 07:07 PM
Creating NetBSD live CD or USB stick mbzadegan NetBSD General 4 12th February 2014 10:00 AM
7.3-BETA1 Available...but no memory stick image J65nko FreeBSD Installation and Upgrading 1 28th May 2010 01:06 AM
Everything you want to know about Installing FreeBSD on a USB stick FBSD Guides 0 17th February 2010 08:22 AM
make iso bootable from USB stick ccc FreeBSD General 2 30th October 2008 02:28 AM

All times are GMT. The time now is 08:40 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick