Lew Wolfgang composed on 2018-04-11 07:51 (UTC-0700):
One of my acolytes reported that she used dd to copy one disk partition to another partition on the same disk, as in:
dd if=/dev/sda1 of=/dev/sda2
She said it failed, but was a little fuzzy about exactly what happened (I wasn't there), just that the destination partition appeared to be "empty" after the operation. I don't know how she made that determination.
I've been doing UNIX stuff for a long time but I never would have thought to use dd in this fashion. Maybe instinct? But assuming that the two partitions are exactly the same size, what could possibly go wrong?
dd if=/dev/sda1 of=/dev/sda2 stands a significant chance of failure on an MBR disk. Before it became standard practice to leave a gap of 1.0MiB or 2.0MiB in front of the first partition, sda1 would be a different size in sectors from an ostensibly identically sized sda2, sda3 or sda4. The latter three would typically be larger than sda1 by 62 sectors. The latter three would also be larger than a "same" size logical. IIUC, with a standard gap from recent partitioning tools the difference between the first and up to three "identical" primaries would be gone, but not the difference between primaries and logicals. So, sda2 or sda3 to sda5 or sda13 should fail in any event. Were the destination partition a nominal size larger than the source, then dd could do OK, and there would be some unused sectors at the end of the partition. Another failure mode would be making an exact clone and not immediately accounting for having multiple filesystems with identical UUIDs and possibly volume labels, whether MBR disk or GPT. One or the other would need to be differentiated (e.g. with tune2fs -U and maybe -L) before either were put into use via mounting. Another failure mode would be attempting to clone an in use (mounted) partition, also same whether MBR or GPT, with files open and who knows what else that would result in filesystem inconsistency when attempting to put it into use. -- "Wisdom is supreme; therefore get wisdom. Whatever else you get, get wisdom." Proverbs 4:7 (New Living Translation) Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata *** http://fm.no-ip.com/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org