Re: cloning a disk

"mick.crane" <[email protected]>
Newsgroups gmane.linux.debian.user
Message-ID <[email protected]>
On 2026-08-08 14:41, Stefan Monnier wrote:
>> root@melon:~# fdisk -l
>> Disk /dev/sdb: 111.79 GiB, 120034123776 bytes, 234441648 sectors
> [...]
>> GPT PMBR size mismatch (234441647 != 468862127) will be corrected by 
>> write.
>> The backup GPT table is corrupt, but the primary appears OK, so that 
>> will
>> be used.
>> The backup GPT table is not on the end of the device.
> [...]
>> Disk /dev/sdg: 223.57 GiB, 240057409536 bytes, 468862128 sectors
> [...]
>> I always thought the GPT error message was about the small OS drive 
>> but
>> I disconnected the 3TB drive and commented out its fstab entry and 
>> rebooted
> 
> The GPT partitioning format keeps 2 copies of the table of partitions: 
> one
> at the beginning of the drive and one at the end, and also the info it
> keeps includes the size of the drive.  So when you clone to
> a differently-sized drive, the 2nd (aka "backup") is inevitably
> lost/misplaced.  This is normal.
> 
> Notice how the "size mismatch (234441647 != 468862127)" mentions 
> exactly
> (well, off-by-one) the sizes of your two drives.
> 
> 
> === Stefan

This is with only the 111GB disk connected.
root@melon:~# fdisk -l
Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: CT120BX500SSD1
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: D97B2271-48BB-4988-BEFA-5153C05D7C94

Device         Start       End   Sectors   Size Type
/dev/sda1       2048   2000895   1998848   976M EFI System
/dev/sda2    2000896 222339071 220338176 105.1G Linux filesystem
/dev/sda3  222339072 234440703  12101632   5.8G Linux swap
root@melon:~#
-------
This is with only the 2.73TB and the 111GB disk connected.
root@melon:~# fdisk -l
Disk /dev/sdb: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: CT120BX500SSD1
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: D97B2271-48BB-4988-BEFA-5153C05D7C94

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048   2000895   1998848   976M EFI System
/dev/sdb2    2000896 222339071 220338176 105.1G Linux filesystem
/dev/sdb3  222339072 234440703  12101632   5.8G Linux swap
The backup GPT table is corrupt, but the primary appears OK, so that 
will be used.

### (^^^^^^^ I always thought that this message was about the 111GB disk 
but now I think it is the fdisk reading first the partition/GPT table of 
the 2.73TB disk)

Disk /dev/sda: 2.73 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: ST3000NM0005-1V4
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: F6A1B30E-8495-8F4B-B53D-4D80D5C28C81

Device     Start        End    Sectors  Size Type
/dev/sda1   2048 5860532223 5860530176  2.7T Linux filesystem
root@melon:~#

So now I've diverted from the original "cloning a disk" question and 
I've other issues to do with understanding the GPT of disks.
I'm not understanding if the backup GPT Header is on the primary 
partition or not.
Perhaps I should have used gdisk instead of fdisk to partition the 2.7TB 
disk?
I'm not knowing if after making the GPT table with fdisk then making 1 
primary partition on the 2.7TB disk I wrote over the GPT Backup Header.

mick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.