How to mount a HFS partition in Ubuntu as Read/Write? — Super User

Статья последний раз была обновлена 04.03.2023



I plugged in my external harddrive (which was formatted on my Mac into HFS+ journaled) to my Ubuntu desktop 9.04 64bit.  I am not able to get the drive to mount with write capability, how do I do that?  Right now all I’m getting is read access, I tried

sudo mount -t hfsplus /dev/sdf2 /media/"Portable HD"

but that still gave me only read access…  ideas??

        asked Dec 17 ’09 at 7:16
GiH1,52562749

up vote 53 down vote accepted

You need to turn off the journaling if you want to write to it from Ubuntu. Ubuntu only has support for writing to non-journaled HFS+ volumes.

On your Mac:

  • Open Disk Utility under Applications -> Utilities
  • Select the volume to disable journaling on.
  • Choose Disable Journaling from the File menu. (On later Mac OS versions you’ll have to hold down the option button when you click the File menu. Or if you like
    Apple

    +

    J

    )

Disabling journaling from HFS+ is still possible up to OS X Yosemite 10.10

        answered Dec 17 ’09 at 7:26
John T116k15223275
3                                                          
Do note that "Disabling journaling on your main OS X partition is not recommended however as journaling is an important feature of any filesystem that can prevent damage and data loss" (help.ubuntu.com/community/hfsplus)                     – Hay Nov 6 ’10 at 13:00
                                                                                                                    
@Hay you can re-enable journaling. All it does is help the system recover faster in such an event (ie. abnormal shutdown). Not the end of the world.                     – John T Nov 6 ’10 at 16:15
7                                                          
No, that’s not all journaling does.  It also helps prevent filesystem corruption, which could be serious enough to only be fixable with a reformat.                     – Wade Williams Apr 27 ’11 at 4:26
7                                                          
in macos 10.6.8, in step 3, open the file menu with "option+alt" pressed                     – commonpike Jun 10 ’12 at 17:29
                                                                                                                    
@JohnT Could you please provide a source for the fact that "Ubuntu only has support for writing to non-journaled HFS+ volumes" please? I’m doing some research on HFS+ and it would be very useful. Thank you.                     – kalaracey Jan 13 ’13 at 3:37

First, make sure that you have hfsprogs installed.  Example installation command:

sudo apt-get install hfsprogs

Next, mount or remount the HFS+ drive; commands need to be as follows:

sudo mount -t hfsplus -o force,rw /dev/sdx# /media/mntpoint

or

sudo mount -t hfsplus -o remount,force,rw /dev/sdx# /mount/point

Finally, if the drive was improperly unmounted or has otherwise become partially corrupted run fsck.hfsplus (provided here by Jayson) as such:

sudo fsck.hfsplus /dev/sdx#

        answered Dec 6 ’11 at 18:04
Digiground1,171253
3                                                          
Thank you very much for providing a Linux only solution!  ^_^                     – FCTW May 31 ’12 at 20:22
3                                                          
The command line is incorrect — that needs to be force,rw, not force rw. I submitted an edit for this, it needs to be peer-reviewed.                     – Blaisorblade Aug 28 ’12 at 16:31
12                                                          
I’m on Ubuntu 12.04, the remount command should be like this sudo mount -t hfsplus -o remount,force,rw /dev/sdx# /mount/point. Then must use root to read/write data.                     – Coc Sep 15 ’12 at 10:31
13                                                          
Why is this not marked as the answer?                     – Sh3ljohn Jun 8 ’13 at 9:15
4                                                          
@Digiground and @Coc both fail with mount: warning: /media/mount/point seems to be mounted read-only. on Ubuntu 13.04 with hfsprogs installed.                     – here Dec 24 ’13 at 4:56

You can enable writing to HFS+ in Linux even if you didn’t disable journaling. In addition to hfsplus which you already have, you need to have hfsprogs installed:

sudo apt-get install hfsprogs

Then, use the -o force option:

sudo mount -o force /dev/sdX /your/mount/point

If the drive has been mounted automatically (as it should be on a desktop system like Ubuntu), you can enable write with

sudo mount -o remount,rw,force /mount/point

or

sudo mount -o remount,rw,force /dev/sdx

/mount/point would usually be /media/Your_drive_label /dev/sdx is your HFS+ device

Use mount -l to find which device is already mounted on which mount point.

        answered Oct 20 ’11 at 21:07
mivk908613
1                                                          
from the answer of Digiground, do you not miss the rw part in the command?? I succeeded with his options.                     – meduz Jan 26 ’12 at 12:44
                                                                                                                    
@meduz: I did not need "rw" in Ubuntu 10.04. I seem to need it now in 12.04. So I have edited the reply to add it.                     – mivk Aug 14 ’12 at 6:48

Have you tried to match permissions?

By default, Mac OS X formats volumes in journaled HFS+ volumes. Journaling is a feature that improves data reliability, and unfortunately it makes HFS drives read-only in Linux.

To disable journaling, just boot into OS X and fire up Disk Utility. Click on your HFS partition, hold the Option key, and click File in the menu bar. A new option to Disable Journaling will come up in the menu. Click that, and reboot into Linux. You should have read and write access to your HFS partition—however, the permissions on your Mac user’s home folder will prevent you from reading or writing those files. we just need to change our UID in one OS so that it matches the UID in the other. Unless you have a reason for choosing otherwise, we’re going to change our Linux UID to match our OS X one, since it’s a bit easier. By default, the first user in OS X has a UID of 501, but you can double check this by going into System Preferences in OS X, right-clicking on your user, and hitting Advanced Options. If your User ID is something different from 501, replace 501 with your other UID in the terminal commands below.

Boot into Linux (we’re using Ubuntu in this example) and fire up the Terminal. First, we’re going to add a temporary user, since we don’t want to edit a user that we’re currently logged into. So, run the following commands in the Terminal, hitting Enter after each one:

sudo useradd -d /home/tempuser -m -s /bin/bash -G admin tempuser

sudo passwd tempuser

Type in a new password for the temporary user when prompted. Reboot and log in as tempuser. Then, open up the Terminal and type in the following commands, once again hitting enter after each one (and replacing yourusername with your Linux user’s username):

sudo usermod --uid 501 yourusername

sudo chown -R 501:yourusername /home/yourusername

This will change your Linux user’s UID to 501 and fix your home folder permissions so that you still own them. Now, you should be able to read and write to both your Mac and Linux user’s home folder, no matter what OS you’re logged into.

You may also want to fix your login screen, since by default Ubuntu won’t list users with a UID of less than 1000. To do this, just open a Terminal and run gksudo gedit /etc/login.defs and search for UID_MIN in the text file. Change that value from 1000 to 501, and when you reboot your user will be listed in the login screen.

http://lifehacker.com/5702815/the-complete-guide-to-sharing-your-data-across-multiple-operating-systems

        answered Jan 31 ’11 at 19:48
                                                                                                                    
great solution! you’ve just saved me a few hours 🙂 the only thing to add is delete the tempuser —> sudo userdel tempuser                     – Feida Kila Oct 31 ’11 at 23:12

In Mac OS X 10.4 and later, press Option to make Disable Journaling visible in the File menu.

        answered Mar 2 ’10 at 19:40
        josh

protected by studiohack Dec 6 ’11 at 18:19

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you’re looking for?                                   Browse other questions tagged ubuntu mount hfs read-write  or ask your own question.                             


http://superuser.com/questions/84446/how-to-mount-a-hfs-partition-in-ubuntu-as-read-write

Губарь Маргарита Александровна