LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 12-18-2017, 10:14 AM   #1
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 19.2 MATE, MX-19, Manjaro
Posts: 2,616
Blog Entries: 14

Rep: Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950
Cloning Disk1 to Disk2 - Suggestions please


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!

Last edited by beachboy2; 12-18-2017 at 11:46 AM.
 
Old 12-18-2017, 11:56 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,965

Rep: Reputation: 1231Reputation: 1231Reputation: 1231Reputation: 1231Reputation: 1231Reputation: 1231Reputation: 1231Reputation: 1231Reputation: 1231
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.
 
1 members found this post helpful.
Old 12-18-2017, 12:18 PM   #3
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
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.
 
Old 12-18-2017, 12:21 PM   #4
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 19.2 MATE, MX-19, Manjaro
Posts: 2,616

Original Poster
Blog Entries: 14

Rep: Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950
TenTenths,

Thanks for your reply.

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.

I wish Macrium did a Linux only version.
 
Old 12-18-2017, 12:27 PM   #5
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 19.2 MATE, MX-19, Manjaro
Posts: 2,616

Original Poster
Blog Entries: 14

Rep: Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950
plasmonics,

Thanks for your reply.

In Clonezilla's Expert Mode what additional settings do I need in order to ensure I get all the items referred to in post#4?

I would like the info for both a System Image and a disk-to-disk clone.

I must keep all the UUIDs as per the originals on disk1.

Last edited by beachboy2; 12-18-2017 at 12:36 PM.
 
Old 12-18-2017, 01:03 PM   #6
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
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.
 
Old 12-18-2017, 01:20 PM   #7
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
One method that is foolproof is
Code:
dd if=/dev/sda of=/dev/sdb bs=1M
but it takes a long time.
 
Old 12-18-2017, 01:45 PM   #8
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 19.2 MATE, MX-19, Manjaro
Posts: 2,616

Original Poster
Blog Entries: 14

Rep: Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950
plasmonics,

I will try the bootloader option in Expert Mode and leave the defaults as they are.
I hope that this will work.

I have read up on the various dd commands for cloning and imaging:
https://www.linux.com/learn/full-met...ing-dd-command

However, as you say, dd is much slower than Clonezilla.

@anybody else,
Please continue to let me have your suggestions.
 
Old 12-18-2017, 03:30 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,348

Rep: Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977
"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.

Last edited by jefro; 12-18-2017 at 03:33 PM.
 
Old 12-18-2017, 03:38 PM   #10
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 19.2 MATE, MX-19, Manjaro
Posts: 2,616

Original Poster
Blog Entries: 14

Rep: Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950
jefro,

Thanks for your input.
 
Old 12-18-2017, 06:10 PM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,285

Rep: Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992
I've never seen the sense in insisting on an "exact" copy, but is it even possible with SSD ?.
 
Old 12-18-2017, 07:55 PM   #12
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
Quote:
Originally Posted by syg00 View Post
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.
 
Old 12-18-2017, 08:42 PM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,285

Rep: Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992Reputation: 2992
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.
 
Old 12-18-2017, 09:18 PM   #14
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,348

Rep: Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977Reputation: 2977
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.
 
Old 12-19-2017, 03:12 AM   #15
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 19.2 MATE, MX-19, Manjaro
Posts: 2,616

Original Poster
Blog Entries: 14

Rep: Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950Reputation: 950
syg00,

Thanks for your reply.

I can now appreciate that producing an exact copy of a SSD disk by cloning is not possible.

I think that I am going to use Clonezilla to make a system image as opposed to a clone and see how that goes.

How do you normally do your disk copying?
 
  


Reply

Tags
clonezilla, cloning, disk, fstab


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] yum repo issue with iso disk1 and disk2 oly_r Linux - Software 2 03-01-2013 08:56 AM
Moving LVM from disk2 t o disk1 DragonFly2 Linux - Server 14 04-11-2011 03:43 PM
Cloning a partition using DD. Some advice / suggestions needed. uncle-c Linux - Newbie 1 10-28-2007 01:14 PM
Dual Boot (Disk1-Linux, Disk2-Windows) Slipstream2006 Linux - General 5 07-28-2007 11:32 PM
How to unmount disk2? Jwirt Linux - Hardware 2 02-07-2005 02:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration