How to mount a HFS partition in linux as Read/Write?

root's picture

Firstly install the needed software:
core:~# apt-get install hfsprogs

List the target disk:

core:~# fdisk -l /dev/uba

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

Disk /dev/uba: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x366ade79

   Device Boot      Start         End      Blocks   Id  System
/dev/uba1               1          26      204819+  ee  GPT
/dev/uba2   *          26       12139    97294336    7  HPFS/NTFS
/dev/uba3           12200       38897   214448008   af  HFS / HFS+

Mount the target partition:
core:~# mount -t hfsplus -o rw,force /dev/uba3 /mnt/mac/

if it was mounted automatically, umount and mount it back:
core:~# mount -o remount,rw,force /mnt/mac/

Test if you can write to it (we will just create an empty file with touch command):

core:~# df -h /mnt/mac/
Filesystem            Size  Used Avail Use% Mounted on
/dev/uba3             205G  113G   93G  55% /mnt/mac
core:~# touch /mnt/mac/testfile
core:~# ls -la /mnt/mac/testfile
-rw-r--r-- 1 root root 0 Nov 10 19:50 /mnt/mac/testfile

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.