2 ms·
There's nothing special about dd. You can, and should, simply use `cp`
by jeffbee 2y ago
There's nothing special about dd. You can, and should, simply use `cp`
- bravetraveler 2y agoThat's the least important part about my post. I mentioned several things, one being the shell you probably already have running, that all will do a perfectly fine job - to hopefully demonstrate that. 'cp' is sparse aware. Yay. Is that a good thing, actually? If the source has zeroes, I want to write zeroes. Not sure... probably fine. I've been awake too long. 'ddrescue' is special, but again, consistency is key. I don't really care how it's copied. I just question 'should' - there are advantages elsewhere. edit: My main gist is this - living off the land applies here, too! Whatever option is available. Make the copy, check the checksums. Pull out the bigger gun if necessary. Never know when you have to rely on some binary that's surviving only in caches. Stuck with a broken system and no live environment in sight.
- o11c 2y agoThere is, however, something special about `ddrescue` (note that there are 2 different projects named thus; I don't remember the difference) - it does all the okay sectors, then goes back and retries bad sectors. Just be sure to store the ddrescue state file somewhere persistent.
- mrcode007 2y agoPlease show me how you cp a raw device without the concept of files. I’d love to learn. $ cp /dev/nvme0n1p1 /mnt/my-special-backup ?
- jeffbee 2y agoYes
- mrcode007 2y agoHa. Today I learned. Is this a portable approach across macOS, Linux and BSD family ?
- chipdart 2y ago> Is this a portable approach across macOS, Linux and BSD family ? I think that feature relies in the concept of a device file, which is a direct reflection of the UNIX trait of everything being a file. https://en.wikipedia.org/wiki/Device_file https://en.wikipedia.org/wiki/Device_file
- userbinator 2y agoA device is a file. That's the power and elegance of Unix-like systems.
- immibis 2y agoThe correct abstraction is that a file is a device. A file is a section of a hard disk which behaves like a whole disk. It also happens to be expandable. cp's default behaviour for device files also happens to be very stupid.
- m463 2y agodd can copy block by block from one block device to another ddrescue can do the same, but will handle errors better e2image understands ext2/3/4 filesystems and can copy only the blocks in use, which can really help (though don't know how it works if it encounters an error)