[SOLVED] Cloning Disk1 to Disk2 - Suggestions please
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have two identical Intel SSDs (545s), one of which (disk1) is in a laptop with Solus 3 MATE installed (disk2 is currently still in its sealed Intel packet and unformatted).
I have 3 partitions:
/dev/sda1, root
/dev/sda2, swap
/dev/sda3, home.
NB There is an 1MiB unallocated partition preceding each partition.
I want to use Clonezilla, or something else, to clone disk1 to disk2 exactly and as easily and quickly as possible.
An alternative route using the command line only is perfectly okay as long as I have all the correct options listed for this particular job, including transferring swap.
Upon completion I must have the same UUIDs and /etc/fstab on disk2.
It would be handy to also create a system image of disk1 to put on an external hard drive.
This image could then be transferred to disk2.
I have a USB SATA adapter available to use for disk2 during the cloning.
I also have various USB external hard drives.
I would appreciate your detailed recommendations please.
Thanks.
PS This is my wife's laptop, so foul-ups are not allowed!
Yup, booting from a "live" clonezilla disk is your friend, boot it and it's pretty self-service for your cloning and creating a backup image. You DO have to be careful and read the screens as you go through the process, especially when it comes to source and destination.
For what it's worth, I've used clonezilla to clone my old laptop SSD to an external USB hard disk and then back from the external to a new (larger) SSD. In that case it was Windows 10 rather than a Lin distro.
I have done this twice using Clonezilla without any problem. The process was quite fast. In both cases, the source was a spin drive and the target SSD. It helps if the target is the same size or larger than the source. In one case, the source was 750G and the target 500G. It worked, because the source contained unallocated space. The total allocation on the source was less than 500G, which is why Clonezilla did not complain.
It will also clone the UUIDs. If this is not what you want, you can run tune2fs on the target afterwards.
I used the expert mode. If you want the MBR restored on the target, select "Reinstall grub on the hard disk boot sector".
In my situation, the sources were GPT with ESP, so the stdout printout "Restoring the bootloader ..." does not mean anything.
In terms of the physical connection, I used a Bytec USB 2 external interface. If you want faster results, attach it to the internal sata. Clonezilla also works over a LAN.
rsync should also work, both locally and over a LAN. The difference is that you need to partition and format the target manually. This will produce different UUIDs, if that is what you want. The other issue is that you would have to exclude pseudo directories such as /proc, /sys, /tempfs, etc. I am not sure if you would have to recreate /dev on the target. With Clonezilla, I did not have to deal with any of this.
Using Clonezilla to produce a disk image, I only saw sda1 and sda3 mentioned.
Does the swap partition and MBR get imaged automatically in Clonezilla's Beginner Mode as well?
I need all the various partitions that are on disk1, including the unformatted 1MiB partitions.
You also mentioned a similar operation on a Windows system.
For the benefit of anyone who may be interested I can say that, in my opinion, Macrium Reflect 7 Free (or Home Edition) is simply the best for imaging in Windows. https://www.macrium.com/reflectfree
I have used it extensively. It works every time and it is fast.
Other than the bootloader check box, the default selections should be enough. I think the main difference between the simple and expert modes is that the former excludes the boot loader. This means that if, for instance, the Windows partition boot flag is set, the target drive will boot straight into windows, instead of what you originally intended. You would then have to reinstall grub on the MBR to get the target disk to behave in the original way. If the source hardware is UEFI/GPT, there is no major issue. The ESP is just another partition that is cloned just like the others.
The expert mode allows you to fine tune various parameters, e.g., you can change the block size from 4k to something different. I used default selections.
Clonezilla clones the partition table, regardless of whether it is MSDOS- or GPT-labeled, so that the various partitions, Windows ntfs, ext, bsd, swap, etc, will all be the same on the target.
"exactly and as easily and quickly as possible." Yet the two are against each other.
I'd define "exactly" as a bit by bit copy. While you don't really need the un-used areas copied, generally dd does copy "exactly" unless a more complex command is used. (dd)
Many backup programs copy file by file. Clonezilla attempts to copy file by file if it can read and write in the filesystem used. If it can't then it will try to copy bit by bit. (dd)
dd is not usually a command I'd suggest to the new user. It has not safety, no opps or stop and go back buttons.
Clonezilla tries to make a copy of all partitions and loaders and hence it is a clone program.
You can use dd to copy loader area and use gparted to copy partitions may be the fastest way if clonezilla fails.
Always test backups. Nic configurations and maybe some other settings may fail even on dd clones. A common way is to make all references generic and then clone.
Usually folks say to clone from a live image. It is possible to clone hot. I prefer live boot clone.
There may be some commercial programs too that will be fast and easy. Acronis has been able to clone Linux for many years. I'd suspect that others will too.
I've never seen the sense in insisting on an "exact" copy, but is it even possible with SSD ?.
The first time I tried this, the target was a Samsung EVO 850 SSD. The source Seagate spin drive contained seven OSes, including Windows 10. All of them booted up on the target with one exception. For some reason, Debian would not boot. Maybe there was a glitch with the inodes. The pointer to grub could have been corrupted. I got it to work from the chroot of another distro by reinstalling Debian's grub on the ESP.
The second time, the target was a Mushkin Reactor SSD. The source contained eight OSes including windows. All OSes booted up without a hitch.
Yeah, I'm sure that the copying works - I do it regularly myself, but not by cloning.
I was referring to the lower, hardware layers - with wear levelling and trim, could you ever say with certainty that you'd copied the "start" of the "disk" to the "start" of the target with SSD's.
I get what you are thinking but in one split second of time the drive is presented to the OS as a hard drive no matter what background is going on. True that you won't get an "exact" copy on ssd's ever, so good point.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.