Re: GPT backup table, was Re: virtualisation
On 5/27/23 07:42, mick.crane wrote: On 2023-05-27 10:33, Michael wrote: On Friday, 26 May 2023 11:47:04 CEST, Thomas Schmitt wrote: (And as mick.crane already noticed, it is a bit awkward to create an extended partiton 2 only to fill it nearly up with logical partition 5. I wonder what entity decided to do so.) on my debian 11 test vm with default installation it is exactly the same: root@debian11test:~# fdisk -l /dev/sda Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VBOX HARDDISK 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: 0x2e739d33 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 39942143 39940096 19G 83 Linux /dev/sda2 39944190 41940991 1996802 975M 5 Extended /dev/sda5 39944192 41940991 1996800 975M 82 Linux swap / Solaris greetings... I just installed bookworm on another SSD disk. The installer said it was going to partition the disk one for the / and another for swap After the installation the extended partition was there. That sounds like d-i did what you told it to do: https://www.debian.org/releases/stable/amd64/ch06s03.en.html#di-partition 6.3.4.2. Guided Partitioning All files in one partition Is this some attribute of pre formatted SSDs Unlikely. I didn't zero the disk as my old systemrescueCD CD failed to successfully boot. I'll get a more recent copy. mick d-i includes a rescue shell. You can use dd(1) to zero disks. David
Re: GPT backup table, was Re: virtualisation
> Back in the (DOS/w95) days, you would usually create one primary and one > extended, and populate the extended with as many partitions as you want. IIRC the reason why there was still that one primary was that you could only boot to a primary partition. BTW, I don't use extended partitions any more, but I reproduce the above structure because I typically have one smallish [the 500MB HDDs of our 64bit DEC Alpha workstations felt quite spacious back then] partition for /boot and a second for LVM :-) Stefan
Re: GPT backup table, was Re: virtualisation
On 26 May 2023 11:47, Thomas Schmitt wrote: Hi, mick.crane wrote: root@pumpkin:~# fdisk -l /dev/sda Disk /dev/sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors ... Disklabel type: dos ... Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 466862079 466860032 222.6G 83 Linux /dev/sda2 466864126 468860927 1996802 975M 5 Extended /dev/sda5 466864128 468860927 1996800 975M 82 Linux swap / Solaris Michael wrote: as i interpret this, the disk in questions has a dos partition table... Indeed. (And as mick.crane already noticed, it is a bit awkward to create an extended partiton 2 only to fill it nearly up with logical partition 5. I wonder what entity decided to do so.) IIRC, DOS types are limited to 4 "primary" partitions (or 2 ?), but extended partitions have no such limit, and can contain any number of others. Back in the (DOS/w95) days, you would usually create one primary and one extended, and populate the extended with as many partitions as you want. This way was used to avoid making mistakes : how many primary partitions do I have in the "root" table ? It's from memory, so 30 years old ^^
Re: GPT backup table, was Re: virtualisation
mick.crane wrote: > > I just installed bookworm on another SSD disk. > The installer said it was going to partition the disk one for the / and > another for swap > After the installation the extended partition was there. > Is this some attribute of pre formatted SSDs Nah, this is just the default. Run the partitioner yourself, get it to happen the way you want it to be. -dsr-
Re: GPT backup table, was Re: virtualisation
On 2023-05-27 10:33, Michael wrote: On Friday, 26 May 2023 11:47:04 CEST, Thomas Schmitt wrote: (And as mick.crane already noticed, it is a bit awkward to create an extended partiton 2 only to fill it nearly up with logical partition 5. I wonder what entity decided to do so.) on my debian 11 test vm with default installation it is exactly the same: root@debian11test:~# fdisk -l /dev/sda Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VBOX HARDDISK 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: 0x2e739d33 Device BootStart End Sectors Size Id Type /dev/sda1 *2048 39942143 39940096 19G 83 Linux /dev/sda2 39944190 41940991 1996802 975M 5 Extended /dev/sda5 39944192 41940991 1996800 975M 82 Linux swap / Solaris greetings... I just installed bookworm on another SSD disk. The installer said it was going to partition the disk one for the / and another for swap After the installation the extended partition was there. Is this some attribute of pre formatted SSDs I didn't zero the disk as my old systemrescueCD CD failed to successfully boot. I'll get a more recent copy. mick
Re: GPT backup table, was Re: virtualisation
On Friday, 26 May 2023 11:47:04 CEST, Thomas Schmitt wrote: (And as mick.crane already noticed, it is a bit awkward to create an extended partiton 2 only to fill it nearly up with logical partition 5. I wonder what entity decided to do so.) on my debian 11 test vm with default installation it is exactly the same: root@debian11test:~# fdisk -l /dev/sda Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VBOX HARDDISK 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: 0x2e739d33 Device BootStart End Sectors Size Id Type /dev/sda1 *2048 39942143 39940096 19G 83 Linux /dev/sda2 39944190 41940991 1996802 975M 5 Extended /dev/sda5 39944192 41940991 1996800 975M 82 Linux swap / Solaris greetings...
Re: GPT backup table, was Re: virtualisation
Am 26.05.2023 um 11:47 schrieb Thomas Schmitt: > (...) > (And as mick.crane already noticed, it is a bit awkward to create an > extended partiton 2 only to fill it nearly up with logical partition 5. > I wonder what entity decided to do so.) > About one year ago, i was helping some neighbor at setting up an old notebook to use linux, XUbuntu in that case. I was quite surprised to find out, that the installer had done exactly that: Setup MBR, with extended partition, where only swap was in. After making sure, that notebook could handle UEFI booting properly, i allowed myself to find out, if it was possible to change partitioning to GPT and booting to use EFI. - Yes, i did not need to backup/restore the partition contents, just carefully moving it to make room for EFISYS partition and such, and installing the EFI support was enough and the machine is working happily ever since. There may be other entities, but apparently in 2022 the Ubuntu installer still decided to go very old-fashionned about its job. ;-)
Re: GPT backup table, was Re: virtualisation
On 5/26/23 02:47, Thomas Schmitt wrote: >>On 5/23/23 14:59, David Christensen wrote: Your disk has 468862128 sectors. A GPT secondary partition table should start 33 sectors before the end of the disk: Here i disagree. The size of the GPT partition array is adjustable. 32 blocks of 4 entries each is a usual size. But actually you have to read from the GPT header block the 4 bytes beginning at offset 80 as little-endian number to get the number of array blocks (by dividing by 4). The start block of the partition array is adjustable, too: Offset 72, 8 bytes as 64-bit little-endian number. The position of the GPT header is always 512-byte block 1 for the primary partition table and the last valid block address of the device for the backup table. Specs for GPT are part of the UEFI specs. Current is: https://uefi.org/specs/UEFI/2.10/05_GUID_Partition_Table_Format.html (I myself am still reading version 2.6 ...) Thank you for the clarification and the citation. :-) David
GPT backup table, was Re: virtualisation
Hi, mick.crane wrote: > > > root@pumpkin:~# fdisk -l /dev/sda > > > Disk /dev/sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors > > > ... > > > Disklabel type: dos > > > ... > > > Device Boot Start End Sectors Size Id Type > > > /dev/sda1 * 2048 466862079 466860032 222.6G 83 Linux > > > /dev/sda2 466864126 468860927 1996802 975M 5 Extended > > > /dev/sda5 466864128 468860927 1996800 975M 82 Linux swap / > > > Solaris Michael wrote: > as i interpret this, the disk in questions has a dos partition table... Indeed. (And as mick.crane already noticed, it is a bit awkward to create an extended partiton 2 only to fill it nearly up with logical partition 5. I wonder what entity decided to do so.) David Christensen wrote: > > Did you zero your drive prior to installing Debian? Perhaps there > > is a leftover GPT secondary partition table on disk. See below. > on a disk with a gpt partition table, yes. > maybe i am missing something. if so, please enlighten me! A remnant backup GPT is a typical risk of repartitioning a USB stick from GPT to MBR Partition Table. Such repartitioning happens e.g. if you put a Debian installation or Live ISO onto a previously GPT partitioned stick. (xorriso-dd-target zeros the last block of the target stick in order to prevent partition editors from re-creating the previous GPT partitioning.) > > Your disk has 468862128 sectors. A GPT secondary partition table > > should start 33 sectors before the end of the disk: Here i disagree. The size of the GPT partition array is adjustable. 32 blocks of 4 entries each is a usual size. But actually you have to read from the GPT header block the 4 bytes beginning at offset 80 as little-endian number to get the number of array blocks (by dividing by 4). The start block of the partition array is adjustable, too: Offset 72, 8 bytes as 64-bit little-endian number. The position of the GPT header is always 512-byte block 1 for the primary partition table and the last valid block address of the device for the backup table. Specs for GPT are part of the UEFI specs. Current is: https://uefi.org/specs/UEFI/2.10/05_GUID_Partition_Table_Format.html (I myself am still reading version 2.6 ...) > > Run the following command to see if there is a GPT secondary partition > > table on your disk: > > # dd bs=512 count=33 if=/dev/sda skip=468862095 | hexdump -C So i would rather propose to inspect the last block, whether it begins by the bytes "EFI PART\000\000\001\000" (meaning GPT version 1.0): dd bs=512 count=1 if=/dev/sda skip=468862127 | hexdump -C Have a nice day :) Thomas