Hello Everyone,

thank you for the great work on coreutils, i use them so often and would not 
know what to do without them. I have an issue with dd that I am not able to 
solve myself, that is why I am seeking for help here.
I am trying to copy parts of a disk image to another file. I do this because 
the original disk image is 500GB in size but only ~25GB are actually used by 
partitions. My Idea was to copy only the first part of the image. fdisks 
displays the partitions like this:

```
fdisk -l ./source.imgDisk ./source.img: 465.76 GiB, 500107862016 bytes, 
976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: AAAAA-AAAAA-AAAAA-AAAAA-AAAAA

Device                                   Start      End  Sectors  Size Type
./source.img1    2048   616447   614400  300M Windows recovery environment
./source.img2  616448   821247   204800  100M EFI System
./source.img3  821248  1083391   262144  128M Microsoft reserved
./source.img4 1083392 52891647 51808256 24.7G Microsoft basic data
```

I tried it like this:


```
sudo dd status=progress count=52891647 if=/source.img of=/target.img
```

After the operation is finished I get:


```
❯ fdisk -l ./taget.imgGPT PMBR size mismatch (976773167 != 52891646) will be 
corrected by write.
Disk ./taget.img: 25.22 GiB, 27080523264 bytes, 52891647 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4afd3a95

Device                                               Boot Start      End  
Sectors  Size Id Type
./taget.img1          1 52891646 52891646 25.2G ee GPT
```



I have no Idea what is happening. I tried iflag=sync conv=sync but the result 
is the same. Is there something I am missing?


Thank you very much and have a nice time


prk0ghy


---
Version:
coreutils.x86_64                                     9.6-6.fc42                 
             <unknown>coreutils-common.x86_64                              
9.6-6.fc42                              <unknown>
Kernel:
Linux host 6.17.1-300.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Oct  9 18:53:18 
UTC 2025 x86_64 GNU/Linux


OS:
Description: Bluefin (Version: gts-42.20251125)

Attachment: publickey - [email protected] - 0xEF4F400A.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to