Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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'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.
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.
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.
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.
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.
Last edited by Geist; 01-25-2020 at 10:46 PM.
Reason: Added the 'status' option for further peace of mind
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
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.
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.
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.
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.
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
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.