This tutorial is for those of you who:
It's a very simple tool for cloning LL, or any other distro, or Windows OS, including any dual- or multi-booted systems. The reason I started using 'dd' for cloning, is that I found other dedicated cloning software (e.g. clonezilla) too complicated to use: the 'dd' command only takes up one line of code in the terminal.
I have LL installed on a 250GB drive. About once-a-week, I clone it to an identical drive (same size & make), via a USB port (the important thing here is that the backup drive has a storage size that is either the same or bigger than the written space on the drive you want to clone from). I do this as I have accumulated several virtual machines, important data, packages, symlinks, etc which, if lost, would cost me a huge amount of time and energy to reinstall - doesn't bear thinking about :-[ . Should LL on the internal drive on my laptop crash irretrievably (it has done at least a couple of times due to my tinkering around and the odd silly mistake), I just take the drive out of the PC, and replace it with the backup drive. The backup drive is instantly recognised and works from the get-go.
How long will cloning it take?
Using setup 1 in my signature below as an example (an i7 laptop), where I'm cloning from a 250GB SSD to an identical external SSD (via USB 3.0 connection) it takes just under 3 hours, with a copy rate of around 23 to 27 MB/s. With older CPUs this will take longer, and it could be an activity you could just leave to run overnight. Sometimes, I clone from a 250GB SSD to a 500GB SSD - the cloning time is the same - in this case what you end up with is 250GB of cloned space and 250GB of unallocated space. I have cloned to HHDs, but the copy rate is significantly slower, as you'd expect. The backup drive doesn't need to be formatted for cloning - you can just leave it as unallocated space - cloning will overwrite it anyway. Also, don't forget to transfer any valuable data files on your backup drive before cloning to it, otherwise these will be lost !
Here's what you do to clone the whole drive:
So, if you are cloning from /dev/sda to /dev/sdb, you would enter:
The term status=progress, means that you are given a live on-screen progress of cloning, i.e. the cumulative number of bytes transferred, the time passed from the start of cloning (seconds) and the transfer speed (MB/s). If you leave this term out, cloning will go ahead but without any indication of progress until cloning has completed.
After entering this you'll be asked for your password - type this then hit the ENTER key to start the cloning process. When cloning is completed, the output from the terminal will have the following format:
In the output shown above, the internal drive that has LL installed on it (the drive that's being copied from) has the designation /dev/sdb - I just want to make the point that the designation of the drive, containing the operating system, is not always going to be /dev/sda, though it usually is.
Here's what you do if you want to clone just a specific partition, not the whole driveThe method is the same - you just need to quote the specific partition you want to clone 'from' and 'to' in the dd command.For example, if Linux Lite is installed as root on the partition /dev/sda1 on your PC, and you want to clone this to a partition on another drive named /dev/sdc1, then the command is as follows:
A WORD OF CAUTION (don't say you haven't been warned)!
Should you enter the wrong /dev/sdx designation, you could risk wiping your computer clean - this is probably the reason that 'dd' is sometimes nicknamed 'disk-destroyer'. So, my advice is don't do this if you're drinking beers, distracted, or overly tired, otherwise ..! That said, I've been using 'dd' for the last three years and haven't had a problem with it. Just make sure the USB connection of the backup drive is secure (as a precaution don't move the PC or external drive during cloning). If the USB disconnects during cloning, even just momentarily, you'll have to restart the cloning process.
- would like to have a solid backup clone of the whole drive (SSD or HDD) containing LL
- are familiar with at least some basic use of the terminal
- can use either gparted (i.e. Partition Drives in Menu) or terminal, to check the drive designation, i.e. /dev/sda, /dev/sdb, /dev/sdc, etc
It's a very simple tool for cloning LL, or any other distro, or Windows OS, including any dual- or multi-booted systems. The reason I started using 'dd' for cloning, is that I found other dedicated cloning software (e.g. clonezilla) too complicated to use: the 'dd' command only takes up one line of code in the terminal.
I have LL installed on a 250GB drive. About once-a-week, I clone it to an identical drive (same size & make), via a USB port (the important thing here is that the backup drive has a storage size that is either the same or bigger than the written space on the drive you want to clone from). I do this as I have accumulated several virtual machines, important data, packages, symlinks, etc which, if lost, would cost me a huge amount of time and energy to reinstall - doesn't bear thinking about :-[ . Should LL on the internal drive on my laptop crash irretrievably (it has done at least a couple of times due to my tinkering around and the odd silly mistake), I just take the drive out of the PC, and replace it with the backup drive. The backup drive is instantly recognised and works from the get-go.
How long will cloning it take?
Using setup 1 in my signature below as an example (an i7 laptop), where I'm cloning from a 250GB SSD to an identical external SSD (via USB 3.0 connection) it takes just under 3 hours, with a copy rate of around 23 to 27 MB/s. With older CPUs this will take longer, and it could be an activity you could just leave to run overnight. Sometimes, I clone from a 250GB SSD to a 500GB SSD - the cloning time is the same - in this case what you end up with is 250GB of cloned space and 250GB of unallocated space. I have cloned to HHDs, but the copy rate is significantly slower, as you'd expect. The backup drive doesn't need to be formatted for cloning - you can just leave it as unallocated space - cloning will overwrite it anyway. Also, don't forget to transfer any valuable data files on your backup drive before cloning to it, otherwise these will be lost !
Here's what you do to clone the whole drive:
- put the back-up drive into a USB caddy and plug into the USB port on your PC
- open gparted and make a note of the /dev/sdx designation of both drives, i.e. the one you're copying from (inside your PC) , and the drive you're copying to (external backup drive), e.g. on my PC this is /dev/sda (from), and /dev/sdc (to) - if you have only one drive bay in your PC then this might be /dev/sda (from) and /dev/sdb (to)
- close gparted, then open the terminal and type the following, substituting 'x' and 'y' for the correct designation of your drives:
Code:
sudo dd if=/dev/sdx of=/dev/sdy
So, if you are cloning from /dev/sda to /dev/sdb, you would enter:
Code:
sudo dd if=/dev/sda of=/dev/sdb status=progress
The term status=progress, means that you are given a live on-screen progress of cloning, i.e. the cumulative number of bytes transferred, the time passed from the start of cloning (seconds) and the transfer speed (MB/s). If you leave this term out, cloning will go ahead but without any indication of progress until cloning has completed.
After entering this you'll be asked for your password - type this then hit the ENTER key to start the cloning process. When cloning is completed, the output from the terminal will have the following format:
Code:
[mike@G750 ~]$ sudo dd if=/dev/sdb of=/dev/sdc status=progress
[sudo] password for mike:
488397168+0 records in
488397168+0 records out
250059350016 bytes (250 GB, 233 GiB) copied, 10865.2 s, 23.0 MB/s
In the output shown above, the internal drive that has LL installed on it (the drive that's being copied from) has the designation /dev/sdb - I just want to make the point that the designation of the drive, containing the operating system, is not always going to be /dev/sda, though it usually is.
Here's what you do if you want to clone just a specific partition, not the whole driveThe method is the same - you just need to quote the specific partition you want to clone 'from' and 'to' in the dd command.For example, if Linux Lite is installed as root on the partition /dev/sda1 on your PC, and you want to clone this to a partition on another drive named /dev/sdc1, then the command is as follows:
Code:
[mike@G750-mj ~]$ sudo dd if=/dev/sda1 of=/dev/sdc1 status=progress[sudo] password for mike: 48315625984 bytes (48 GB, 45 GiB) copied, 2200 s, 22.0 MB/s[[B94373887+0 records in94373887+0 records out
48319430144 bytes (48 GB, 45 GiB) copied, 2217.25 s, 21.8 MB/s
A WORD OF CAUTION (don't say you haven't been warned)!
Should you enter the wrong /dev/sdx designation, you could risk wiping your computer clean - this is probably the reason that 'dd' is sometimes nicknamed 'disk-destroyer'. So, my advice is don't do this if you're drinking beers, distracted, or overly tired, otherwise ..! That said, I've been using 'dd' for the last three years and haven't had a problem with it. Just make sure the USB connection of the backup drive is secure (as a precaution don't move the PC or external drive during cloning). If the USB disconnects during cloning, even just momentarily, you'll have to restart the cloning process.
64bit OS (32-bit on Samsung[i] netbook) installed in [i]Legacy mode on MBR-formatted SSDs (except pi which uses a micro SDHC card):
2017 - Raspberry pi 3B (4cores) ~ [email protected] - LibreElec, used for upgrading our Samsung TV (excellent for the task)
2012 - Lenovo G580 2689 (2cores; 4threads] ~ [email protected] - LL3.8/Win8.1 dual-boot (LL working smoothly)
2011 - Samsung NP-N145 Plus (1core; 2threads) ~ Intel Atom [email protected] - LL 3.8 32-bit (64-bit too 'laggy')
2008 - Asus X71Q (2cores) ~ Intel [email protected] - LL4.6/Win8.1 dual-boot, LL works fine with kernel 4.15
2007 - Dell Latitude D630 (2cores) ~ Intel [email protected] - LL4.6, works well with kernel 4.4; 4.15 doesn't work
2017 - Raspberry pi 3B (4cores) ~ [email protected] - LibreElec, used for upgrading our Samsung TV (excellent for the task)
2012 - Lenovo G580 2689 (2cores; 4threads] ~ [email protected] - LL3.8/Win8.1 dual-boot (LL working smoothly)
2011 - Samsung NP-N145 Plus (1core; 2threads) ~ Intel Atom [email protected] - LL 3.8 32-bit (64-bit too 'laggy')
2008 - Asus X71Q (2cores) ~ Intel [email protected] - LL4.6/Win8.1 dual-boot, LL works fine with kernel 4.15
2007 - Dell Latitude D630 (2cores) ~ Intel [email protected] - LL4.6, works well with kernel 4.4; 4.15 doesn't work