friendly ping...
CC:bug-parted@gnu.org

On 2020/6/1 9:56, Zhiqiang Liu wrote:
> Hi:
> Now I parted a disk with command “parted /dev/sdb -s mkpart primary 0cyl 
> 128cyl”
> but the result was unexpected. The partition started 512 kB but not expected 
> 1 MB.
> What’s more, the size of partition was 33.4 MB but not expected 1 GB. The 
> commands are as follows,
>    1. dd if=/dev/zero of=/dev/sdb bs=1M count=10
>    2. parted /dev/sdb  -s mklabel msdos
>    3. parted /dev/sdb -s mkpart primary 0cyl 128cyl
>     ->Warning: The resulting partition is not properly aligned for best 
> performance: 1s % 2048s != 0s
> 
> After analysis, the reason of size changed was that cylinder’s size was 
> changed.
> And the reason of starting position changed was that partition could not align
> by 2048 sectors. When partition tried to align 2048 sectors, the end sector of
> partition could not be in range of [127.5, 128.5) *cyl, which didn’t meet
> command “128cyl”.
> 
> I found that one patch for parted/libparted/arch/linux.c as show in
> https://dcantrel.fedorapeople.org/patches/parted/0001-Use-BLKSSZGET-to-get-device-sector-size-in-_device_p.patch
>  is
> related with the problem. ioctl (arch_specific->fd, BLKSSZGET, &sector_size) 
> are used to get dev->bios_geom.sectors,
> which changes from 63 to (1 + sector_size/PED_SECTOR_SIZE_DEFAULT).
> 
> The patch has changed the cylinder’s size, and using cyl to align partitions 
> will always fail.
> However, I do not have any idea to solve the problem. Could you help me?
> 
> Best regards.
> Zhiqiang Liu
> 




Reply via email to