Clone a hard drive

Can someone please help me with cloning my hard drive?

I want something that can restore my hard drive to the point at which the cloned copy was made.

It is using 54 Gb of a 2 Tb drive.

Do you mean

  • copy data from "/" on old to "/" on new ?

or

  • copy low-level boot sector and partition tables, etc ?

For the first,
define "here=" as the path to the root on your old disk, then define "there=" as the path to the root on the new disk, then

cd "${here}"
tar cf - . | ( cd "${there}" ; tar xvpf - )

If the second,
that is extremely complex and prone to many non-recoverable issues.

If you do want to rebuild the partition layout that you had on your old disk, then you need to look at the information reported by

gdisk -l /dev/sda

and use that as input for an interactive session using gparted to "format" your new clone disk before performing the "tar" based data transfer using the command provided above.

4 Likes

I completely agree with the suggestions made in this article:

4 Likes

If I read things correctly none of them support ext4.

I am trying to find out how to burn a Clonezilla .iso to a pendrive.

It does not look like K3b can do it. I prefer a GUI method for something as important as making a clone image of my 2 Tb drive.

You did not read correctly :slight_smile:

Only Partimage is unable to do Ext4
The other three tools are fine.

Use the "restore image" option of gnome-disks to burn the clonezilla iso :

5 Likes

Have you considered Redo or Rescuezilla?

1 Like

I need help with this. Hitting Enter did nothing. Ctrl C did not work either. I am sending this from my phone.

That image refers to /dev/sdb2, which is a partition, not a disk. Also, "-" would suggest to me that it is sending to stdout, but that would not make much sense, and could explain the failure (flooding both RAM and SWAP :frowning: ). You may not have provided a necessary "--output" destination for the partclone command/GUI.

Also, given the small amount of data being transferred, a data transfer mechanism is superior to a "cloning" mechanism, at least in my opinion it is. :slight_smile: For this operation, using rsync for non-network transfer would not give you any speed advantage for the transfer.

After formatting and partitioning your new disk, use the tar command offered and you will have an exact image of the data.

If you are doing the 2-step process, tar to image then image to tar, you can use the following commands:

cd "${here}" ; tar cvf "${pathToImageDirectory}/imagefilename.clone"  .

Then "install" new disk ...

  • create partition table on new disk
  • create partitions on new disk
  • format partitions on new disk (including unique labeling for partitions)
  • create mountpoints for partitions
  • mount partitions

Then restore the data ...

cd "{there} ; tar xvpf "${pathToImageDirectory}/imagefilename.clone"

gnome-disk is probably a good choice if you feel hesitant about doing things.


"dd" is the worst choice because it will do a bit-by-bit imaging from one disk to the other, and that is rarely recommended because of potential issues concerning badblocks:

  • badblocks on the old disk will be "replicated" (a.k.a. avoided) on the new disk (losing access to good blocks);

  • badblocks lists will be duplicated, overwriting the "real" badblocks list generated by a proper fsck on the new disk.

These days, I believe the bulk of dd usage is limited to initial steps in forensics work, or capturing the disk's superblock to give a backup image of your disk partitioning before editing the partition table with various tools, including gparted.


Looking at your picture, I think your command format (to create an image file) should look like:

partclone.ext4  --clone  --source /dev/sdb2  --output /dev/{backupdevice}/sdb2_ext4.clone

Then, after mounting you new disk (call it /dev/sdk) and creating and formatting a partition on that (call it /dev/sdk1), you can then restore by performing the reverse action:

partclone.ext4  --clone  --source /dev/{backupdevice}/sdb2_ext4.clone  --output  /dev/sdk1

I have used Clonezilla before. With no problems whatsoever. If has time, could make a post to AskIbuntu? I have big fingers and have a hard time typing on my small phone.

Going back to your original question, is your plan

  • to create an identical disk (a second 2 TB disk)
  • structured exactly like the currently installed disk, and
  • containing all identical as it stands now,

so that if your current disk dies,

  • you unplug the old disk (thereby removing any non-BIOS hidden trojans or viruses),
  • plug in the new disk, and
  • rebuild all the other data from backups ?

Mr. Eric,

Viruses and malware very rarely affect Linux systems. There are 100's of variants.

I made the comment because, if you use something like Wine for Windows-originating tools, you have opened the door to all those nasties.

Even then, you can't assume Linux is immune, as reported here!

Not to mention the following quote from a SANS course flyer:

  1. Emerging Malware Tactics
    According to Trend Micro, advanced persistent threat (APT) groups are exploiting BPF filters for installing backdoors, presenting new challenges in malware detection.
    TechJury notes the adaptation of malware like RansomExx, highlighting the evolving tactics of cybercriminals targeting Linux servers.

But my question was trying to clarify your context and planned usage, to ensure the offered solution was a "best fit" for your context.

I hope both hard drives are not bricked " I have no other backups.

I got the problem fixed.

I guess there was a slight lack of motivation in responding.

Glad you got your problem fixed.

Not sure who you are referring to regarding lack of motivation in responding. Lots of people here were responding to you and asking questions, but you rarely answered those questions.

We weren't getting the specific feedback to questions asked, and statements like

are completely ineffective because they

  • don't give specific details about the sequence of steps that brought you to that point;
  • don't give any specifics as to hardware configuration during each step in the sequence,
  • don't serve any useful purpose in a troubleshooting process.

Eric, (and a few others)

Do you make mistakes?

Are you perfect?

Are you close to 69 years of age?

Have had intractable pain for 30 years?

I don't think @ericmarceau was trying to be rude in any sense of the way with the last message

We all here are trying to help each other out and don't think we don't care about your problems because we do - you can see it by the number of other posts you've created and we answered with questions about what/how/why things are

One thing to consider is that we all have real-life-obligations so we might not see your message in due time but we will try and do try to help in any way possible

I am glad you've got so many problems solved in last few days - making Bluetooth dongle work, connecting with Echo device and now headphones - good job! Hope you feel proud fixing this last task by yourself :grin:

1 Like