Command line 101
Sure Julian (and any one else that needs to know)...
If you get as far as I got and need the command line to rescue your data, here's just enough information to get you going.
I'm not sure how much people might already know about the command line, so I'm going to write this like you've only first heard of it today, and hopefully I won't insult anyone's intelligence.
Boot from the Snow Leopard disc, and select your language. When the menu comes up at the top go to Utilities and choose Terminal. White little window will come up. Press the green button to make it as big as possible (if the commands we enter are long enough to reach the end of the line, it will get messy and hard to read).
The command prompt will look like this:
-bash-3.2#
(some background: you can skip this if you like)
bash is just the name of the "shell" program, which is basically the software that listens to the commands and then does something with them.
(The prompt is usually more useful than this, such as showing the directory we're in, but from the installation CD things are pretty bare bones)
Bash expects commands to be entered as such: the first word is the command, any words following it are parameters given to the command. If a word needs to have a space within it, that word needs quotation marks around it. Since the default name of the hard drive in Mac OS is Macintosh HD, we will be needing to quote a lot of parameters.
Edit: commands can be picky about letter case, spaces, slashes, and quotes, so be sure to enter things exactly the way I have written them.
Step 1: Identify what drives are available.
We're looking at Unix paths here, so forward slashes are used to separate directory(or "folder" if you prefer) names and file names.
We'll start with the
cd and
ls commands, which changes the current directory, and lists files and directories respectively. All drives that are avalable to Mac OS X are in the /Volumes directory. To go there and see what it has, type the following commands:
Code:
-bash-3.2# [B]cd /Volumes[/B]
-bash-3.2# [B]ls[/B]
Mac OS X Install DVD Macintosh HD My USB Drive
If you renamed your hard drive at any point, it will show up as whatever you changed the name to instead of "Macintosh HD". If you hook up a USB drive to copy your data to, it should also be listed. It's hard to say what its name will be, but I'll use "My USB Drive" for the sake of example.
If your hard drive isn't listed there, I'm afraid you might be out of luck.
Step 2: Make a directory on the USB drive to copy the files to
I'm going to start by making a variable
dest that contains the path of the copying destination so that we don't have to type it out multiple times. Then I'll make that directory using the
mkdir command. (you can skip the mkdir command if the directory already exists)
Code:
-bash-3.2# [B]dest="/Volumes/My USB Drive/beforeSL"[/B]
-bash-3.2# [B]mkdir "$dest"[/B]
Step 3: Copying
What you do here depends on how much of the drive contents you want to back up. If you want the entire drive, we can do it in one command (but make sure there's enough available space on the destination drive)
To copy everything in one shot:
Code:
-bash-3.2# [B]cp -Rvp "/Volumes/Macintosh HD" "$dest"[/B]
cp is the copy command, parameters that start with a - tell the command we want to set a few options, in thise case R, v, and p. R means recursively and you need this when copying directories. v means verbose: it will write out the filename of each file as you copy it. p preserves filesystem attributes like timestamps and permissions. You can omit the p if you don't care about that stuff. Then you give it the source to copy from and the destination to copy to.
That will probably take a while.
OR
If you only want to copy a few select things, you'll want to use the cd command to go further into the Macintosh HD directory, ls to find what you're looking for, and cp to copy it out. (You might also have to mkdir $dest/
subdirectory if you want to keep things organized on that end and copy things into there)
Here's some things that will be handy to know if you do this:
Code:
-To set the command prompt to show what directory you're in, type the command:
[B]PS1="\w: "[/B] [SIZE="1"](edit: that's a backslash, not a forward slash)[/SIZE]
-To go back a directory, use:
[B]cd ..[/B]
-If you type the first part of a filename you can hit the [B]tab[/B] key and
bash will try to finish it off for you. If there are multiple possibilities
it will only go so far, so hit tab again and it will show all the files that
match what you've typed so far.
-To see a list of files with details like size and last modified time, use
[B]ls -lh[/B]
File locations you should know about:
Your personal files will be in /Volumes/Macintosh HD/Users/
username (where
username is your actual username)
Your installed applications will be in /Volumes/Macintosh HD/Applications
Your many applications have extra resources stored in /Volumes/Macintosh HD/Library
To backup just these things you could run these commands:
(don't do this if you already copied everything as in the first part of step 3)
Code:
-bash-3.2# [B]PS1="\w: "[/B]
/Volumes: [B]cd "Macintosh HD"[/B]
/Volumes/Macintosh HD: [B]cp -Rvp Users "$dest"[/B]
/Volumes/Macintosh HD: [B]cp -Rvp Applications "$dest"[/B]
/Volumes/Macintosh HD: [B]cp -Rvp Library "$dest"[/B]
/Volumes/Macintosh HD: [B]cd "$dest"[/B] #just to check $dest
/Volumes/My USB Drive/beforeSL: [B]ls[/B] #making sure things are there
Applications Library Users
Step 4: Exit the terminal
just type
exit at the command prompt, and then quit the Terminal program from the Terminal menu at the top.
Step 5: Unmount and disconnect the USB drive
You should find yourself back at the installer. Go to the Utilities menu again, run Disk Utility, and it should list your drives. Select your USB drive in the left column (the indented one) and click the unmount button. It should disappear from the list. When that is done it is safe to disconnect that drive. I'd highly recommend hooking it up to another computer to make sure everything you copied is actually there.
Step 6: Repartition
Don't do this until you are absolutely satisfied that you've backed up everything you need, because this will wipe your drive clean.
In Disk Utility, select your Hard Drive in the left column (the non-indented one), and go to the partition tab on the right. Remove the partition that exists now. Then create a new one (make it as big as the whole disk unless you have some reason to use multiple partitions). Then click the Apply button. Quit Disk Utility.
Step 7: Install Snow Leopard
Go all the way back to the beginning of the install where it asks you your language. You should be able to do a clean install now. Try again if it doesn't work the first time.
Ok, hopefully that's enough information and wasn't too daunting.
Let me know if you have any questions, or trying using google to search for something like
bash copy files. You'll probably get a lot of linux related results but the information mostly still applies except for specific file locations like Users, Applications, Library, etc. (well not /etc. ...That's a unix joke. ...ahem, anyway)
Best of luck,
Dave