Every time i boot i get the message that my hfs+ disks where not cleanly unmounted and that i schould run fsck to correct it, and therefore they are only mounted read-only. But when i try tu run hpfsck i get this error: bash-2.05b# hpfsck /dev/hda2 *** Checking Volume Header: Volume was not cleanly unmounted Volume is inconsistent Reserved attribute in use: 2000 Invalid total blocks 182B32, expected 0 Done *** *** Checking Backup Volume Header: Unexpected Volume signature ' ' expected 'H+' hpfsck: hpfsck: This is not a HFS+ volume (Unknown error 4294967295) I have tried to run fsck from darwin but linux still thinks that they where not cleanly unmounted. Reproducible: Always Steps to Reproduce: 1.Install gentoo on a ppc with a hfs+ partition 2.Try to check the hfs+ partition for errors with hpfsck bash-2.05b$ emerge info Portage 2.0.50-r1 (default-ppc-2004.0, gcc-3.3.3, glibc-2.3.2-r9, 2.6.3-benh2) ================================================================= System uname: 2.6.3-benh2 ppc 750FX Gentoo Base System version 1.4.3.13 Autoconf: sys-devel/autoconf-2.58-r1 Automake: sys-devel/automake-1.7.8 ACCEPT_KEYWORDS="ppc ~ppc" AUTOCLEAN="yes" CFLAGS="-O3 -pipe -mcpu=750 -mtune=750 -mpowerpc-gfxopt -fsigned-char -falign-functions=4 -fomit-frame-pointer -fforce-addr -frerun-loop-opt -fprefetch-loop-arrays -funroll-loops" CHOST="powerpc-unknown-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/lib/pbbuttons /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-O3 -pipe -mcpu=750 -mtune=750 -mpowerpc-gfxopt -fsigned-char -falign-functions=4 -fomit-frame-pointer -fforce-addr -frerun-loop-opt -fprefetch-loop-arrays -funroll-loops" DISTDIR="/usr/portage/distfiles" FEATURES="ccache" GENTOO_MIRRORS="http://mirror.pudas.net/gentoo ftp://ftp.rhnet.is/pub/gentoo/ ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/ http://ftp.rhnet.is/pub/gentoo/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X aalib apm berkdb cdr dga directfb dvd esd fbcon foomaticdb gdbm gif gnome gnome-libs gphoto2 gpm gtk gtk2 imlib jpeg libwww linguas_sv mad mikmod mitshm mng mostif motif mozilla mpeg ncurses nls nptl offensive oggvorbis opengl oss pam pcmcia perl png pnp ppc python quicktime readline samba sdl slang ssl tcltk tcpd tiff truetype unicode usb video_cards_radeon xine xml2 xv xvid" bash-2.05b$ uname -a Linux Stardust 2.6.3-benh2 #2 Wed Mar 31 10:35:34 CEST 2004 ppc 750FX PowerBook4,3 GNU/Linux
there is a workaround ... use hpmount to mount the hfs+ partition. it will result in a simelar error-message BUT hpmount will reset the partition-dirty bit. hpumount immediatly. now you should be able to mount the partition r/w normally. however i have also seen warnings about using hpfsck somewhere else, you probably shouldnt use it. (and resort to the non existing fsck.hfsplus :=P)
We'd probably need an ebuild for: http://www.ardistech.com/hfsplus/hfsplus-20040216.tar.gz If I'm not mistaken this provides the much requested fsck.hfsplus
I have sold my iBook now so I can't test this. But thanks anyway!
Actually, the above is just the hfs+ driver included with the kernel. To make/fsck an hfsplus fs you need apple's tools. Get diskdev_cmds-208.11 from the link below: http://www.opensource.apple.com/darwinsource/10.2.5/ Now patch it with this patch: http://www.ardistech.com/hfsplus/diskdev_cmds.diff.gz And finally, build with: make -f makefile.lnx This should build mkfs and fsck for hfs/hfs+ I don't think later version have been ported, and I'm not sure if we can make an ebuild out of this.
Created attachment 42387 [details] Ebuild for mkfs.hfsplus, mkfs.hfs, fsck.hfsplus and fsck.hfs This ebuild will build the OSX 10.2.5 version of these utilities. Note that they do not seem to support journaled fs, if I have time, I'll look into porting the newer verisons, but there are heaps of patches to go through.
JoseJX, can you keep an eye on this package, so that it finds it's way into portage?
This will not be in the 2005.0 livecd.
Now that I'm back for a bit, I'll try and clean up the ebuild and look at porting one of the newer versions. I'm not sure if we want to put this one in portage, but if I don't have anything soon, I think I will. Should we rename the package something more obvious like hfsplus-tools or something like that?
Created attachment 52786 [details] hfsplus-tools based on the previous patchset This *may* work on little endian machines as well, but I'm not sure.
Created attachment 52787 [details] hfsplus-tools based on the latest from Apple I'm pretty sure this won't work yet on little endian machines and I've only tested some rudimentary things on linux at the moment, so don't use it if you value your data.
Created attachment 52788 [details] hfsplus-tools based on the latest from Apple - Stupid typo in last ebuild
It looks like I missed something in porting 277.2, I'll have to try reworking that again. 208.11 is probably okay for inclusion in portage, it just doesn't support some of the new HFS+ features (like case sensitivity).
just a comment: diskdev_cmds-332 is out...
People that have an iPOD want to use this under x86 as well. Does the patch address any endianness issues?
I've ported 332, the patch can be found at http://dev.gentoo.org/~josejx/diskdev_cmds-332.patch.bz2 Consider it a first draft, it's missing a little bit of error checking, but the important bits seem fine. I've tested it on ppc32, both fsck_hfs and newfs_hfs, on both actual disk partitions and disk images. I'd appreciate testing on x86 and ppc64, but it should be fine.
Created attachment 72749 [details] hfs-tools-332.ebuild some filenames for the src-files changed in the newest version ported by JoseJX, so the old ebuild didn't work.
I've updated the patch again to make it work on OSX again to address Kito's concerns with conditional patching. Please test again and let me know if this version works. If anyone knows of a simple way to test if a disk is mounted, that would be useful too. :) http://dev.gentoo.org/~josejx/diskdev_cmds-332-2.patch.bz2
doesn't compile on x86: gcc -g3 -Wall -I/var/tmp/portage/hfsplus-tools-332/work/diskdev_cmds-332/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -c -o newfs_hfs.o newfs_hfs.c makehfs.c: In function `WriteExtentsFile': makehfs.c:816: warning: implicit declaration of function `NXSwapBigShortToHost' makehfs.c:830: warning: implicit declaration of function `NXSwapBigLongToHost' makehfs.c: In function `WriteJournalInfo': makehfs.c:959: warning: implicit declaration of function `NXSwapBigLongLongToHost' gcc -g3 -Wall -I/var/tmp/portage/hfsplus-tools-332/work/diskdev_cmds-332/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -o newfs_hfs makehfs.o newfs_hfs.o -lssl makehfs.o: In function `WriteMDB': /var/tmp/portage/hfsplus-tools-332/work/diskdev_cmds-332/newfs_hfs.tproj/makehfs.c:467: undefined reference to `hfs_swap_HFSMasterDirectoryBlock' makehfs.o: In function `WriteVH': /var/tmp/portage/hfsplus-tools-332/work/diskdev_cmds-332/newfs_hfs.tproj/makehfs.c:612: undefined reference to `hfs_swap_HFSPlusVolumeHeader' makehfs.o: In function `WriteExtentsFile': /var/tmp/portage/hfsplus-tools-332/work/diskdev_cmds-332/newfs_hfs.tproj/makehfs.c:816: undefined reference to `NXSwapBigShortToHost' ... (hundreds of complaints about undefined references) ... /var/tmp/portage/hfsplus-tools-332/work/diskdev_cmds-332/newfs_hfs.tproj/makehfs.c:2007: undefined reference to `NXSwapBigShortToHost' collect2: ld returned 1 exit status make[1]: *** [newfs_hfs] Error 1 make[1]: Leaving directory `/var/tmp/portage/hfsplus-tools-332/work/diskdev_cmds-332/newfs_hfs.tproj'
while patching anyway, what about a linux style option for testing to make it (gentoo-linux-)init- compatible? ;) I get errors at every boot about wrong options and init interprets the exitcode as "Some Filesystem errors were corrected" or something like this
Here's a new patch against the latest version (332.11) which fixes the issues with x86: http://dev.gentoo.org/~josejx/diskdev_cmds-332.11.patch.bz2 Perhaps a simple wrapper script would be adequate to fix the fsck on boot issues? I'll see what I can come up with.
Created attachment 77185 [details] Ebuild for hfs-tools from Apple's Mac OS 10.4.4 hfs-tools-332.11.1.ebuild uses same patch as hfs-tools-332.11.ebuild,
hfs-tools-332.11.1 will build on x86 in addition to ppc.
Joe, would you mind to symlink diskdev_cmds-332.11.1.patch.bz2 to http://dev.gentoo.org/~josejx/diskdev_cmds-332.11.patch.bz2 ? (mind the extra ".1") Because the latest ebuild expects this location filename and thus doesn't currently build.
Even with 332.11.1 I can not repair my iPod. It claims that the partition is mounted, but it actually isn't. The iPod is connected by IEEE-1394 and managed by the sbp-2 driver. gimli ~ # fsck -f /dev/sda3 fsck 1.38 (30-Jun-2005) ** /dev/sda3 ** Checking HFS Plus volume. ** Checking Extents Overflow file. ** Checking Catalog file. Incorrect number of thread records (4, 3) ** Checking multi-linked files. ** Checking Catalog hierarchy. Invalid directory item count (It should be 10 instead of 11) ** Checking volume bitmap. Volume Bit Map needs minor repair ** Checking volume information. Invalid volume free block count (It should be 1429726 instead of 1429829) ** Cannot repair volume when it is mounted with write access. ** The volume My iPod could not be repaired.
Sorry, that was a stupid mistake in the patch, the mount issue should be fixed now, I updated the patch for 322.11. I'm cleaning up a few more things and hope to get this in portage soon.
(In reply to comment #25) > Sorry, that was a stupid mistake in the patch, the mount issue should be fixed > now, I updated the patch for 322.11. I'm cleaning up a few more things and > hope to get this in portage soon. You sure about that? I downloaded yesterday, and it won't repair *any* volume, whether it's unmounted, or mounted read-only, claiming it's mounted read-write. This is using 322.11.1 with your 322.11 patch applied against it. Also of issue: fsck.hfsplus doesn't accept the -a option, and so it doesn't work with Gentoo's quick check on system boot. I patched my local copy to interpret -a as -y, but I'm not sure that that's the safe/appropriate way to go (it also takes quite a while to run compared to fsck.ext3).
This bug looks somewhat old.. forgotten?
It is old, but my last activity on the bug was a month ago. :p I've just gotten my new powerbook, so I'll have a look at the hfs+ utils when I get back from LWE.
Created attachment 89543 [details] hfs-tools-332.14.ebuild This is an ebuild which uses the updated version of hfs-tools available on: http://www.ecl.udel.edu/~mcgee/diskdev_cmds/ Instead of ppc-sources the x86 sources are used. This is a port from the recently released x86 Darwin kernel OS X 10.4.[5-6] / Darwin 8.[5-6](x86). See here for further info about the different patches: http://gentoo-wiki.com/HOWTO_hfsplus
(In reply to comment #29) Cilly, just thought should comment on your ebuild. I posted those newer patches in my udel directory in which SRC_URL points. Josex is the developer of the patches, I simply updated the patches for the latest darwin kernel. I have emailed josex about them, and he repled would be adding them to his directory at gentoo at some point. Although I have no problem hosting the files for an ebuild; I would recommend that we keep the SRC_URI pointing to josex's directory, since he has indicated that he is still developing new patches. http://www.ecl.udel.edu/~mcgee/diskdev_cmds/_README http://dev.gentoo.org/~josejx/
(In reply to comment #26) > Also of issue: fsck.hfsplus doesn't accept the -a option, and so it doesn't > work with Gentoo's quick check on system boot. I patched my local copy to > interpret -a as -y, but I'm not sure that that's the safe/appropriate way to go > (it also takes quite a while to run compared to fsck.ext3). It should interpret -a as -p, like e2fsck does. mac os x runs fsck -p at boot time.
(In reply to comment #31) > > It should interpret -a as -p, like e2fsck does. mac os x runs fsck -p at boot > time. > Patched hfs-tools for boot check compatibility. http://www.ecl.udel.edu/~mcgee/diskdev_cmds/hfs-tools-332.14-r1.ebuild
All of the versions of fsck.hfsplus available here segfault when trying to check a partition on my iPod. The output does not get beyond ** /dev/sdb3 ** Checking HFS Plus volume. Segmentation fault even with -d flag. The partition was formatted originally with mkfs.hfsplus on this same Gentoo system (gentoo-sources 2.6.17-r7). The error occurs with the partition both mounted and unmounted. dmesg claims the filesystem was not cleanly unmounted, and Gentoo will only mount it read-only.
(In reply to comment #33) By the way (doh), this is an AMD64 system with CHOST="x86_64-pc-linux-gnu". Is there something special one needs to do to compile this on a 64 bit system?
I've added this to portage as diskdev_cmds (the Apple name for it). As for AMD64 support, I don't have a machine to test it on, you'll have to figure out why it's crashing (probably not 64 bit safe) and fix it. Sorry. :( If there are any issues with this, please file new bugs. Thanks!
Someone has found a way to get diskdev commands to work for AMD64 support haven't tested it though. http://ubuntuforums.org/showthread.php?p=4591297#post4591297
Thanks a lot for the suggestion to diskdev_cmds. Works fine here. I had a crash while running fsck.hfsplus (I am on amd64) on a hfsplus partition corrupted by running hfsck (I shouldn't have done that), but I have not been able to reproduce it. On my machine, I had a extended hfs volume (basically hfsplus) which was created on Mac OS X 10.5. Before I knew of diskdev_cmds, since I didn't have fsck.hfsplus, for a try, I used hfsck from sys-fs/hfsutils package in Gentoo. Ideally, it shouldn't have worked, but it corrupted this hfsplus disk eventhough I answered 'n' to the changes hfsck wanted to make. And thereafter, I emerged diskdev_cmds after coming across this thread and when I tried to use fsck.hfsplus on this corrupted volume, fsck segfaulted. I thought it was a (known) problem with diskdev_cmds on amd64, but later on, when I tried on usual hfsplus partitions (not corrupted by hfsck), it seemed to work fine. To reproduce it, I created a hfsplus partition and ran hfsck followed by fsck.hfsplus. Although hfsck still corrupts the disk, this time fsck.hfsplus seems to be able to clean it up! (dd if=/dev/zero of=abc.hfsplus bs=1024 count=50000 ; mkfs.hfsplus abc.hfsplus; hfsck abc.hfsplus; mount abc.hfsplus /mnt/ -o loop; fsck.hfsplus abc.hfsplus; mount abc.hfsplus /mnt/ -o loop;)