Uncategorized

Recovering your data from OS X

After many years of backing up my data in a somewhat paranoid fashion I have finally succumbed to a failed hard drive. 

My Macbook Pro (August 2013) died a month ago. I live in Argentina, and as I was going back to the UK in July I decided to wait until I had returned in order to take it to the Apple Store. Once there, the Apple Genius booted up my computer and it went straight to the login screen, much to my surprise. Unfortunately, I had forgotten my password ( 😦 ). The Apple technician logged into their diagnostic tools and checked everything out. ‘Great, all fine,’ he said. Happily, I went home and plugged my laptop into the power supply to charge. After about an hour, I turned it on. The grey Apple logo appeared along with a spinning gear and a grey progress bar. The bar very slowly inched up and on reaching the completion the computer turned itself off. Mysterious! I tried three more times to start the computer. Eventually, I logged on to Apple Support Chat and spoke to the very helpful Cynthia. She took me through several steps (that I had initially tried when I first had the problem) to try and solve my problem such as booting into Safe mode (shift while restarted), and resetting the PRAM (command + option + p + r while restarting). Even booting from the recovery partition and attempting to repair the disk failed.

At this point, she told me I should reformat the drive. I had all my work backed up but not my photos. (I always backup my important work via Google Drive, but I had not copied photos as, at that time, I was using the free quota). Also, electronics are incredibly expensive in Argentina, and although at home in the UK I have a 1 Tb Time Capsule, a 500 Gb Seagate drive and two 1 Tb My Book drives, I didn’t take them with me to BA. Not wanting to give up straight away, I did some more Googling.

The best option seemed to boot into ‘Single User Mode’ where a basic shell environment is available. To boot into the mode press command + s while restarting the computer. A command prompt will appear, and you can then check the directories available. My hard drive is still accessible but could not be mounted by Disk Utility from the recovery partition. Firstly I ran fsck to see if the drive could be repaired this time.

fsck -fy

fsck tried valiantly but could not repair the drive. At this point, I attempted to mount the main volume (as it was only available as a read-only volume).

mount -uw /

This command successfully mounted the drive. I had formatted my 500 Gb Seagate hard drive using my Macbook (which is backed up to the Time Capsule) using Mac OS Journaled. You can then use one of the mount scripts in /sbin/ to mount the drive. For example, there is mount_hfs for Mac Journaled filesystems and mount_msdos for MSDOS formatted systems. Before you plug in your USB drive, you can run this command:

ls /dev | grep disk

and then plug the drive in and run it again – several new disks should have appeared. You need to create a mount point for the disk, so I ran

mkdir /Volumes/usb

and then

/sbin/mount_hfs /dev/disk1s3 /Volumes/usb

it took a couple of trial and error attempts to find the correct disk point to mount (in my case disk1s3).

With the drive mounted, I moved to my user directory

cd /Users/username

and then ran rsync to copy the files to the external drive

rsync -av ./* /Volumes/usb/

The computer then spent a couple of hours copying all my data over to the external drive.

My Macbook Pro (August 2013) died a month ago. I live in Argentina and as I was coming back to the UK for July I decided to wait until I returned to take it to the Apple Store. The Apple Genius booted up my computer and it went straight to the login screen, much to my surprise, unfortunately I forgot my password so he logged into the diagnostic tools and check everything out. ‘Great, all fine’, he said. Happily I went home and plugged my laptop in to charge. After about an hour I turned it on. Grey apple logo, spinning gear and grey progress bar. It very slowly inched up this progress bar and on reaching the top the computer turned itself off. I tried three more times eventually I chatted to the very helpful Cynthia at the online Apple Chat Support site. She took me through several steps (that I had initially tried when I first had the problem) such as booting into Safe mode (shift while restarted) and resetting the PRAM (command + option + p + r while restarting) to no avail. Booting into the recovery partition and attempting to repair the disk failed. 

At this point she told me I should reformat the drive. I had all my work backed up but not my photos (I was backup all of my important work via Google Drive but not photos as I was using the free quota and had only recently paid to upgrade to 100 Gb so I hadn’t synced all my photos yet  – also my internet connection in Buenos Aires is very slow (my connection at work is even slower) so it takes an age – electronics are also incredibly expensive and while at home in the UK I have a 1 Tb Time Capsule, a 500 Gb Seagate drive and two 1 Tb My Book drives I didn’t take them with me to BA. Not wanting to give up straight away I did some more Googling. 

The best option seemed to boot into ‘Single User Mode’ where a basic shell environment is available.  To boot into ths mode press command + s while restarting the computer.  A command prompt will appear and you can then check the directories available. My hard drive is still accessible but could not be mounted by Disk Utility from the recovery partition. Firstly I ran fsck to see if the drive could be repaired this time. 

fsck -fy

fsck tried valiantly but could not repair the drive. At this point I attempted to mount the main volume (as it was only available as a read only volume). 

mount -uw /

which successfully mounted the drive. I had formatted my 500 Gb Seagate hard drive using my Macbook (which is backed up to the Time Capsule) using Mac OS Journaled.  You can then use one of the mount scripts in /sbin/ to mount the drive. For example there is mount_hfs for Mac Journaled filesystems and mount_msdos for MSDOS formatted systems. Before you plug in your USB drive you can run 

ls /dev | grep disk

and then plug the drive in and run it again – several new disks should have appeared. You need to create a mount point for the disk so I ran

mkdir /Volumes/usb

and then 

/sbin/mount_hfs /dev/disk1s3 /Volumes/usb

it took a couple of trial and error attempts to find the correct disk point to mount (in my case disk1s3). 

With the drive mounted I moved to my user directory 

cd /Users/username

and then ran rsync to copy the files to the external drive

rsync -av ./* /Volumes/usb/

The computer then spent a couple of hours copying all my data over to the external drive.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s