Installing ExFAT on QNAP

28 Mar 2020

I’m still going strong with my QNAP TS-653A NAS Drive to hold my photos, TimeMachines, iTunes, and more. But in the three years since I wrote my last set of directions for installing ExFAT on Qnap, things have changed. Qnap’s firmware is at version 4.4.1 and older versions of the Ubuntu FUSE binaries no longer work. Additionally, Qnap also created the ability for you to purchase an ExFAT license to read your external drives and media cards, but users are having many problems after buying it. So, I am updating my directions so that you can install free ExFAT drivers on your Qnap.

Unfortunately, the ExFAT recognition is only for the command line – many GUI utilities complain that no license is present and will not process data on your disk. However, all command line utilities still work, especially cp -a. Another downside is you need to re-install ExFAT between reboots, but that can be accomplished via a tiny script.

Download & Install

These directions require the command line, both on your local Mac/Linux machine and on the NAS. We will install packages onto the NAS from Ubuntu Disco LTS which includes the most up to date versions of ExFAT and FUSE; the latest LTS files are exfat-fuse & exfat-utils.

To get the files ready for installation, simply copy-and-paste these commands into a terminal on your local machine:

# Make your temp folder
mkdir exfat-temp ; cd exfat-temp

# Download the packages, these are the ones I used; update for new versions if needed.
curl -O -L http://mirrors.edge.kernel.org/ubuntu/pool/universe/f/fuse-exfat/exfat-fuse_1.3.0-1_amd64.deb
curl -O -L http://mirrors.edge.kernel.org/ubuntu/pool/universe/e/exfat-utils/exfat-utils_1.3.0-1_amd64.deb

# Extract out the data files we need
ar -x exfat-fuse_1.3.0-1_amd64.deb

# Three files will be extracted, data.tar.xz, control.tar.xz, and debian-binary; we need the "data" file
mv data.tar.xz    fuse.tar.xz

# Repeat the ar/mv steps to get utils "data" file
ar -x exfat-utils_1.3.0-1_amd64.deb
mv data.tar.xz    utils.tar.xz

We now have the software for the Qnap; you must copy/transfer/sftp the utils.tar.xz & fuse.tar.xz files to the NAS. Note: system directories like /sbin & /root are reset between reboots, so place the files someplace safe, like a normal user’s directory.

After transmitting, we need to install the software onto the NAS in the correct file system locations. The easiest way is to extract the tar files from the NAS root level directory. So, ssh into the NAS as admin and then:

# Enter the destination directory here:
cd /path/to/uploaded/files 

ls -l
# You will see something like this:
total 4
-rw-r--r--   1 admin administrators 23612 2020-03-21 15:53 fuse.tar.xz
-rw-r--r--   1 admin administrators 39492 2020-03-21 15:49 utils.tar.xz

# Now you can copy/paste these next lines.

# Convenience variable to help with installation
FUSE_DIR=`pwd`

# Perform the actual install
cd /
tar -xvf ${FUSE_DIR}/fuse.tar.xz
tar -xvf ${FUSE_DIR}/utils.tar.xz

# Test the installed binaries to see if they run
mount.exfat

If you saw the standard usage directions, Usage: mount.exfat [-d] [-o options] [-V] <device> <dir>, then the installation worked!

Disk Mounting

Now, let’s mount your disk:

  • First, create the mount point, for example: mkdir /mnt/ext-drive
  • Plug the USB hard drive or memory card into the NAS and wait a few seconds.
  • Run dmesg and look for the device where the drive was attached; this should should be of the form sd*# – the letters s and d followed by a letter and a number. For me, it looked like:
[603735.602602] sd 19:0:0:0: [sde] Very big device. Trying to use READ CAPACITY(16).
[603735.606777] sd 19:0:0:0: [sde] 7814035456 512-byte logical blocks: (4.00 TB/3.64 TiB)
[603735.606780] sd 19:0:0:0: [sde] 4096-byte physical blocks
[603735.614337] sd 19:0:0:0: [sde] Write Protect is off
[603735.614340] sd 19:0:0:0: [sde] Mode Sense: 27 00 00 00
[603735.622357] sd 19:0:0:0: [sde] No Caching mode page found
[603735.622362] sd 19:0:0:0: [sde] Assuming drive cache: write through
[603735.638107] sd 19:0:0:0: [sde] Very big device. Trying to use READ CAPACITY(16).
[603735.651983] sd 19:0:0:0: Attached scsi generic sg4 type 0
[603735.681584] Check proc_name[usb-storage].
[603735.724587] (value, da_event_enable):(1, 1)
[603735.729433]  sde: sde1 sde2                          ##~~!!  This is the line  !!~~##
[603735.733784] sd 19:0:0:0: [sde] Very big device. Trying to use READ CAPACITY(16).
[603735.742065] sd 19:0:0:0: [sde] Attached SCSI disk
[603735.746920] Check proc_name[usb-storage].
  • In the messages, find the device to mount; if there are two, it will be the second one. For the example above, it is sde2. See additional notes below for other situations.
  • Mount the disk: mount.exfat /dev/sde2 /mnt/ext-drive – replace with your device
  • View your files with ls -l /mnt/ext-drive.

And there you go, free ExFAT support on Qnap without the need to install a full Ubuntu VM or to purchase a problematic license. I ended up doing cp -a /mnt/ext-drive/my-ExFAT-files /share/Pictures/whatever to move the data without the network overhead.

As stated earlier, the software is deleted after a reboot. So, this code below creates a script to re-install it. Feel free to add to your /etc boot-up scripts as needed, but I generally install this manually since I don’t need ExFAT all the time.

# Go back to install dir
cd ${FUSE_DIR}

# Create the re-install script via cat command:
cat > install-exfat-fuse.sh << EOM
#!/bin/sh

# Convenience variable to help with install
FUSE_DIR=`pwd`

# Perform the actual install
cd /
tar -xvf \${FUSE_DIR}/fuse.tar.xz
tar -xvf \${FUSE_DIR}/utils.tar.xz

EOM

chmod 755 install-exfat-fuse.sh

Now, you can just run install-exfat-fuse.sh when you wish to re-install ExFAT.

Additional Notes

  • You can see my previous article for inspiration and historical decisions, such as Qnap lacking the ar command, some versions of Linux not having dpkg, etc.
  • Sometimes you see the message: fuse: warning: library too old, some operations may not not work – this is fine. All normal operations work.
  • When using mount to see where things are mounted, your ExFAT drive shows up as type fuseblk in the listing. This is normal. If it shows up as type vfat, you may have an issue.
  • You can also mount the drive as /share/raid-share-name so that you can read the ExFAT drive’s contents from the network. It wouldn’t be wise to copy the whole drive, as there is a great deal of network thrash, but is helpful in finding files and determining what you might want to copy when ssh’d into the NAS.
  • You don’t have to install this software into the root / folder, you can install anywhere. But, that tends to create PATH and LD library dependency issues.
  • The device ID may change after reboot or with adding/removing RAID disks. Thus, do not trust that is will always be the same if you try to create scripts. In the writing of this tutorial, my drive was both sde and sdk.
  • To mount a disk as read-only, add -o ro to the mount command, for example mount.exfat -o ro /dev/sde2 /mnt/ext-drive
  • If your external disk has more than one partition, such as sde: sde1 sde2 sde3 sde4, then sde1 is the GPI meta-partition. The others, sde2/sde3/sde4, are separate partitions and need individual mount commands. Also be aware that each partition might be another type, such as vfat, ntfs, or something else. Generally, each of the mount commands will fail if it cannot mount the disk. For example:
[/] # mount.exfat /dev/sde /mnt/ext-drive
FUSE exfat 1.3.0
ERROR: exFAT file system is not found.
[/] # mount.exfat /dev/sde1 /mnt/ext-drive
FUSE exfat 1.3.0
ERROR: exFAT file system is not found.
[/] # mount.exfat /dev/sde2 /mnt/ext-drive
FUSE exfat 1.3.0
[/] # ls -l /mnt/ext-drive
total 2560
-rwxrwxrwx 1 admin administrators 2383795 2020-03-13 20:21 sample-image.png*
  • I’ve never tried mkfs.exfat or fsck.exfat on the NAS – so give feedback if you’re brave.
  • What if I run it mount.exfat and see an error like -sh: /sbin/mount.exfat: No such file or directory? This is because you are using a 32-bit version of the library. Download an amd64 version instead.

I hope you enjoyed this tutorial about using FUSE and ExFAT on your Qnap NAS. Feel free to contact me with questions.

Masthead Credits

  • Sinchen.Lin – CC BY-SA 2.0 – https://www.flickr.com/photos/linsinchen/albums/72157629455464208/with/7079105773/
  • Martin @pokipsie Rechsteiner – CC BY-SA 2.0 – https://www.flickr.com/photos/martinrechsteiner/16989089969/
  • Andrew Currie – CC BY-SA 2.0 – https://www.flickr.com/photos/andrewcurrie/4542687657
  • Solomon203 – CC BY-SA 4.0 – https://commons.wikimedia.org/wiki/File:QNAP_TVS-873e_sample_20181201.jpg
  • Center Screenshot by the author – CC BY-SA 4.0
  • Remix of images by Oksana Ball – CC BY-SA 4.0

About The Author

This blog post was written by Jay Ball and published on Jay’s blog at veggiespam.com. Jay is an #infosec professional who does penetration testing, security threat modeling, security compliance, security architecture, and security whiskey in many of the skyscrapers throughout Manhattan and Jersey City. He participates in local infosec organizations such as OWASP, 2600, HackNYC, and more. You can reach Jay via DM on Twitter @veggiespam or via email.

Original post by veggiespam - check out veggiespam