An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Topic Options
#19330 - 11/23/11 10:30 AM promising new HDD salvage technique discover today
Virtual1 Offline


Registered: 08/04/09
Loc: Iowa
I've seen maybe two dozen of these. Boots to gear or somewhere abouts there and hangs or shuts down. (this one was shutting down due to fsck fail safety) Try to boot off another hard drive and the boot volume won't mount. Run diskwarrior and it won't even scan due to a "hardware malfunction". OK, that's about it for options.

But I thought, hey, it boots a little, what can I do in single user mode? enough, it appears. attached another hard drive and booted into single user. mounted the internal drive read/write, used mount to manually attach the external drive, and was able to ditto the /Users folder to the other drive.

An interesting twist, this one wouldn't let me make a folder in /Volumes, or anywhere else for that matter, as a mount point for the second drive, but /home was there and available (and empty) so I used that as the mount point.
Unfortunately diskutil is not available in single user mode so I wasn't able to look at disk info on the bad drive. (is there a way to load diskarbitration framework by hand?) But at least I could "du -sh" to see how much data I was dealing with.
_________________________
I work for the Department of Redundancy Department

Top
#19331 - 11/23/11 12:43 PM Re: promising new HDD salvage technique discover today [Re: Virtual1]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
Originally Posted By: Virtual1
Unfortunately diskutil is not available in single user mode so I wasn't able to look at disk info on the bad drive. (is there a way to load diskarbitration framework by hand?)


download AppleJack and take a gander at its applejack.sh file

Top
#19332 - 11/23/11 12:54 PM Re: promising new HDD salvage technique discover today [Re: Hal Itosis]
Virtual1 Offline


Registered: 08/04/09
Loc: Iowa
well you don't see shell scripts that big very often, unless you're browsing my flash drive anyway wink

Quote:
[1] repair disks
[2] repair permissions
[3] cleanup cache files
[4] validate preference files
[5] clean up virtual memory

Not a very big list of tools? nothing I can't do with fsck and plutil. (why would you even need #5 while booted into SUM?)

nothing there for loading frameworks that I see...?
_________________________
I work for the Department of Redundancy Department

Top
#19333 - 11/23/11 01:14 PM Re: promising new HDD salvage technique discover today [Re: Virtual1]
artie505 Online


Registered: 08/04/09
I've never understood why [5] clean up virtual memory is included in Applejack's functionality.

Doesn't /var/vm get cleaned up automatically when you restart from SUM?
_________________________
The new Great Equalizer is the SEND button.

In Memory Of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire

Top
#19334 - 11/23/11 01:50 PM Re: promising new HDD salvage technique discover today [Re: artie505]
Virtual1 Offline


Registered: 08/04/09
Loc: Iowa
quite a lot gets cleared, on any boot, such as /tmp/

step 5 looks like a complete waste of time
_________________________
I work for the Department of Redundancy Department

Top
#19339 - 11/24/11 09:48 AM Re: promising new HDD salvage technique discover today [Re: Virtual1]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
Originally Posted By: Virtual1
nothing there for loading frameworks that I see...?

Then you didn't look hard enough...

...because i see over a dozen places where launchctl load is called.
[i.e., we don't load frameworks directly... rather, we ask launchd to run the plist that opens them.]

Pay close attention to the case statement...

case "$ANIMAL" in

...where 4 = tiger, 5 = leopard, 6 = snowy, and so on;
because each OS version has subtle differences.



EDIT: e.g., the essential bit for Snowy looks like this (starting at line 553):
Code:
for plist in com.apple.kuncd com.apple.KernelEventAgent \
	com.apple.distnoted com.apple.aslmanager com.apple.DirectoryServices \
	com.apple.DirectoryServicesLocal com.apple.coreservicesd \
	com.apple.diskmanagementd com.apple.securityd com.apple.diskarbitrationd \
	com.apple.fseventsd
do
	launchctl load /System/Library/LaunchDaemons/${plist}.plist > /dev/null 2>&1 &
	wait
done

...but there is much associated code which precedes and follow that excerpt.


Edited by Hal Itosis (11/24/11 10:03 AM)

Top
#19340 - 11/24/11 10:09 AM Re: promising new HDD salvage technique discover today [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
Originally Posted By: Virtual1
(why would you even need #5 while booted into SUM?)

Originally Posted By: artie505
I've never understood why [5] clean up virtual memory is included in Applejack's functionality.

Doesn't /var/vm get cleaned up automatically when you restart from SUM?

Nope... all swapfiles are still there (from the previous user's session), when we arrive in SU mode.

Not sure at which point the swapfiles get cleared... but i suppose if some Mac can't reach the login window, perhaps deleting /var/vm items might be either useful or desirable.

Top
#19341 - 11/24/11 10:17 AM Re: promising new HDD salvage technique discover today [Re: Virtual1]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
Originally Posted By: Virtual1
Quote:
[1] repair disks
[2] repair permissions
[3] cleanup cache files
[4] validate preference files
[5] clean up virtual memory

Not a very big list of tools? nothing I can't do with fsck and plutil.

My, quite the critic... aren't we? smile

[3] would require more than fsck and plutil ...including knowledge of where all caches are located. (e.g., don't forget the /var/folders/* hierarchy).

And we are currently discussing the complexities involved with doing [2].

There is an optional RAM test module (installed separately).

But those functions are a fairly basic set which users who aren't Unix gurus can use to do stuff by simply selecting a number. [and of course: the point of doing those in SU mode is that the user is presumably unable to login to the GUI for some reason.]

Perhaps you'd care to author the Lion version of AppleJack though. wink
[or suggest some feature(s) for the author to add at least.]


Edited by Hal Itosis (11/24/11 10:38 AM)

Top
#19342 - 11/24/11 10:37 AM Re: promising new HDD salvage technique discover today [Re: Hal Itosis]
Virtual1 Offline


Registered: 08/04/09
Loc: Iowa
Originally Posted By: Hal Itosis
My, quite the critic... aren't we? smile

[3] would require more than fsck and plutil (including knowledge of where all caches are located).

And we are currently discussing the complexities involved with doing [2].

There is an optional RAM test module (installed separately).

But those functions are a fairly basic set which users who aren't Unix gurus can use to do stuff by simply selecting a number. [and of course: the point of doing those in SU mode is that the user is presumably unable to login to the GUI for some reason.]

Perhaps you'd care to author the Lion version of AppleJack though. wink
[or suggest some feature(s) for the author to add at least.]


Yes I do seem to have missed the launchctl load commands, I was looking for a kext load. Lots of code to look through and I was short on time, ctrl-w was insufficient.

As for caches and permissions, it's been my experience that those are helpful only on extremely rare occasions. I may have had success with those two techniques on a total of two or three occasions each, in all my days.

It's also worth noting that a combo updater accomplishes almost exactly the same thing as a permissions repair, and can actually take less time to run. (it would not surprise me if it also cleared caches when it runs)
_________________________
I work for the Department of Redundancy Department

Top
#19343 - 11/24/11 10:46 AM Re: promising new HDD salvage technique discover today [Re: Virtual1]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
Originally Posted By: Virtual1
As for caches and permissions, it's been my experience that those are helpful only on extremely rare occasions. I may have had success with those two techniques on a total of two or three occasions each, in all my days.

The main purpose of AppleJack (as i recall) was to enable a user to EASILY (and properly and quickly) repair permissions when they could not login (for whatever reason), and were also unable to boot from a dvd (whether it wasn't handy or perhaps the optical drive was bummed out).

Okay?

[i've never suggested it was anything you needed... other than to learn how to code.]

As for the usefulness of cache cleaning, there are plenty of threads which attest to sluggish beach-balling Macs getting a speed boost after cleaning caches. [as a one-shot deal... not weekly as some users are wont to do.]


Originally Posted By: Virtual1
It's also worth noting that a combo updater accomplishes almost exactly the same thing as a permissions repair, and can actually take less time to run. (it would not surprise me if it also cleared caches when it runs)

If a user can't login to the GUI and doesn't have the dvd on the road with them... how do they do a combo update?



Edited by Hal Itosis (11/24/11 10:54 AM)

Top
#19344 - 11/24/11 10:49 AM Re: promising new HDD salvage technique discover today [Re: Hal Itosis]
Virtual1 Offline


Registered: 08/04/09
Loc: Iowa
Originally Posted By: Hal Itosis
If a user can't login to the GUI and doesn't have the dvd on the road with them... how do they do a combo update?


Yep that is a good use for it. Tho unless they've preinstalled it, they're going to require internet access and another computer anyway, so the combo updater is an equally available option.

And if you're going to practice being prepared, a bootable flash drive, or service partition on your internal drive, is a much smarter way to go.
_________________________
I work for the Department of Redundancy Department

Top
#19345 - 11/24/11 10:56 AM Re: promising new HDD salvage technique discover today [Re: Virtual1]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
Originally Posted By: Virtual1
Tho unless they've preinstalled it, they're going to require internet access and another computer anyway, so the combo updater is an equally available option.

Pre-installed. That's a given, yes.

Originally Posted By: Virtual1
And if you're going to practice being prepared, a bootable flash drive, or service partition on your internal drive, is a much smarter way to go.

Again, don't forget to carry that flash. AppleJack (and your partition suggestion) are self contained... though both need "preinstalling". wink



Top
#19346 - 11/24/11 11:24 AM Re: promising new HDD salvage technique discover today [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
Originally Posted By: Hal Itosis
Originally Posted By: Virtual1
(why would you even need #5 while booted into SUM?)

Originally Posted By: artie505
I've never understood why [5] clean up virtual memory is included in Applejack's functionality.

Doesn't /var/vm get cleaned up automatically when you restart from SUM?

Nope... all swapfiles are still there (from the previous user's session), when we arrive in SU mode.

Not sure at which point the swapfiles get cleared... but i suppose if some Mac can't reach the login window, perhaps deleting /var/vm items might be either useful or desirable.

You misread my post...

Quote:
... when you restart from SUM? (Emphasis added)


at which point swap files are cleared, but you may have a point about being unable to reach the login window.

(Anybody know at precisely which point in the boot process swap files are cleared?)
_________________________
The new Great Equalizer is the SEND button.

In Memory Of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire

Top

Moderator:  alternaut, dkmarsh, joemikeb