At 16:01 -0700 23/11/03, James Bucanek wrote: I'm trying to find some definitive word about using fsck on a Journaled HFS+ file system. I'm technical editor for a book on OS X and I'd like to get to the bottom of this. I forwarded your questions to the guy who implemented journaling in HFS Plus and he just got back to me with a response... ---------------------------------------------------------------------- What I'm trying to find out is: When do journaling fixes get applied. HFS Plus will replay the journal on an HFS Plus file system at mount time if the last person to touch the file system was a journaling aware system. HFS Plus determines if the last person to touch the file system was journaling aware by looking at the lastMountedVersion field in the volume header. If it is set to 'HFSJ' then we'll replay the journal. Otherwise the journal is discarded because it means either the file system was modified by someone who did not know about journaling or it is clean. Jaguar 10.2.3 and above versions of fsck_hfs will not modify a journaling file system unless given the "-f" option. If you specify "-f" to fsck_hfs it will do its normal business (which as a result sets the lastMountedVersion to 'fsck' so the journal will be discarded at mount time). What exactly does 'fsck -f' do? Under what circumstances can the two conflict? If you have a dirty journaled volume (i.e. one that was hot-unplugged or from a system that lost power or panic'ed) and you were to run "fsck_hfs -f" on it, then fsck_hfs will try to do it job which will most likely fail. This will also cause the journal to get discarded and thus you're likely to get a corrupted disk. A journaled disk with a dirty journal is typically in a state that fsck_hfs can not fix. The best thing you can do is let journaling do its job if a volume is dirty. Just mount it and everything will be fine. Now, having said that there's still the potential that a volume can get corrupted due to bugs in HFS Plus. That is, a bug in HFS Plus (or elsewhere in the kernel) could cause a data structure to be written that is damaged -- journal won't protect against that. The journal just faithfully replays what it is asked to -- if there's something damaged in the data structures, the journal can't know that. So if you suspect that your disk has problems, it is best to unmount it cleanly and run "fsck_hfs -f -n" (or choose "Verify Disk" in Disk Utility) and see if there are any complaints. If there are problems then it is useful to run "fsck_hfs -f -y" or choose "Repair Disk" in Disk Utility to fix the problems. In these cases fsck_hfs can usually fix the problems. It's also a good idea to re-run "fsck_hfs -f -n" afterwards to verify that all the problems are fixed. ---------------------------------------------------------------------- S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Technical Support * Networking, Communications, Hardware _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Quinn