Drive Cloning With CloneZilla

We’ve all had that moment in time when we realized we were out of space and needed a bigger drive. I don’ think this has ever been more true than the past 2-3 years as SSD performance has caused many of us to switch to smaller high performance drives. With the price of storage rapidly decreasing and larger SSDs becoming more affordable it’s become rather attractive to move to a larger driver, but not many of us want to go through the pain of reinstalling our OS from scratch. Older tools like Ghost and commercial solutions can have annoying licensing terms, funky quirks, or just aren’t really an accessible option. I’ve personally found great success in using clonezilla to clone hard drives and figured I would create a quick tutorial to illustrate just how easy it is to clone a driver with clonezilla.

 

Step 1: Gather The Prerequisites

To successfully clone your drive with Clonezilla you will need the following:

  • The clonezilla ISO from  http://clonezilla.org/downloads/download.php?branch=stable
    • choose the appropriate architecture (this will be AMD64 for most of you) and ISO as the file type
  • A USB drive 4GB should be sufficient
  • Pendrive Linux Universal Installer from http://pendrivelinux.com
  • A USB to SATA converter (something along these lines: http://www.amazon.com/Patuoxun-Converter-Adapter-Cable-Drive/dp/B008ASF5MC/ref=sr_1_4?s=electronics&ie=UTF8&qid=1430442966&sr=1-4&keywords=usb+to+sata)
    • Some newer devices use mSATA drives not regular SATA drives. Please double check this so that you can buy the appropriate drive and drive adapter for your device.

A larger hard drive than what is currently in your machine

Step 2: Create a Bootable USB

  • Insert your USB stick you will choose to use for clonezilla (please be aware that installing this will format the USB drive and will clear any information currently on it.
  • Open the Universal USB Installer you downloaded from pendrivelinux.com
  • Choose clonzilla in step one of the USB creator, browse to the ISO you downloaded for step 2, and select your flash drive for step 3, then press create

create usb

 

Once the live USB creation process has completed, you can unplug the USB drive from your computer and plug it into the machine you are going to be cloning.

Step 3: Boot Your PC From USB

Once the USB is plugged into the machine we will be cloning, you will want to also plug in your USB to SATA converter with your new hard drive attached. After this you can power on the machine (if the computer is currently running shut it down). Upon boot choose the boot menu, this will vary by manufacturer but is typically F11 or F12 on most devices. If this fails you can alternatively try ESC or DEL to boot into the BIOS and change the boot order to start from USB. If your machine boots properly from the live USB, you should see the following screen, if so, proceed to the next step.

czmain

Step 4: Proceed Through Clonezilla Menus & Start Clone

  • From the menu screen shown above, choose the Clonezilla Live options (this should be the first option).
  • After a black and white window of scrolling text goes by, you will be placed on a blue screen with a language selection box, choose your language
  • Next you will be prompted about keymap, choose the default option to not touch keymap

keymap

  • On the next screen choose start clonezilla

startcz

 

  • Choose device to device for cloning options

d2d

 

  • Choose beginner mode
  • Choose disk to local disk in the next option

d to ld

 

  • Choose your old hard drive as the source (this will typically be the smaller drive that’s larger than the flash drive you’re using)

source

 

  • Choose the destination (this should be the largest drive in the list)
  • Choose the skip checking/repairing option
  • Press Enter
  • When the warning message pops up, make sure it shows the larger drive you’re cloning to, press y followed by enter

warn

 

  • When you receive the second warning prompt press y and hit enter again
  • Next you’ll be asked if you want to clone the bootloader, press y and hit enter

clone bl

 

  • At this point partclone will run a few assessments and then begin cloning your drive. This will take some time depending on the speed of the drives and whether your using USB 2.0 or 3.0 with your USB to SATA adapter.

partclone

 

  • Once the drive cloning process is complete a few checks will be run and you will see the screen below. Press enter

done

 

  • Choose Poweroff and wait for your machine to turn off

poweroff

Step 5: Remove The Old Drive, Install the New Drive

  • Now that drive cloning has completed, you can safely remove the Clonezilla USB and the USB to SATA converter
  • Remove your old hard drive and replace it with the newly cloned drive
  • Power on and proceed to the next step

Step 6: Expand the Partition in Windows

Once your machine is powered on there is one final step we must take, which is to expand the partition. This will be done through the built in disk management tool in windows.

  • Press the windows key  and R to bring up the run box. Type diskmgmt.msc into the run box and press enter.
    • Alternatively you can type this into the search box on Windows 7 or on the start screen search in Windows 8/8.1
  • You should see your C drive followed by unallocated space

unallocated

  • Right click the C drive (portion in blue above) and choose extend volume, then click through the wizard with the defaults. Now you should see the C drive has been extended

finished

  • With that ladies and gents we are done!

 

Thank you for checking out this blog post, I will likely create a video to demonstrate this process in the near future. In the meantime please feel free to leave any questions or comments.

 

Useful Applications For IT Administration

Like everything else in the world of IT all admins will have their preferences and what works for some will not always work for others. I’ve played around with a number of different tools for various uses and have compiled a short list on both the Windows and Mac platforms that I’ve found to be helpful. I’ll list them below and provide a brief description of the tool and what I use it for. I’d also love to see what tools you’re using as well, feel free to comment below with your own helpful tools. This is in no way comprehensive, just at top 5 favorite tools

 

Windows IT Tools

1. mRemoteNG

mRemoteNG is a fantastic combination RDP/SSH client that allows you to RDP and SSH into multiple boxes using saved presets and tabs for each. A few gotchas with this application are that to add SSH entries, you will first need to save them in Putty, as the program retrieves the list of saved SSH servers from the registry keys. For RDP you have plenty of options to choose whether or not to forward the keyboard shortcuts and the clipboard to the remote machine. Additionally if you move around between multiple machines you can save you mRemoteNG configuration file to a file share or cloud service like OneDrive for Business.

http://www.mremoteng.org/

2. Putty/Puttygen/Pageant

By now this tool is sort of a default go to tool for most admins. Putty is well known for being a great SSH and telnet client, however it does have some other helpful features. Among these features if the ability to do port tunneling, allowing you to connect to a server over SSH and redirect a local port such as 9090 to the remote machine’s port 80. Puttygen is a tool used to generate SSH keypairs on Windows either from scratch or converting a Linux/Mac generated keypair into a .ppk private key for use with Pageant. Pageant is a tool that allows you to load one or more private SSH keys so that you can login to remote servers over SSH using private/public key pairs. One of the lesser discussed facts regarding Putty is that you can export a list of your saved servers and import it into another machine. This can be done by opening the registry editor and searching for the SimonTatham key or by going to HKCU>Software>SimonTatham and exporting this entire key. To add it to a new machine simply copy the registry file and double click to merge the key. I haven’t tested this on a system that already has existing entries saved in Putty so use with caution.

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

3. cPutty

If you’ve ever had the wonderful task of applying updates on a ton of Linux boxes, this process is enough to make you want to shoot yourself or create a cron job to update weekly and live with the consequences. A better solution is to download cPutty, which can be acquired from GitHub. This application when double clicked appears to do nothing, but it actuallly allows you to open multiple putty sessions and press ctrl+alt+insert to link your keyboard input to all open SSH windows so that you can type the same command simultaneously into all of them.

https://github.com/dprokscha/cputty

4. Exchange Reports

While the built in tools for Exchange message tracking work reasonably well, this application adds additional functionality allowing you to export csv files of the message tracking results. The application currently works with all modern releases of on prem Exchange and is supposed to support Office 365 as well.

https://exchangereports.codeplex.com/

5. Sublime Text

While I’ve been a long time user of Notepadd++ and still use it for comparing diffs, I have really come to enjoy using Sublime Text as my go to application for writing scripts (with the exception of Powershell in which case Powershell ISE is hard to beat). Sublime text has options to enable highlighting based on code type, which is akin to using vim. Also when creating a ( or { character, the trailing character is also created one character ahead of the cursor. This is fantastic for people like myself who have often been guilty of forgetting to close a ) or } especially in situations where these are nested. The Ruby setting for highlighting also works fantastically for writing Puppet manifests and has been a real favorite of mine. This is technically a paid application but does work uncrippled with occasional nag messages to purchase.

http://www.sublimetext.com/

Mac

1. Microsoft Remote Desktop

While there are a number of RDP clients for Mac (2 from Microsoft even!) the newer Microsoft RDP client available in the Apple app store is fantastic. While I generally prefer applications like RDC Manager and mRemoteNG on Windows, I’ve had no such luck finding a client of that nature for Mac. However the MS RDP client opens full screen, allows you to save presets and RDP into multiple boxes at once. You can also toggle between your Mac and the other boxes using ctrl + arrow key left/right. This functionality is simple and easy to use and offers substantial improvements of the RDP client included with the MS Office suite for Mac.

https://itunes.apple.com/us/app/microsoft-remote-desktop/id715768417?mt=12

 

2. Tmux

tmux is an excellent application for multiplexing the terminal. Much like the PC counterpart cPutty or the Linux Cluster SSH, you can simultaneously enter standard input into multiple terminal at once. This tool is incredibly useful in saving time when performing the same task across many remote servers.

http://tmux.sourceforge.net/

3. Sublime Text

Sublime text as described earlier is a fantastic text editor, especially for code and scripting. Some of the awesome features aside from code highlighting is that on the right hand side of the page there’s a full length preview of the document. This functionality works nicely with long scripts or lengthy configuration files. Just as for PC, this application is technically a paid application but it does work uncrippled with occasional nags to purchase

http://www.sublimetext.com/

4. iTerm

iTerm is what I refer to as terminal on steroids. This application builds on the basic functions of the built in terminal. Among its features are the ability to recall previous clipboard items, use multiple tabs, and the ability to support bookmarks and profiles. All of the features you always wanted and never had in terminal all pretty well covered in this application.

http://iterm.sourceforge.net/

5. Homebrew

Homebrew is an application for Mac that allows you to install packages from repositories using brew install. Many Linux applications traditionally not available on Mac are available using Homebrew. https://github.com/Homebrew/homebrew/tree/master/Library/Formula contains a list of a many of the applications that can be installed using brew.

http://brew.sh/

 

Well, that’s my short list, there are certainly many more applications. I’d love to hear what some of your favorites are. Particularly if you’ve found something better than MySQL workbench on Mac.