OpenWrt Forum Archive

Topic: Mounting a USB drive formatted HFS+ (TP-Link TL-WR1043ND)

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm new to OpenWRT so please bear with me. I really hope I've done my research. I spent all last night learning how packages and init scripts work, how to check the system logs, etc. I've just run out of ideas as to why this isn't working.

So I have a USB enclosure that holds two 2TB drives. Both drives are formatted HFS+, as they were originally used on a Mac. I'd really like to keep them that way if at all possible. I noticed that HFS+ has good filesystem performance on this router, so I was optimistic (I mean, how else would you test it?). I hope to hook this up via the USB port on my TL-WR1043ND and share over Samba.

I downloaded all the packages I thought I'd need, got everything set up nicely but for some reason, the volumes just won't mount! I'll run through some of the boot process and some debugging I've done to figure out where the problem is. I've trimmed out parts of the log having to do with other stuff for readability.

---------------------------------------------------------------------------------------
ar71xx-ehci ar71xx-ehci: Atheros AR91xx built-in EHCI controller
kernel: ar71xx-ehci ar71xx-ehci: new USB bus registered, assigned bus number 1
kernel: ar71xx-ehci ar71xx-ehci: irq 3, io mem 0x1b000000
kernel: ar71xx-ehci ar71xx-ehci: USB 2.0 started, EHCI 1.00
kernel: usb usb1: configuration #1 chosen from 1 choice
kernel: hub 1-0:1.0: USB hub found
kernel: hub 1-0:1.0: 1 port detected

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
info kernel: Initializing USB Mass Storage driver...
info kernel: scsi0 : SCSI emulation for USB Mass Storage devices
info kernel: usbcore: registered new interface driver usb-storage
info kernel: USB Mass Storage support registered.
debug kernel: usb-storage: device found at 2
debug kernel: usb-storage: waiting for device to settle before scanning
info sysinit: WARNING: /lib/functions/fsck not found
notice kernel: scsi 0:0:0:0: Direct-Access     WDC WD20 EARS-00MVWB0     50.0 PQ: 0 ANSI: 4
notice kernel: scsi 0:0:0:1: Direct-Access     WDC WD20 EARS-00MVWB0     50.0 PQ: 0 ANSI: 4
debug kernel: usb-storage: device scan complete

notice kernel: sd 0:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
notice kernel: sd 0:0:0:1: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
notice kernel: sd 0:0:0:0: [sda] Write Protect is off
debug kernel: sd 0:0:0:0: [sda] Mode Sense: 11 00 00 00
err kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
notice kernel: sd 0:0:0:1: [sdb] Write Protect is off
debug kernel: sd 0:0:0:1: [sdb] Mode Sense: 11 00 00 00
err kernel: sd 0:0:0:1: [sdb] Assuming drive cache: write through
err kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
info kernel:  sda:
err kernel: sd 0:0:0:1: [sdb] Assuming drive cache: write through
info kernel:  sdb: sda1
warn kernel:  sdb1
err kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
notice kernel: sd 0:0:0:0: [sda] Attached SCSI disk
err kernel: sd 0:0:0:1: [sdb] Assuming drive cache: write through
notice kernel: sd 0:0:0:1: [sdb] Attached SCSI disk

info kernel: yaffs: dev is 8388609 name is "sda1"
info kernel: yaffs: passed flags ""
warn kernel: yaffs: Attempting MTD mount on 8.1, "sda1"
info kernel: yaffs: dev is 8388609 name is "sda1"
info kernel: yaffs: passed flags ""
warn kernel: yaffs: Attempting MTD mount on 8.1, "sda1"
notice fstab: mount: mounting /dev/sda1 on /mnt/sda1 failed: Invalid argument
info kernel: yaffs: dev is 8388625 name is "sdb1"
info kernel: yaffs: passed flags ""
warn kernel: yaffs: Attempting MTD mount on 8.17, "sdb1"
info kernel: yaffs: dev is 8388625 name is "sdb1"
info kernel: yaffs: passed flags ""
warn kernel: yaffs: Attempting MTD mount on 8.17, "sdb1"
notice fstab: mount: mounting /dev/sdb1 on /mnt/sdb1 failed: Invalid argument
---------------------------------------------------------------------------------------

So what I get out of this is the host controller is found and loaded, the port is detected, the drive controller is detected, the disks are detected (they are indeed western digitals as noted), but when it comes time for fstab to mount the drives, it chokes with "Invalid Argument". The fact that "yaffs" is reporting these messages confuses me a little. Isn't that a different file system from hfs+?

So my next step is since the router can see these drives, I'll mount them manually. Maybe fstab was doing something dumb like detecting the wrong file system. So I check with fdisk -l:

---------------------------------------------------------------------------------------
root@OpenWrt:~# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sda: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      243202  1953514583+  ee  EFI GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      243202  1953514583+  ee  EFI GPT
---------------------------------------------------------------------------------------

Yep, these are GUID partitioned, yeah, those are the right sizes and stuff. So…

root@OpenWrt:~# mount -t hfsplus  /dev/sda1 /mnt/sda1
mount: mounting /dev/sda1 on /mnt/sda1 failed: Invalid argument

Oh come on! Well, maybe the hfsplus component didn't load or something.

---------------------------------------------------------------------------------------
root@OpenWrt:~# insmod hfsplus
insmod: can't insert 'hfsplus': File exists
root@OpenWrt:~# rmmod hfsplus
root@OpenWrt:~# insmod hfsplus
---------------------------------------------------------------------------------------

So no errors there… I'm out of ideas as to what could be wrong. The error messages I'm getting aren't particularly helpful and I think I've googled the same 6 words in different orders a thousand times now. If anyone could offer some suggestions, I'd really appreciate it.

Some more details:
I'm working with OpenWRT Backfire 10.03.1-rc4, and given it all the packages I think I'd need to hook up a USB drive and share files. Here's a listing of all the relevant packages I've got installed:

---------------------------------------------------------------------------------------
block-hotplug
block-mount
fdisk
hotplug2
kmod-fs-hfs
kmod-fs-hfsplus
kmod-fs-msdos
kmod-fs-ntfs
kmod-fs-vfat
kmod-nls-base
kmod-nls-utf8
kmod-scsi-core
kmod-usb-core
kmod-usb-ohci
kmod-usb-storage
kmod-usb2
luci-app-samba
samba3
---------------------------------------------------------------------------------------

Just grabbed a bunch of file systems that I thought I'd want in the future and character support packages because I couldn't figure out which went with which.

You need to add GUID Partition Table support into the kernel.  It is not enabled by default.  Once you do that, you will be able to see all of your actual partitions.

Is there a kmod package or is it something I have to build myself? Googling "openwrt guid" reveals nothing I can make sense of.

You have to build by yourself.

I formatted a spare disk with HFS+ and an MBR partition table. Mounted right up. Great performance too, I was getting up to 8MB/sec over wireless. Plenty to stream 1080p video.

Looks like I'll be building my own images! I'm setting up a Debian VM to build in. I hope to make an image for Mac users to use for Media playback and Time Machine backups with minimal configuration. I'm sure I'll run into a lot more hurdles along the way.

Thanks for the help.

i'm pretty sure HFS+ write support is still experimental? You're probably better off backing up the data and reformatting with EXT3/4.

arokh wrote:

i'm pretty sure HFS+ write support is still experimental? You're probably better off backing up the data and reformatting with EXT3/4.

The whole purpose of this endeavor is to make an OpenWRT image that plays nicely with Mac OS X services and formatted drives. If write support is experimental, then I'll be a guinea pig. It's been alright so far on my MBR-partitioned test disk.

Alright, so I've got the build system up and running and I think I've got GUID partition support compiled in. This is a great setup, I'm really impressed!

One question. I couldn't find anywhere in that menu-driven config builder to select the partition support. Since I'm new to all this, I wasn't sure what to change. So what I did was I grabbed backfire, then opened package/target/linux/ar71xx/config-2.6.32 and added the line:

CONFIG_EFI_PARTITION=y

somewhere near the USB support flags.

While this seems to have done the trick, is there a cleaner way I'm supposed to do this?

As a Mac user myself I'd be very interested in getting a copy of that image. And as a "thank you" I'd be willing to host it in my website if you need somewhere for people to download it from instead of those dreadful download sites smile

Donkey Kong wrote:

One question. I couldn't find anywhere in that menu-driven config builder to select the partition support. Since I'm new to all this, I wasn't sure what to change. So what I did was I grabbed backfire, then opened package/target/linux/ar71xx/config-2.6.32 and added the line:

CONFIG_EFI_PARTITION=y

somewhere near the USB support flags.

While this seems to have done the trick, is there a cleaner way I'm supposed to do this?

Technically, you should be able to do "same" thing by running

make kernel_menuconfig

in build root. But I have never figured out how these things are preserved accross svn updates or "make *clean" actions.

risa2000 wrote:
Donkey Kong wrote:

One question. I couldn't find anywhere in that menu-driven config builder to select the partition support. Since I'm new to all this, I wasn't sure what to change. So what I did was I grabbed backfire, then opened package/target/linux/ar71xx/config-2.6.32 and added the line:

CONFIG_EFI_PARTITION=y

somewhere near the USB support flags.

While this seems to have done the trick, is there a cleaner way I'm supposed to do this?

Technically, you should be able to do "same" thing by running

make kernel_menuconfig

in build root. But I have never figured out how these things are preserved accross svn updates or "make *clean" actions.

Yeah, that's how I configured my image building other than the GUID partition support. I couldn't find the option in the menuconfig to change the flag, that's what I meant by "I couldn't find anywhere in that menu-driven config builder to select the partition support" wink

Deny wrote:

As a Mac user myself I'd be very interested in getting a copy of that image. And as a "thank you" I'd be willing to host it in my website if you need somewhere for people to download it from instead of those dreadful download sites smile

I gave up on this project for now or I'd give you a nice working image. The last step I got to was making an image with GUID support, getting HFS+ drives mounted, and getting netatalk setup and working to share the drives. I could connect to the router from my Mac using afp://192.168.1.1, punch in real credentials (not just guest!) and even play movie files off the connected GUID HFS+ formatted hard drives! I was really excited to get that far. But! Always but. There were a few dealbreakers I couldn't work around.

1.) The drives kept mounting as read-only because fsck.hfs isn't available for OpenWRT. I was in the process of making a package for that. I got the files from Apple and patches to make it work under Linux but I stopped work on that because there appeared to be an even bigger problem...

2.) The wireless connection was unstable as all hell. I'd get 700KB/s for a while streaming a movie file, then something would flicker out and the whole wireless network would go down. I could not manage to make a build of OpenWRT that would run reliably! I tried trunk, rc4, and backfire with backported fixes. None would sustain 6MB transfer rates or let me transfer files for more than a minute without crashing and burning. I tried compiling my own image without any of the disk mounting or AFP stuff and I got the same behavior copying files from a computer on the wired LAN. So it's not some weird interaction, something's just unstable with this wireless chipset.

The most stable firmware I've found is the rc4 premade image download, which lets me transfer sustained at 6.6MB/s and use MBR formatted disks. I went with that for a while but it was kind of unstable too. Booting me off the wireless network every few hours too.

So I shelved the project and went back to my old router for now. It's slow and there's no USB disk support but it's stable enough to run for years uninterrupted. I'll check back in a few months and give it another go with the next milestone release. I filed a ticket requesting GUID partition support get built into all images from now on. We'll see how that goes. If the change gets incorporated, you could recreate what I've done using the stock image downloads and installing packaged from LuCI. That would be the best.

If you want to sign up for the ticket tracker system and voice your support for GUID partition support built in by default, you can do that here:
https://dev.openwrt.org/ticket/8672

Don't spam duplicate tickets or anything that makes work for the maintainers, but post comments on that one.

Donkey Kong wrote:

... I couldn't find the option in the menuconfig to change the flag, that's what I meant by "I couldn't find anywhere in that menu-driven config builder to select the partition support" wink

Currently the config item exists in kernel_menuconfig both in Backfire (kernel 2.6.32) and trunk (kernel 2.6.39).

kernel_menuconfig selection path to the option:
File systems --> Partition types --> EFI GUID Partition support
(The 'Advanced partition selection' option needs to be enabled on the last config page so that full partition type list is visible.)

That generates the CONFIG_EFI_PARTITION=y item to the kernel config file.

Hi guys!

Is anybody has good results with open wrt and HFS+??? I want to do something like Donkey Kong and wonder why I can't do it...

Wait for answers!

Thanks.

The discussion might have continued from here.