How can I dd copy all files from 1 hdd to another but without the target being in an image file?
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.
How can I dd copy all files from 1 hdd to another but without the target being in an image file?
Basically, i want to copy all files from one hdd to another and have the 2 hdd's exactly the same. But on the target hdd, i do NOT want an image file.
Reason for this: when using "cp" not all of my files transfer over because of long names, etc. So it is much faster to just dd them over because all of them do transfer over with dd.
Here is a list of known dd commands, though i am not necessarily sure which situation goes with which command:
Code:
1- “sudo dd if=/dev/sdx bs=8M of=/filepath/directory.name”
2- “sudo dd if=/dev/sde bs=8M of=/directory.name.external.media.mounted.to/directory.name.new.files.go.here”
3- “sudo dd if=/directory/filename bs=8M of=/filepath/new.file.name” ((this seems to be for a single file only))
4- “sudo dd if=/dev/sdx bs=4M of=/path.to.backup.img”
5- “sudo dd if=/dev/sdx bs=4M of=/dev/sdy”
6- “sudo dd if=/filepath/filename bs=8M of=/filepath/new.file.name”
7- “sudo dd if=/filepath/filename bs=8M of=/dev/sdx” (converting an image to an OS???)
Last edited by blooperx3; 11-30-2020 at 03:17 AM.
Reason: ADDED LIST DD COMMANDS
Thanks. If they had been OpenZFS, then there would have been additional options but you will be able to make a fast and accurate copy across two EXT4 partitions using rsync, unless you are dealing with millions of files. I'm not sure where the threshold is but at that level you'd have to split up the transfer into smaller hierarchies.
Thanks. If they had been OpenZFS, then there would have been additional options but you will be able to make a fast and accurate copy across two EXT4 partitions using rsync, unless you are dealing with millions of files. I'm not sure where the threshold is but at that level you'd have to split up the transfer into smaller hierarchies.
With rsync you won't make a copy of the file system itself, only the contents. Thus you have a proper blkid and so on. That is a big advantage. However, the primary advantage is that it copies only the changes so you can use it for ongoing updates at a lower resource and time cost. For the same reason it is useful for transfers that might get interrupted, because it can resume where it left off unlike dd.
To elaborate using dd i.e. dd if=/dev/sdy of=... is basically a full metal backup of the entire drive. Your copying the drive byte for byte, the partition table, partitions, filesystem metadata, files and of course empty space. Any existing data on the destination drive is overwritten. Not a good method for backing up just files.
rsync copies files from a source directory to a destination directory just like the cp command but does a better job and copying lots of files. As a backup tool it will only copy files that have changed on the destination. In your case the destination directory would be the mount point of your 2nd hard drive.
I am going to copy a 1TB hdd bit-for-bit using the following command. To get the most precise dd copy over, what number would work best for "bs=XM"? I've read that the bs=xM has to do with the speed of copying. I'm wondering if the higher speeds result in more errors or a poorer quality clone. For this hdd, I need dd due to deleted files.
At around the 333GB mark, it stopped copying and gave an Input/Output error. Then when i tried to mount it, it said it couldn't mount b/c it couldn't open a certain directory. I restarted the computer and then it mounted.
I don't actually need the files on the desktop of the drive, I just need the deleted files - to try and get them back. My source hdd with 'fuse' filesystem became infected with malware and the hdd itself told me there was a problem with the drive and asked me if I wanted to fix it. I said yes and it deleted many GB's of files.
The hdd was an external hdd, not an internal like my other hdds. Now I am trying to dd my 1TB external hdd to a 1TB internal hdd in a docking station.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.