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.
Hi all. I currently have 3 hdd's in my machine (sda, sdb, sdc) Sdb is beginning to throw errors so I bought a new hard drive which is sdc. Sdb and Sdc each currently have a single partition formatted to ext4. Is there a preffered method to clone one harddrive/partition to another without creating an .iso?
Essentially I just want to get all the files with the existing directory structure form the failing drive to the new one (as fast as possible) so that the fail can be pulled and I can avoid any reconfiguration except to resetting the mount points.
I thought dd was for creating image files? I am just wanting to get a working duplicate of the partition without an intermediate step. It seemed that rsync or maybe cp would be the way to go, but I'm not sure of the options or which is more less likely to create corrupted files.
I think you are looking for something like this: dd if=/dev/sdb1 of=/dev/sdc1 bs=4096 conv=notrunc,noerror
I do assume your original post is correct by stating that sdb is the "old" drive and sdc is the clean, new drive. So data goes from sdb -> sdc.
sdc1 will be an exact copy of sdb1, including size, data and UUID's.
Make sure you understand what this command does and check if my assumed in and outfile are correct, doing it wrong can compromise your data!! Do, at least, read the part about the command I suggested in the given link.
dd is used for a lot of things. Creating iso is one use for dd. extracting an iso to a file system is another use, and copying file system structures locally is another use.
dd has its uses - creating backups ain't one of them. Do you *really* want to keep going unknowing copying corrupted files if there are read errors on the source ?.
Not me.
Use a filesystem aware method - either cp or rsync will do the job nicely, even if the sizes are different, so long as the target is big enough. Personally I prefer the former run from a liveCD
Code:
cp -a <source_mount_point>/* <target_mount_point>/
I went with cp -a. There were about 20 files (thankfully that didn't mean a whole lot) that wouldn't copy due to what I'm assuming was a corrupted disk. The only thing that seems weird to me is that the new partition, minus 20 or so files, shows to be using an additional 2GB of diskspace? Maybe due to it being a primary partition? I'm going to have to figure out why the second partition is always sdx5. That one still confuses me.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.