Sunday, January 28, 2018

How to clone your hard drive using free and simple open-source tools (w/any OS on your cloned drive!)


Subscribe by Email!
By Gabriel Staples
Written: 28 Jan. 2018
Last Updated: 28 Jan. 2018

Last Article:
This Article:
I just upgrade my hard drive to an SSD (Solid State Drive). Now my computer runs soooo much faster! It's usable again! No matter what operating system you have, the following instructions will work, since we will simply be using free and open source, and also no-cost, tools to copy your drive data, byte by byte, from one drive to another. In other words, the copy technique doesn't even read files, as it doesn't know what files are, so it doesn't care what file structure or format you have. It just reads bytes. I'm pretty excited that such great free tools exist. No need to buy Acronis, just do this.

How to clone your hard drive:

1. Buy an external hard drive USB enclosure. Ex: Sabrent Ultra Slim USB 3.0 to 2.5-Inch SATA External Aluminum Hard Drive Enclosure [Black] (EC-UK30) ($8.99).

2. Buy a nice new SSD. Ex: Samsung 860 EVO 1TB 2.5 Inch SATA III Internal SSD. Place the 860 EVO into the enclosure and plug it in.

3. Make a bootable USB flash drive containing Linux Ubuntu 16.04, or whatever the latest LTS (Long-Term Support) version is at the time.



4. Turn off your computer and boot onto the Ubuntu 16.04 bootable flash drive, connect to the internet, and install GNU ddrescue using the following commands:
sudo add-apt-repository universe
sudo apt update
sudo apt install gddrescue

5. Open the "gparted" partition editor to look at your original drive and shrink any partitions if necessary. Make note of the drive name of both the old and new drive. Ex: they might be named /dev/sda and /dev/sdbDON'T MESS THIS UP OR YOU'LL WIPE ALL YOUR DATA IN THE NEXT STEPS. 

6. Make the copy using ddrescue from the command line:
WARNING: DON'T GET THIS BACKWARDS OR YOU'LL WIPE ALL YOUR DATA OFF THE ORIGINAL DRIVE!
Format: ddrescue -f -n FROM_DRIVE TO_DRIVE dd_rescue.log
where FROM_DRIVE and TO_DRIVE are the /dev names from above.
Ex: "ddrescue -f -n /dev/sda /dev/sdb dd_rescue.log"
This copies from drive sda to drive sdb while saving a mapfile/logfile in dd_rescue.log in your current directory you are in when running this command.
For details on what the -f and -n mean and how the command works, read the manual here or via the man pages with the `man ddrescue` command.
Next do "ddrescue -d -f -r3 /dev/sda /dev/sdb dd_rescue.log", again, with the proper /dev names from above.
This uses the mapfile/logfile to now make 3 attempts (-r3) to copy any bad sectors that were previously  noted as errors---in case any bad sectors exist.

ADVERTISEMENT:
7. (Optional): after cloning is complete, open up gparted again and expand ("grow") your partition to fill the rest of the disk, except for a recommended 10% (or more if you like) which you will leave un-partitioned for the SSD to designate automatically as space reserved for "over-provisioning". This extra 10% space will be used by the SSD automatically to make data transfer more efficient and to reduce "write amplification."

Q: Is setting up over-provisioning really as simple as leaving unpartitioned space on your hard drive?
A: Yes, Wikipedia states this about over-provisioning: "Furthermore, if any SSD is set up with an overall partitioning layout smaller than 100% of the available space, that unpartitioned space will be automatically used by the SSD as over-provisioning as well." Seagate confirms this claim in its very informative article titled "SSD Over-Provisioning And Its Benefits," when it says: "Some SSD manufacturers provide software tools to allow for over-provisioning of drives by the user. Actually, even without special software, any user can set aside a portion of the SSD when first setting it up in the system by creating a partition that does not use the drive’s full capacity. This unclaimed space will automatically be used by the controller as dynamic over-provisioning."

8. DONE! THAT’S IT! The disk is now completely cloned. Take the computer apart and put the new drive in. It will boot right up as if nothing changed!

(Optionally) save the old hard drive in an anti-static bag in a safe place for a month or two to ensure you don't need to recover anything from it in the near future. Once you're sure your new drive is up-and-running without any issues, slap your old hard drive into your USB enclosure you bought above and use it permanently as an external backup drive!
 - In this case, I recommend repartitioning it with gparted from your bootable Ubuntu USB flash drive you created above to quickly delete the old hard drive's files and get it ready-to-go.


How long does the cloning take?

For a 750GB drive to a 1TB drive, for example, this whole process takes 5~7 hrs using a USB 2.0 HDD enclosure, or 2~3 hrs using a USB 3.0 HDD enclosure.


References:


END

Keywords: hard drive copy, copy hdd to ssd, copy hard drive, back up hard drive, clone hard drive, clone ssd, clone hdd, copy ssd, copy hdd, copy partition, make disk backup, free copy hard drive, free cloning, free cloning tools, linux copy hard drive, linux clone hard drive, mac clone hard drive, mac copy hard drive, windows clone hard drive, windows copy hard drive, backup hard drive, back up hard drive, back up hdd, back up ssd, acronis backup software replacement, acronis true image replacement, acronis true image free and open source tools alternatives

Draft Time: [1 hr.]

***Subscribe by Email!***

3 comments:

Thanks for your comment or question! If it is a question, I will try to get back to you quickly. Notice to spammers: I personally remove all spam promptly and report spammers to Google, so please don't do it.

Note: some HTML tags are allowed in your comments. To learn how to add bold (<b>...</b>), italics (<i>...</i>), or hyperlinks (<a href="URL">NAME</a>) to your comments, read here.

~Sincerely, Gabriel Staples.

P.S. Yo hablo español también. Je parle français aussi. (I speak Spanish & French too).