Sunday, September 26, 2021

asymmetrical cloning

Okay, so I came up with the bright idea of cloning disks that aren't identical. The target drive is smaller than the source drive, so this doesn't work. So I'm trying to figure out how to do this. Here's what I'm thinking right now. The source is 1 TB and the target is 500 GB. There are three partitions on the source drive. Two of them are small, around 500 MB, and the main partition takes up the rest. The order is 500 MB, ~1TB, 500 MB. So I can copy over the first and last just as they are, with the exact sizes, and then the remaining space goes to partition 2. 

Here's the actual partition information:
Device     Boot      Start        End    Sectors   Size Id Type
/dev/sdb1  *          2048    1126399    1124352   549M  7 HPFS/NTFS/exFAT
/dev/sdb2          1126400 1952463634 1951337235 930.5G  7 HPFS/NTFS/exFAT
/dev/sdb3       1952464896 1953519615    1054720   515M 27 Hidden NTFS WinRE

So I played around with the numbers on a spreadsheet, and the sectors is end-start+1. And if you divide sectors by size you get 2048.

AND

Disk /dev/sdc: 465.78 GiB, 500107862016 bytes, 976773168 sectors

So, doing the math, if I subtract sdb1 and sdb3 sectors, that leaves 974594096 for my new sdb2. According to DF, only 91G of space is currently being used, so that should be plenty. Then I should be able to do a dd or something. Well a dd will work for the identical ones, but maybe not for the asymmetrical copy. Hmm...

...

Now I'm working with parted, and the sizes are different, which is making me nervous, so I think I'll go with those sizes:

Number  Start   End     Size   Type     File system  Flags
 1      1049kB  577MB   576MB  primary  ntfs         boot
 2      577MB   1000GB  999GB  primary  ntfs
 3      1000GB  1000GB  540MB  primary  ntfs         msftres

...

Now I'm using the GUI partition editor, but I screwed up in my delete and everything is right, but the big partition is sdc3 and that's making me nervous, so I'm going to delete and start over. So here are the numbers
second partition--
size 464.72 GiB
First sector 1,126,400
Last sector 975,712,255
Number of sectors 974,585,856

Third partition--welp doesn't matter because it's copy paste.


No comments:

Post a Comment