Greg Freemyer wrote:
On Wed, Apr 11, 2018 at 1:30 PM, Felix Miata
> 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
> 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.
Disclaimer -- when I copy partition, it's either to another
disk or one end is a file.
I've never had such a copy NOT work and I've used a few extreme
cases, like copy old image that was a RAID0 from 4 disks ~240GB each
to a 2TB hard disk where it used the 1st 1TB (approx) of disk space.
From that I copied it to a new 960GB SSD (the HD was too
slow even though it was temporary). And eventually copied it
to another RAID, but RAID10 with 4 512MB HD's making the RAID.
So, you are telling me it's not suppose to work?
or does the fact that they were all disks (of a sort) mean that
I have copied partitions when whole disk didn't
work -- 1st copy copied the partition table, then next 2
copies copied the 2 partitions (for some reason copying the HD
resulted in a short copy due to hitting and end of file on the
source disk...weird). But copying the 2 partitions to the ones
on the other disk (where the parition table had already been
copied successfully) worked fine.
I don't remember trying to go partition
to another partition on the same disk -- would be way too slow.
failure mode would be attempting to clone an in use
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.
In addition to Felix's comments, dd aborts by default on a read or write error.
I used a quiescent and sync'ed system. If it was more
important than normal, I might remount it read-only.
Also when copying, I made sure it did 'fullblocks'
only. I usually dispose of disks that start developing errors...
it's not a good sign, IMO.
To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org
To contact the owner, e-mail: opensuse+owner(a)opensuse.org