LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What's a simple, easy way to clone a hard drive? (https://www.linuxquestions.org/questions/linux-newbie-8/whats-a-simple-easy-way-to-clone-a-hard-drive-4175668437/)

Gregg Bell 01-25-2020 07:05 PM

What's a simple, easy way to clone a hard drive?
 
I've got the connector cord to connect my main computer to the hard drive I want to clone it to. I'm using Xubuntu 18.04LTS, and I want to clone a 75GB (source) SATA hard drive to a 250GB (destination) SATA hard drive. I've read about Clonezilla and "dd" but it's still pretty confusing. Like what about MBR and stuff like that? Anyway, my question is, what's a simple, safe way to clone one hard drive to another so that the destination hard drive is absolutely identical to the source drive, and after the clone is complete, I can switch out the hard drives and the cloned hard drive will do everything the original one did. Thanks.

frankbell 01-25-2020 07:26 PM

If you've got a cable connection and can mount both drives, you should not need to use Clonezilla.

Take a look at rsync.

syg00 01-25-2020 07:36 PM

Simplest - dd
Followed by clonezilla

All copiously documented. Will do what you asked, not necessarily what you might want. The rsync suggestion will require you to do some setup, which you appear dis-inclined to do.

vtel57 01-25-2020 07:38 PM

Rsync is not necessarily simple for a not-so-experienced Linux user. However, it would be my choice. I rsync (mirror) my /, /home, and /archive partitions to a backup drive every Sunday morning.

The most important thing to remember with rsync is if you want a true bootable image of a drive, you must remember when setting up source and destinations to ALWAYS REMEMBER THE FULLOWING / on the source.

For example:

Source: /dev/sda1/
Destination: /dev/sdb1

If you forget the following / on the source, you'll end up with your entire backup being placed in a new directory on the backup drive rather than being an actual true mirror of the source drive.

An easy way to use Rsync to back up is to use a portable Linux (on a disk or USB stick) like Porteus. Within Porteus, you'll find the graphic version of rsync known as grsync. It looks like THIS. Very simple to set-up and operate.

Personally, I don't rsync my main system to my backup drive from within the active/booted main system. I prefer to use a portable Linux to mount and mirror the appropriate partitions using rsync.

Luck with it.

slackware-current 01-25-2020 09:26 PM

dd if=/dev/you want to copy of=/dev/yopu want to send copy to.
https://www.linuxnix.com/what-you-sh...ux-dd-command/

Geist 01-25-2020 10:42 PM

Imho, the scare factor of dd is overrated, not completely unwarranted, mind you, but overrated.
Yes, it can be a 'data destroyer', but so can pretty much every software, no matter how friendly, if it deals with storage media and sporting any sort of 'erase' functionality of any shape.

If the destination harddrive is 'empty', or, which would make sense in this case 'contents don't matter, then dd is quite safe, as long as you keep the 'in file' aka if= to your source, never put your 'source' in the output file.

Code:

dd status=progress if=/dev/source of=/dev/destination
the 'of' bit is the one getting the lovin', as long as you take care to only put things there that you are fine getting written to, then you'll be okay.

EdGr 01-25-2020 11:23 PM

Since the drives are different sizes, you do not want an image copy (dd).

If the drive is bootable, you need to install the OS on it and then use rsync to copy any data onto it. If the drive contains only data, you need to partition it (gdisk), make the filesystem (mkfs.ext4), and then run rsync to copy the data.
Ed

Geist 01-25-2020 11:47 PM

The sizes are different, but in this case, from small to large, that should merely result in unallocated space after the cloned image.
In other words, the larger drive will appear as if it were the smaller drive, a harddrive with (lets assume) one partition with 75GB of space.

But, unlike the smaller drive, the larger drive will have space available, albeit 'unallocated' beyond that.

Thus, the clone of the old drive, which is said one partition, could be expanded to fill the entire 250GB, or more partitions could be put after it.
Code:

Small drive:
 p1
[||||||||||||]

Large drive after clone:
 p1        | unallocated
[||||||||||||xxxxxxxxxxxxxx]

After expanding the partition
 
p1          | still p1, but with free space
[||||||||||||______________]

Or with a new partition:
p1          |p2
[||||||||||||______________]

In the second to last example, the partition is extended and it would be like the 75gb drive had grown to a 250Ggb one.
In the last example, partition one would be full (if the source drive of 75gb were full too) and the second partition would be empty.

Gregg Bell 01-26-2020 02:37 PM

Quote:

Originally Posted by frankbell (Post 6082980)
If you've got a cable connection and can mount both drives, you should not need to use Clonezilla.

Take a look at rsync.

Thanks Frank. And thanks for the link. rsync looks pretty simple.

Gregg Bell 01-26-2020 02:39 PM

Quote:

Originally Posted by syg00 (Post 6082983)
Simplest - dd
Followed by clonezilla

All copiously documented. Will do what you asked, not necessarily what you might want. The rsync suggestion will require you to do some setup, which you appear dis-inclined to do.

Thanks syg00. I'm thinking Clonezilla is a little less scary at this point, and yes, I'm pretty disinclined to do set up.

Gregg Bell 01-26-2020 02:43 PM

Quote:

Originally Posted by vtel57 (Post 6082984)
Rsync is not necessarily simple for a not-so-experienced Linux user. However, it would be my choice. I rsync (mirror) my /, /home, and /archive partitions to a backup drive every Sunday morning.

The most important thing to remember with rsync is if you want a true bootable image of a drive, you must remember when setting up source and destinations to ALWAYS REMEMBER THE FULLOWING / on the source.

For example:

Source: /dev/sda1/
Destination: /dev/sdb1

If you forget the following / on the source, you'll end up with your entire backup being placed in a new directory on the backup drive rather than being an actual true mirror of the source drive.

An easy way to use Rsync to back up is to use a portable Linux (on a disk or USB stick) like Porteus. Within Porteus, you'll find the graphic version of rsync known as grsync. It looks like THIS. Very simple to set-up and operate.

Personally, I don't rsync my main system to my backup drive from within the active/booted main system. I prefer to use a portable Linux to mount and mirror the appropriate partitions using rsync.

Luck with it.

Thanks vtel57. Yep, I'm the not-so-experienced user. Thanks for the warning about the / nuance. If I use rysync I will definitely be back here asking if my plans look okay.

I have grsync on another computer but haven't used it hardly at all as I've found FreeFileSync to be a little more straightforward.

Gregg Bell 01-26-2020 02:47 PM

Quote:

Originally Posted by slackware-current (Post 6083000)
dd if=/dev/you want to copy of=/dev/yopu want to send copy to.
https://www.linuxnix.com/what-you-sh...ux-dd-command/

Thanks. Wow, that's simple.

Gregg Bell 01-26-2020 02:49 PM

Quote:

Originally Posted by Geist (Post 6083024)
Imho, the scare factor of dd is overrated, not completely unwarranted, mind you, but overrated.
Yes, it can be a 'data destroyer', but so can pretty much every software, no matter how friendly, if it deals with storage media and sporting any sort of 'erase' functionality of any shape.

If the destination harddrive is 'empty', or, which would make sense in this case 'contents don't matter, then dd is quite safe, as long as you keep the 'in file' aka if= to your source, never put your 'source' in the output file.

Code:

dd status=progress if=/dev/source of=/dev/destination
the 'of' bit is the one getting the lovin', as long as you take care to only put things there that you are fine getting written to, then you'll be okay.

Thanks Geist. And thanks for the reminder that everything is a risk of some sort. What does the

status=progress

do?

Gregg Bell 01-26-2020 02:52 PM

Quote:

Originally Posted by EdGr (Post 6083035)
Since the drives are different sizes, you do not want an image copy (dd).

If the drive is bootable, you need to install the OS on it and then use rsync to copy any data onto it. If the drive contains only data, you need to partition it (gdisk), make the filesystem (mkfs.ext4), and then run rsync to copy the data.
Ed

Thanks Ed. That complicates things a bit. So in that process I would have to reinstall all my apps, right?

vtel57 01-26-2020 02:53 PM

Definitely keep us posted on your progress or holler if you need some more assistance, Gregg.

Luck with it!

~Eric


All times are GMT -5. The time now is 03:14 AM.