So my moms (1st gen, for which the warranty is expired) iMac has crashed yet again. This is the third major fault with the hardware in 4 years. Needless to say we won't be buying any Mac computers anytime soon. This time however we lucked out (unlike the first time where her HD crashed) as it appears to be the video adapter or display going out again (we just got that exact problem fixed ~1.5yr ago). So I decided to retrieve her files so when she gets a new computer we can safely copy them over.
As much as I'm really not a fan of Macs anymore, there is one really cool feature they offer. It's something called, "Target Disk Mode" (although I hear, unfortunately, it may be in the process of being phased out) which is a very helpful tool for system maintainers. When the firmware and hard drive are still functioning you can start up your Mac in a special 'Mode' that allows it to be viewable to another computer as just a plain 'ol external Firewire hard drive. What this means is you can, browse the contents of the drive, copy over files etc... in the event that the HD needs to be wiped and OS reinstalled. The 'host' computer needs to be something with a Firewire port and preferably Mac OS X or Linux operating system. It can be done using Windows, but out of the box Windows does not support reading or writing to the HFS+ filesystem (which Mac uses) so you won't be able to read the disk. You can buy software to do it, however if this is a one time thing, there's no sense in that. (If you don't have another working Mac or Linux installed, you can safely use Ubuntu Linux (http://www.ubuntu.com/). Ubuntu has a Windows installer which lets you install Ubuntu just as you would any other Windows application (it sets up dual booting so you can select Ubuntu Linux or Windows when the install is complete). Later on if you don't want it you can remove it via Windows normal Add/Remove Programs just like any other application) You also need a male-to-male Firewire 400 cable (these are unfortunately quite expensive for what they are). Here's the setup I was working with:
- Ubuntu 10.10 x64 (my 'host' Desktop computer w/ a Firewire 400 port)
- Mac OS X Leopard 10.5 (my moms old computer, this is a 1st gen 20" Intel based iMac)
- 6ft male-to-male Firewire 400 cable
First things first, I disconnected all devices from the iMac and left just the wireless mouse/keyboard. Turn on the iMac and immediately press and HOLD the 'T' key on the keyboard. You'll see a grey screen with a giant Firewire icon bouncing around. If you see that you're in "Target Disk Mode" the iMac is done. (If you don't, power it off, this time after you power it on wait a couple seconds for the startup 'chime' then press and hold T, that should do it)
Next I turned on my Linux desktop and plugged the Firewire cable into the iMac and then my Linux desktop box. Ubuntu mounted it as a normal external Firewire hard drive and opened Nautilus for me to browse. I immediately ran into some trouble accessing all of her directories. Even though the drive was mounted with 'read/write' options, which was confirmed with the 'mount' command:
/dev/sdd2 on /media/Macintosh HD type hfsplus (rw,nosuid,nodev,uhelper-udisks)
I could not access any of her folders. I could see and copy files from her root user directory stored in /Users/: /media/Macintosh HD/Users/Mom/ but all the subfolders; Desktop, Documents, Downloads, Pictures, Music, etc... all gave the same error (I found a lot of folks looking for help because of this error. All the solutions seemed a bit strange to me, hence this post):
command line error:
altf2o@ubuntu1010pd:/media/Macintosh HD/Users/Mom/$ cd Desktop/
bash: cd: Desktop/: Permission denied
The folder contents could not be displayed.
You do not have the permissions
necessary to view the contents of "Desktop".
It's because all the files were owned by the user/group with the ID: 501/501. Originally I thought to create a user/group with that uid/gid but there's actually a simpler solution: just use sudo or get a root shell with sudo su, copy them to a local folder, and change their permissions. I preferred getting a root shell so I could browse and make sure I got everything. So as my user (altf2o) on my Linux host computer I created a new folder to hold all her files:
altf2o@ubuntu1010pd:~$ mkdir MomsiMacBackup
altf2o@ubuntu1010pd:~$ sudo su
[sudo] password for altf2o: ***enter my pizz-ass-word***
Now go to our mounted Firewire drive and copy everything over:
root@ubuntu1010pd:/home/altf2o# cd /media/Macintosh HD/Users/Mom/
root@ubuntu1010pd:/media/Macintosh HD/Users/Mom/# cp -R * /home/altf2o/MomsiMacBackup
Once that completes we should have a copy of her ENTIRE directory (including sub directories) in /home/altf2o/MomsiMacBackup/ folder. Now all that's left is to change the permissions so my main user/group (altf2o:altf2o) owns all the files:
root@ubuntu1010pd:/media/Macintosh HD/Users/Mom/# cd /home/altf2o/MomsiMacBackup
root@ubuntu1010pd:/home/altf2o/MomsiMacBackup# chown -R altf2o:altf2o *
And that's it, we can verify with a simple: ls -l , command and it should show the 'user/group' as:
for the owner of all the files in all directories. Now, as usual, be sure to exit your root shell:
I was able to browse around and copy any other files from the file system that needed to be backed up. Keep in mind there may be some directories such as temporary files, internet caches, etc... that you don't need, you can simply browse around in your root shell and copy only those that you need. I used the 'cp -R *' because I figure just grab everything now, restore what I want later. There is an old common sense rule of thumb in computer repair: When in doubt, BACK UP EVERYTHING! It's far better to delete something the person doesn't need later on, than explain how the files they DO need are gone because you didn't think to back them up.
(NOTE: For safe keeping I also made a compressed archive of the folder and stored it on my more permanent external storage, just in case the DVD I burned has issues. The command I used to create the archive was (I prefer bzip2, but gzip will work fine):
altf2o@ubuntu1010pd:~$ tar cjfv MomsiMacBackup.tar.bz2 MomsiMacBackup/
Then just copy it to any media you like, DVD, Network File Share, Tape, etc... for safe keeping. I like adding the whole folder this way because when we go to uncompress the archive it will extract to the folder: MomsiMacBackup/ , which will be created if not present.)