1

In ubuntu 15.10 I am trying to mount a hfs (max osx) partition on start up. In /etc/fstab I have added this line (notice the rw option):

/dev/sda2 /home/mac/mac-mount hfsplus rw,defaults 0 0

After a reboot the drive is mounted but I cannot create new content on the drive:

:~/mac-mount/Users/mac-mini/Documents$ touch test.txt
touch: cannot touch ‘test.txt’: Read-only file system

Running mount gives me the below for that particular partition:

/dev/sda2 on /home/mac/mac-mount type hfsplus (ro,relatime,umask=22,uid=0,gid=0,nls=utf8)

notice it says ro. Why is the hfs partition not mounted in rw given the /etc/fstab file above?

I have also tried to change the permissions for the mount point with:

~$ sudo chmod o+w mac-mount/
[sudo] password for mac:
chmod: changing permissions of ‘mac-mount/’: Read-only file system

But it gives the above error.

UPDATE: Based on the below answer I now have it working with write permissions after disabling Journaling. But for some reason it only works on some folders (I managed to create a test file in the Documents folder). As and example I cannot even cd to the Downloads folder on the hfs partition:

drwxr-xr-x 1  501 dialout    17 Dec 29 14:12 .
drwxr-xr-x 1 root      80     6 Oct  6 16:54 ..
drwx------ 1  501 dialout     3 Aug 10  2014 Applications
-rw-r--r-- 1  501 dialout    56 Dec 29 14:12 .bash_history
drwxr-xr-x 1  501 dialout     5 Dec 29 14:12 .bash_sessions
-r-------- 1  501 dialout     7 Feb 14  2015 .CFUserTextEncoding
drwx------ 1  501 dialout     4 Oct 13 18:30 Desktop
drwx---rwx 1  501 dialout    12 Dec 29 14:15 Documents
drwx------ 1  501 dialout     6 Dec 29 14:11 Downloads
-rw-r--r-- 1  501 dialout 14340 Dec 29 14:10 .DS_Store
drwx------ 1  501 dialout    52 Oct  6 17:13 Library
drwx------ 1  501 dialout     3 Aug 10  2014 Movies
drwx------ 1  501 dialout     5 Sep 13  2014 Music
drwxr-xr-x 1  501 dialout     3 Oct 28 11:34 .oracle_jre_usage
drwx------ 1  501 dialout     8 Apr 17  2015 Pictures
drwxr-xr-x 1  501 dialout     5 Aug 10  2014 Public
drwx------ 1  501 dialout     6 Dec 27 01:49 .Trash
:~/mac-mount/Users/mac-mini$ cd Downloads/
-bash: cd: Downloads/: Permission denied
:~/mac-mount/Users/mac-mini$ cd Documents/
:~/mac-mount/Users/mac-mini/Documents$

So why can I cd to Documents but not Downloads folder? I have not modified any permissions while using my mac-mini directly.

2

You can mount this filesystem in Ubuntu with read only access by default. If you need read/write access then you have to disable journaling with OS X before you can continue.

You can identify the volume with:

sudo diskutil list

and take note of the volume with type "Apple_HFS", usually named "Macintosh HD"

To disabile journaling in OSX type in a terminal:

sudo diskutil disableJournal volumeName

If you want access in rw mode for a non root user you need to change your Ubuntu User ID (UID) to match your UID under OSX.

Assuming you are logged in as a regular user who has sudo rights. Substitute the username for the Linux user you wish to enable HFS+ write access for and 501 for the relevant OSX UID. You have to modify also the linux UID for the user's home:

sudo usermod -u 501 <username>
sudo chown -R 501:<username> /home/<username> 

If there are in your system others files that belongs to the user you can change alla UIDs in one command. Take note of your UID (with id command), then:

find / -uid <useractualUID> -exec chown 501:<username> {} +

You may also want to fix your login screen, by default Ubuntu doesn't list users with a UID < 1000. Open a Terminal and run

sudo nano /etc/login.defs

Then search for UID_MIN. Change that value from 1000 to 501, when you reboot your user will be listed on the login screen.

  • That got me closer to a solution. But for some reason I cannot access some folders. Could that be related to the user UI? Not really sure where I should lookup/set that based on your answer. – u123 Dec 29 '15 at 13:28
  • I improved my answer, I hope this can help you – LilloX Dec 29 '15 at 13:54
  • I tried what you suggest above. I had to login as another user that then one I want to change the ID for since I kept getting: usermod: user mac is currently used by process 2246. After killing all the processes and logging in as the other other user and executing the usermod command it just hangs. So it seems that I cannot change the UID based on the above recipe. – u123 Dec 29 '15 at 15:37
  • did you try the link suggested by David Foerster ? At least can you access the files with root user? – LilloX Dec 29 '15 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.