OpenFirmware filesystem operations
July 4, 2007 8:44 AM   Subscribe

So I nuked my G5 iMac pretty bad by means of a Stupid UNIX Trick in which I mv'd everything into /tmp, including the kernel. Now I'm in OpenFirmware, and am trying to figure out how I can move these needful things from /tmp back to / . I can get listings of all of my files, but cannot for the life of me figure out how to move them within the constraints of the OpenFirmware shell. Can this be done? Am I totally screwed?
posted by bokane to Computers & Internet (18 answers total) 3 users marked this as a favorite
 
I've done exactly this before. Everything seemed fine until I rebooted, at which point I was hosed. I think part of the problem is that you've moved the 'mv' command along with everything else. Can you move anything if you type /tmp/bin/mv FILENAME?

My recommendation -- do whatever you can to copy off important files. You may be able to do an Archive and Install, but this a very good time to make some backups if you can.
posted by JohnFredra at 8:59 AM on July 4, 2007


Are you able to boot from the recovery/install discs?
posted by Thorzdad at 9:00 AM on July 4, 2007


Response by poster: JohnFredra -- nope; OpenFirmware doesn't seem to be able to run the apps that are there. I was wondering if there was something analogous to mv built into OpenFirmware -- as is, everything, including the kernel I need to run mv, is in /tmp.

Thorzdad -- Nope. The CD/DVD drive works fine, but for whatever reason won't boot off the disks. Ordinarily I'd take the damn thing into the shop and get it fixed, but since I live in China, Apple support options are limited and expensive. (There is an Apple repair place in Beijing, but I'd rather it didn't come to that if at all possible.)
posted by bokane at 9:10 AM on July 4, 2007


Odd...
You are holding down the "C" key when you try to boot from the discs, right? (I know you probably are, but I just had to make absolutely sure. Sorry)

Thing is, if you can't boot from those discs, I don't think an archive & install is going to be possible, either.
posted by Thorzdad at 9:18 AM on July 4, 2007


Open Firmware isn't going to work. It only has rudimentary filesystem awareness. You can actually pass mac-boot (OF's boot command) a path to the kernel, so you could theoretically boot by passing /tmp/mach_kernel to it, but I suspect (not going to test it, sorry) that the kernel wouldn't like your new layout and wouldn't boot anyway.

What you need to do is boot off your install disks by holding C down at startup (or hold down the option key and choose the CD), and choose 'Terminal' from the 'Tools' menu of the installer. Then move everything back and pray. Keep in mind that your drive will be in /Volumes/{Your HD Name} not / since you booted off the CD.

Otherwise, you could re-install and use the Migration Assistant to get everything back into its proper location. Simply choose 'Archive and Install' as the type and then point Migration Assistant, when it comes up, at the /Previous Systems.localized/Previous System 1/tmp or whichever has your old files.
posted by boaz at 9:24 AM on July 4, 2007 [1 favorite]


got a friend with a mac?

start yours in firewire target mode, then connect it to theirs. you should be all set...
posted by dorian at 9:34 AM on July 4, 2007 [1 favorite]


Response by poster: Yup - holding down C at boot isn't doing it for system discs. Damned if I know why.

Ah well. Fortunately I've got my really vital stuff backed up, but wiping it all will be a major PITA.

The whole backstory here revolves around fun with Chinese filenames and wildcards. I booted into "single-user mode" (which I hadn't realized was root) to run fsck, noted that it was complaining about a couple of files with Chinese-language filenames that I'd stupidly stashed in / for reasons that have long-since escaped me. Under the command line, these files just displayed as ??????????.doc, and so I figured I'd move them and run fsck again, so -- and by now I'm sure you can see what is coming -- I typed "mv ?* tmp." Hilarity ensued.
posted by bokane at 9:36 AM on July 4, 2007 [1 favorite]


Response by poster: Dorian -- thanks. Will probably give that a shot if I can find some firewire cables.
posted by bokane at 9:45 AM on July 4, 2007


Boot up off another disk, and then just mv everything back.

Maybe your system disks are futzed for some reason? (You need to be using the OS X install disks, not the Software Restore disks.) I'm not sure the install disks have a terminal program you can use though. If you have a friend with OS X installed on an ipod or external HD, you could boot of that as well.
posted by chunking express at 10:02 AM on July 4, 2007


Response by poster: Have had no luck with the system disks, but upon further examination that's not surprising -- they're the disks for my Intel-based Macbook; the G5 system disks were lost for me by a moving company. I'm going to see if I can maybe do something through a Linux LiveCD, assuming it'll boot. Failing that, doing the Firewire thing seems like it might be my best bet.
posted by bokane at 10:12 AM on July 4, 2007


Current versions of Ubuntu boot into a live GUI from CD, and a Mac version is available.
posted by flabdablet at 10:41 AM on July 4, 2007 [1 favorite]


while recent linux kernels have had much better support for writing hfs+ (yes a recent ubuntu ppc livecd ought to be fine as flabdablet mentions) I think you may still need to disable journalling on the mac disk for any kind of reliable writing (or in fact any writing at all?) from linux.

however, the only way I know to disable the journal is from within osx (either from commandline using diskutil, or with the Disk Utilities app -- which would be available straight off when booting your non-existent g5 osx install cd). not sure if the linux hfsplus tools will let you do it from linux.
posted by dorian at 10:51 AM on July 4, 2007


Macs will refuse to boot from CDs if they have a firmware password set. Boot with the option key down. If you get a password dialog, you can enter it there and then boot from CD, or reset the password (which is depressingly easy).
posted by chairface at 10:57 AM on July 4, 2007


Definitely get another mac, and mount your computer as a hard drive (Hold T while starting it up, and hook it up to the other computer via firewire cable). You should be able to see everything at that point, and move things back to where they belong.
posted by jeffxl at 11:11 AM on July 4, 2007 [1 favorite]


You've got a MacBook also? Boot the iMac in Target mode (hold down the T key), 6-pin to 6-pin firewire cable to the macbook, mount the drive, move your stuff.

Are FireWire cables hard to get in China?
posted by ZakDaddy at 11:12 AM on July 4, 2007 [1 favorite]


Nthing Target disk mode. /Volumes/g5imac/ on the second, working Mac will be / on the G5 iMac. Fix, unmout, reboot.
posted by caek at 12:35 PM on July 4, 2007


Response by poster: Awesome. Thanks a lot, everybody! I'm not sure how easy or hard Firewire cables are to get here, but there's a computer mall near my office that's got all kinds of junk, so I'm sure there'll be something.
posted by bokane at 7:37 PM on July 4, 2007


I don't know if this will be a help, but I have had a few macs where I had to hold down the D key instead of the C key in order to boot from the CD. I believe the one I had to do it on was a iBook G4 or G5, which would be around the time that your iMac G5 was created as well.

I learned about target mode, and that looks like a good solution too.
posted by jamuraa at 5:07 AM on July 5, 2007


« Older Anglophiles in Baltimore: unite for Wimbledon!   |   Help me make the graph my boss imagined! Newer »
This thread is closed to new comments.