First of all to have your hfsplus drive mounted, make a directory that will hold the mounted disk.
Code:
sudo mkdir /mnt/Shared_Disk
Now to temporarily mount it use this command:
Code:
sudo mount /dev/sda2 -t hfsplus -o rw /mnt/Shared_Disk
Code:
df -h
Code:
/dev/sda3 17G 12G 4.3G 73% / /dev/sda2 43G 29G 15G 68% /mnt/OSX /dev/sda4 15G 2.9G 12G 20% /mnt/Shared_Disk
Now, I must point out that Linux at this time is only able to mount Journaled HFSplus filesystems as read-only. Journaling helps the filesystem preserve its data - especially useful for power outages. Journaling got added to HFSplus when OSX came out.
If you want to be able to read and write from and HFSplus drive, be sure journaling is off. To see if your disk/partition is head to: System > Administration > System Log and click on syslog. Now, punch ctrl+f and type in "mount". If the above partition that we mounted is journaled, there will be a warning here. To turn off journaling, restart with the OSX install CD, select Disk Utility from the drop down menu, click the drive you want to have journaling shutoff of and use the button Journaling disable.
To have the HFSplus drive/partition mounted everytime you boot, the fstab file must be changed:
Code:
sudo gedit /etc/fstab
Code:
/dev/sda4 /mnt/Shared_Disk hfsplus rw,exec,auto,users 0 0
The Linux Kernel is pretty picky about it's HFSplus drives, but it's a good thing. If it ever occurs where your system is locked up and you have to force reboot, then your HFSplus disk will not be cleanly unmounted. If you look into your syslog and see (once more ctrl-F, and use "mount" filter):
Code:
hfs: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. mounting read-only
Code:
sudo bash cd /usr/src mkdir hfsplus_support wget http://darwinsource.opendarwin.org/tarballs/apsl/diskdev_cmds-332.14.tar.gz wget http://www.ecl.udel.edu/~mcgee/diskdev_cmds/diskdev_cmds-332.14.patch.bz2 tar zxf diskdev_cmds-332.14.tar.gz bunzip2 -c diskdev_cmds-332.14.patch.bz2 | patch -p0 cd diskdev_cmds-332.14 make -f Makefile.lnx cp fsck_hfs.tproj/fsck_hfs /sbin/fsck.hfsplus cd /sbin ln -s fsck.hfsplus fsck.hfs
Type fsck.hfsplus to see the list of option types - there is no man page. You can delete the downloaded files and unstuffed folders if you wish.
Now to make the partition/drive read-write enabled, the filesystem needs to be checked:
Code:
fsck.hfsplus -r /dev/sda4
Sources:
original Gentoo piece:http://gentoo-wiki.com/HOWTO_hfsplus
Debian derived piece:http://www.debian-administration.org.../lee/weblog/21
HowTo check and repair HFSplus in Linux
ReplyDeletegreat how-to for ubuntu. i guess no one needs fsck.hfsplus. all documentation are years old. not to mention open darwin is dead. however for the time being, i found the zipped source here
this does NOT work for amd64 or 64 bit versions for that matter.
Code:
ubuntu:~$ fsck.hfsplus -r /dev/hda1
** /dev/hda1
** Checking HFS Plus volume.
Segmentation fault (core dumped)
does anyone know how to compile this for 64-bit systems? granted no one will ever see this post, but if so, I'm dying to have fsck for hfsplus. or a workaround for the error:
HTML Code:
hfs: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. mounting read-only.
best,
Wes
If you're on Hardy Heron you can:
ReplyDeleteCode:
sudo aptitude install hfsprogs
Then:
Code:
sudo fsck.hfs /dev/sdb1
Replace sdb1 with your partition.