Sunday, October 18, 2015

Mac/Windows/Linux HDD Dead? Use Linux or Windows!

As most of my readers may know, I am not the biggest fan of Apple or its products. However, that does not mean I rigidly hate Apple or that I do not work with their products from time-to-time. The following is one of my experiences and how it may helps others out there in similar circumstances.

I randomly got an invitation to visit my dad, which I willingly accepted. Upon my arrival one of my tasks was to see if I could find a way to fix his two iMacs. Apparently, they were on the fritz.

I took a look at both and tried what I could without ripping them open. Essentially, they both had faultering hard drives. The iMacs could turn on and get to the boot screen (apple logo), but then they would just hang. Unless we did a hard drive transplant, the iMacs would become all but useless, or so it seemed...

Different OS
In my searches I found two possible methods that could help keep the iMacs "alive" until they could get new hard drives. One involved using Linux, the other Windows. As for the Windows, I will explain more on that later since it is not a free OS.

As a side note, the steps I will be using will strictly involve a dying iMac. Yet, most of the steps described will be the same if trying to use a dying or dead Windows or Linux system. The only difference should be how to get to the respective boot managers of each OS. 

The Linux method involved downloading a Linux flavor ISO (I prefer Ubuntu or Mint, Mint of which I found to be the faster of the two through my tests), then making a Live CD or a bootable USB flash drive with the ISO. Sounded simple enough.

I first tried to see if I could partition any of the iMacs hard drives and install Linux on the partition. Of course, being that the hard drives were failing, this was not possible.

In short, it took me a bit of time and work, but I was able to find a way to make the iMacs run Linux without issue.

Note I: This should work for either a Mac or iMac.

Note II: If the (i)Mac you are attempting to use has full-disk encryption, this may cause problems for rEFInd, which we will need to use.

How To Install Demo Linux to USB/HDD/CD

The prerequisite for this method is to have at least two USB flash drives, or two external hard drives, or one of each (or just a blank CD and a USB flash drive or external hard drive). One needs to be at least 8GB, while the other should be much larger (20GB+) depending on how much stuff you want to save for later use.

So there is no confusion, an external SSD will work too, but I will be referring to an external HDD as that is what I used for this process.

Another major component is the use of a separate computer. Otherwise, there is no way to burn images to devices, unless your Mac still works and you are doing this for fun.

You will also need a program like Rufus to make a bootable USB flash drive or external drive from an ISO. There are plenty of other programs, but this is extremely small and fast (fastest according to its own description and my own experience). For this tutorial I will be using Rufus, if you are using a blank CD instead, use something like ImgBurn to the burn the ISO.

  1. Download a Linux ISO (e.g. Ubuntu, Mint, etc.).
  2. Insert a USB flash drive or external HDD to your computer.
  3. Download Rufus (portable is fine).
  4. Open Rufus.
  5. Change "Device" to the USB flash drive or external HDD inserted earlier.
  6. Click on the small CD/ROM icon.
  7. Find and select your Linux ISO.
  8. Press "Open". (Rufus will automatically select the necessary options according to the ISO.)
  9. Change the "New volume label" (optional).
  10. Press "Start".

Note: Rufus may ask if you wish to choose between "ISO" or "DD". It should recommend "ISO", if not, select it and continue. 

Once Rufus has finished, the first part is done.

Why Not Stop Here?
At this point, the Linux USB flash drive or an external HDD will just have a copy of Linux to test with, but not save to. Meaning, files can be saved but are not persistent on later boots (the files will disappear after shutdown).

In essence, one could use cloud services and save any files or items there. But the bigger problem is that programs (i.e. Skype, Chromium, etc.) need to be saved to the device being used. So every time a person booted into the Demo Linux, they would need to reinstall all of the applications they wish to use.

How to Install rEFInd
This step is important for later, and needs to be done. Unless there is an external USB CD/DVD drive at your disposal, I would suggest using a USB flash drive or an external HDD.

The following steps will use Rufus as well...

  1. Download the USB flash drive image of rEFInd.
  2. Insert a USB flash drive or external HDD to the computer.
  3. Open Rufus.
  4. Change "Device" to the USB flash drive or external HDD inserted earlier.
  5. Click on the small CD/ROM icon.
  6. Find and select your rEFInd image.
  7. Press "Open". (Rufus will automatically select the necessary options according to the image.)
  8. Press "Start".

Note: Rufus may ask if you wish to choose between "DD" or "ISO". It should recommend "DD", if not, select it and continue.

rEFInd originally started as rEFIt. It is a boot manager, and perfect for our purposes. I will explain why later.

How to Install Linux to USB/HDD
While a USB flash drive will work fine for this, I do recommend an external HDD since they are cheaper and carry much more storage space for equivalent prices.

One problem that may come about is if the USB flash drive or external HDD is using MBR instead of GPT. There are plenty of free programs that should be able to convert a drive from MBR to GPT, and Ubuntu and Mint both come with GParted, which should be able to do this. However, I received an error when attempting to convert from MBR to GPT. As an alternative, I used Windows' DiskPart.

If Windows is available to you, insert your USB flash drive or external HDD first [important!]. Open up a Command Prompt (WinKey + R, then type "cmd", push ENTER key), then type "diskpart" > "list disk" > "select disk #" > "clean" > "convert gpt". After each quoted term push enter. The disk list should show you the available devices and their corresponding sizes. This will help for which number to type in place of "#".

There should be no problems, and if there are, then you may have a faulty device. (Worst case scenario, download MiniTool Partition Wizard Free Edition and try formatting the device to NTFS or FAT32 to see if it becomes operational.) If successful, the drive should be clean. DO NOT FORMAT the drive if asked by Windows, Demo Linux will do that for us later on.

  1. Ensure the (i)Mac is turned off.
  2. Insert the blank USB flash drive or external HDD into the (i)Mac.
  3. Insert the Linux USB flash drive or external HDD into the (i)Mac.
  4. Turn on the (i)Mac.
  5. Hold the ALT/OPTION key as soon as the computer dings.
  6. Let go of the ALT/OPTION key once the boot manager screen appears.
  7. Select "EFI Boot", right of the (i)Mac HDD if nothing else is plugged in.
  8. A screen with options for Linux will appear. Choose "Try Ubuntu without Install", or the respective option if using a different Linux flavor.
  9. Once Linux boots, on a flavor like Ubuntu, there should be an icon on the desktop that states "Install Ubuntu...". Double-click on it.
  10. The usual options of selecting a language, connecting to a network, etc. should occur. Pick the options that best suit your preference.* (Stop when you reach the "Installation type" page...)
  11. At the "Installation type" page choose "Something else".
  12. The next page will show a list of connected devices and their sizes. Double-click the check box for your USB flash drive or external HDD.** A small window will appear with options for partitioning the USB flash drive or external HDD.
  13. Change "Type for the new partition:" to "Logical".
  14. Change "Use as:" to "Ext4 journaling file system" if it is not already selected by default.
  15. For "Mount point:", place just a "/", and nothing else.
  16. Click "Install Now".

*If you want the fastest install possible, do not connect to a network. Connecting to a network allows Linux to download items through the install process. This can be done after the install, as Linux should prompt you when it needs additional packages.

**To discern which device is yours, check the size. It should also be sda#; # being the highest of the ones available is the safest bet, but not always correct depending on how many external storage devices are connected.

Note I: This can be done with a computer other than a (i)Mac. The steps to access the bootable media will be different, but all other steps will remain the same.

Note II: For step 13 "Primary" always gave me an error. I was only able to change it to "Primary" after first installing through "Logical", then going back through the process and choosing "Primary" and reinstalling. Making this change seems to add no benefit and is thus unnecessary.

Linux should now be installed on a USB flash drive or an external HDD.

The Reason For rEFInd
The reason we need to use rEFInd instead of the Mac boot manager is because the Mac boot manager is unable to see any drive with Linux already installed. It will recognize that the drive is available, but not that it should be bootable.

The same thing happens with Windows, however, it does not even recognize that the drive exists.

How To Boot Into Linux
This will show you how to boot into Linux and use it as a daily driver.

  1. Ensure the (i)Mac is turned off.
  2. Insert the CD/USB/HDD with the installed Linux OS into the (i)Mac.
  3. Insert the USB/HDD with rEFInd into the (i)Mac.
  4. Turn on the (i)Mac.
  5. Hold the ALT/OPTION key as soon as the computer dings.
  6. Let go of the ALT/OPTION key once the boot manager screen appears.
  7. Select "EFI Boot", right of the (i)Mac HDD if nothing else is plugged in.
  8. rEFInd will start. The far right option will show a Linux flavor icon with a smaller external HDD icon inside it. Click it. (Other options shown should have different smaller icons displayed, like an internal HDD.)

This will start Linux and anything downloaded or saved will persist on future startups. The only problem some might find is that the boot process can be long and tedious if having to constantly reboot for whatever reason.

Windows, Why Not?
If I had been given the choice between Linux or Windows, I would have installed a fresh copy of Windows 7. Unfortunately, iMacs from 2008 or before do not recognize Windows To Go drives. I believe one iMac I was working with is from 2008, and the other from a couple years before. Because of this, I could not use the Windows route as a possible solution for my situation. However, others can...

How To Install Windows 7/8/10
The prerequisites for using making a Windows To Go drive is to have a USB flash drive or an external hard drive with ample amount of space (8GB or more suggested).

An external HDD is the way to go here. Never mind that purchasing an external HDD can gain you massive amounts of storage space inexpensively. The issue here is that there are certified Windows To Go USB flash drives that make this process painless. However, a "normal" USB flash drive can take forever to install Windows on. An external HDD does not have this problem.

The other prerequisite is using WinToUSB. Microsoft has its own proprietary software to perform a Window To Go install. But there are two downsides to Microsoft's software: 1) The software is only available on Windows 8 or higher, and will also not allow a Windows 7 install. 2) WinToUSB is said to be faster in terms of the install procedure.

  1. Download a Windows ISO from here.
  2. Download the free version of WinToUSB.
  3. Open WinToUSB.
  4. Click the small folder icon on the upper-right corner.
  5. Find and select your Windows ISO.
  6. Click "Open".
  7. Highlight the Windows version (that should now appear) by clicking it.
  8. Click "Next".
  9. Click the drop-down arrow in the upper-right corner.
  10. Select the USB flash drive or external HDD to be used.*
  11. In the next window there will be radio buttons to choose the system and boot partition. There should only be one option for each. Select both the radio buttons.
  12. Select "Legacy" for an external HDD, and "VHD" for a USB flash drive. (Either should be the defaulted option depending on the storage device.)
  13. Click "Next".

*If you chose a USB flash drive, it will ask if using a non-certified drive is desired. If so, click "OK". If not, click "Cancel". "OK" will format the drive and then bring up the next page.

The process will proceed showing a percentage until 100% is reached. Once done, the USB flash drive or external HDD will have Windows installed and ready for use.

First Time Windows Use
Before the Windows To Go drive is completely ready, you will need to boot it up. The process is just like installing any Windows OS. It will run through the choices and options and then begin setting up.

I had an interesting problem where (twice) the Windows setup would hang when finalizing the setup. What seemed to make it work was waiting about 15-20 minutes, just to be sure that everything was finalized, then rebooting the system. On reboot, Windows would boot up and work like a charm.

Finalizing Thoughts
This should work on other systems than an iMac, I just happened to go through it because of an iMac. Of course the steps may vary slightly, but not too much as to be difficult in performing.

Linux works quite well on the iMac. I found Mint a bit faster in reacting than Ubuntu, but not enough to matter greatly. I also found the Windows To Go drive (with Windows 7) a bit slow to startup on a MacBook Pro. However, once booted, it seemed to operate decently.

This is also a great way to bring an entire OS with you wherever you go. The benefits of this are portability and the ability to use programs others may not have available or be able to afford. In either case, at the very least, it is a great way to have a backup system waiting and ready to go.

Furthermore, if a multi-boot situation is out of the question, this may be of help. I have done some dual-boots in my time but stopped once a debilitating issue prevented me from getting into either OS. I now prefer virtualization, but that can be costly in terms of RAM usage.

No comments:

Post a Comment