dankamongmen / growlight

notcurses block device manager / system installation tool

Home Page:https://nick-black.com/dankwiki/index.php/Growlight

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

first gpt partition is created atop gpt table in sector 1

dankamongmen opened this issue · comments

See #119. I can make a GPT partition table, and create a partition within it, but once I create a filesystem, the GPT header goes to shit. The disk typically becomes unmountable without repair of the GPT. 1.2.22.

Ahhh, I think we're misplacing our partition atop the actual GPT header:

[grimes](130) $ sudo mkfs.ext4 -b -2048 -Lsurvivor /dev/sdc1
mke2fs 1.45.6 (20-Mar-2020)
/dev/sdc1 contains `GPT data structure (nonstandard: at LBA 0), version 1.0, GUID: 5adf637b-56b0-50e8-4cf6-b26c966cf84f, disk size: 483655680 sectors (sector size unknown)' data
Proceed anyway? (y,N) 

yeah, partition 1 needs to start on sector 34 or something better aligned than that:


Device     Start       End   Sectors   Size Type
/dev/sdc1      1 483655679 483655679 230.6G Linux filesystem

Command (m for help): 

this is definitely our problem, yuck!

OK, so the problem here is that we're no longer creating the little empty partition to set up alignment. Get that back, and we'll properly place the new partition. How'd we lose that? :(

I then think we ought reject such destructive partitioning requests in add_partition().

OK, it looks like I have a fix, but the area references #61, hrmmm, need to look into it.

well, let's test with memtest86+ and make sure that case still works. if so, i've got a good fix.

yep, it looks right in both:

[growlight](-1)> blockdev detail /dev/sdc
sdc        Survivor 3.0     000A 247.63G  512B RO... gpt   n/a              PATA
Unused sectors 0:2047 (1Mi)
sdc1       19711852-a6f1-4811-9118-740f6e78ed13 261.10M Oth MemTest86
Unused sectors 512001:514047 (1023.50Ki)
sdc2       fef687e4-0e4a-47d8-9341-10d46db5686f 261.08M ESP EFI System Partition
Unused sectors 1023967:483655680 (230.14Gi)

committing this fix.