[parted-devel] [PATCH] Always allow at least two sectors for extended boot record
Jim Meyering
jim at meyering.net
Mon Mar 29 17:37:51 UTC 2010
Phillip Susi wrote:
> On 3/29/2010 12:49 PM, Jim Meyering wrote:
>> Thanks!
>> This looks like a fine patch.
>> However, I would like a minimal test that fails without it,
>> yet that succeeds with the patch.
>>
>> Can you provide one?
>
> I also ran into this over the weekend. IIRC you just have to run parted
> with -a none and put it in sector unit mode, then when you create a
> logical partition with a starting sector +1 from the starting sector of
> the extended partition, it fails.
>
> It seems at some point along the line that the kernel was patched to
> create a device node for the extended partition ( I swear there was a
> time when it didn't ) and always sets the size to 2 sectors so that you
> can install LILO to the extended partition. I've posted a message to
> LKML today about this because I think this is an error; the size should
> be as much or as little hidden sectors there are before the start of the
> logical partition. In this test case where the logical starts on the
> very next sector, then the extended partition should only have a length
> of 1. Since it gets a length of 2 instead, parted fails to add the
> logical partition since it overlaps with the extended.
I tried to do what I think you and Colin have suggested,
but parted succeeds (and prints identical output) both with
and without the patch.
Note how the logical partition starts one sector
after the beginning of the extended one.
Did I misunderstand?
#!/bin/sh
PATH=../parted:$PATH
sector_size_=512
ss=$sector_size_
dev=dev-file
rm -f $dev
n_sectors=10000
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors
parted --align=none -s $dev mklabel msdos \
mkpart pri ext2 $((1*2048))s $((2*2048-1))s \
mkpart extended $((2*2048))s $((4*2048-1))s \
mkpart logical $((2*2048+1))s $((3*2048-1))s \
u s print
$ bash sample-test-msdos-extended-leave-two-sector-min
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.0183e-05 s, 0.0 kB/s
Model: (file)
Disk /1/parted/tests/dev-file: 10000s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 2048s 4095s 2048s primary
2 4096s 8191s 4096s extended lba
5 4097s 6143s 2047s logical
More information about the parted-devel
mailing list